WebSite X5Help Center

 
Lucio Flavio
Lucio Flavio
User

Insert the logged in user name automatically in the "Name" field in the Comment  en

Autor: Lucio Flavio
Visitado 1258, Followers 1, Compartido 0  

Inserting the logged in user name automatically in the "Name" in the comment form on the blog?

I found these codes in _x5engine.php_ but I can not make it work:

/**
* Get an array of data about the logged user
*
* @method whoIsLogged
*
* @return {mixed} An array containing the data of the current logged user or false if no user is logged.
*/
function whoIsLogged()
{
global $imSettings;
if (isset($_SESSION[$this->session_uname]) && $_SESSION[$this->session_uname] != "" && isset($_SESSION[$this->session_uname])) {
$uname = $this->_decode($_SESSION[$this->session_uname], $this->salt);
return array(
"username" => $uname,
"uid" => $this->_decode($_SESSION[$this->session_uid], $this->salt),
"realname" => $this->_decode($_SESSION[$this->session_real_name], $this->salt),
"groups" => $_SESSION[$this->session_gids]
);
}
return false;
}

.

.

.

/*
|-------------------------------------------
| Show the form
|-------------------------------------------
*/

if (isset($_GET[$this->id . 'success'])) {
echo "<div class=\"alert alert-green\">" . l10n('blog_send_confirmation') . "</div>";
} else if (isset($_GET[$this->id . 'error'])) {
echo "<div class=\"alert alert-red\">" . l10n('blog_send_error') . "</div>";
}

echo "<div class=\"topic-form\">
<form id=\"" . $id ."\" action=\"" . $this->posturl . "\" method=\"post\" onsubmit=\"return x5engine.imForm.validate(this, {type: 'tip', showAll: true})\">
<input type=\"hidden\" name=\"post_id\" value=\"" . $this->id . "\"/>
<div class=\"topic-form-row\">
<label for=\"" . $id . "-name\" style=\"float: left; width: 100px;\">" . l10n('blog_name') . "*</label> <input type=\"text\" id=\"" . $id . "-name\" name=\"name\" class=\"imfield mandatory\" value=\" HERE COMES THE NAME "realname" DO LOGGED USER \" />
</div>
<div class=\"topic-form-row\">
<label for=\"" . $id . "-email\" style=\"float: left; width: 100px;\">" . l10n('blog_email') . "*</label> <input type=\"text\" id=\"" . $id . "-email\" name=\"email\" class=\"imfield mandatory valEmail\"/>
</div>
<div class=\"topic-form-row\">
<label for=\"" . $id . "-url\" style=\"float: left; width: 100px;\">" . l10n('blog_website') . "</label> <input type=\"text\" id=\"" . $id . "-url\" name=\"url\" />
</div>";

EXCUSE ME WRITING BECAUSE I DO NOT SPEAK ENGLISH

Publicado en
1 RESPUESTAS - 1 ÚTIL - 1 CORRECTO
Incomedia
Claudio D.
Incomedia

Hello Lucio,

A collegue already answered you at https://helpcenter.websitex5.com/post/123435 , you can follow that post to find the solution.
I kindly ask you to open only one post for question: It’s better for you, because you need to follow less posts, and also for the community, that can use better the internal search engine.

Many thanks!

Leer más
Publicado en de Claudio D.