samborabora,
Here is a PHP block code that you can use for what was requested. I recommend to disallow the block for guests and to use it as a side block.
Custom PHP block code (advised to disallow for guests):
/*
* Customize Personal Text for SMF forums c/o Underdog @ http://webdevelop.comli.com
* Copyright 2014 underdog@webdevelop.comli.com
* This portal block code is distributed under the terms of its CC BY 4.0 License: http://creativecommons.org/licenses/by/4.0/
*/
global $smcFunc, $user_info, $context, $txt;
loadLanguage('Profile');
$personalText = '';
$currentPage = currentPageUrlPtext();
if (!empty($context['user']['is_guest']))
return false;
if (!allowedTo('profile_identity_own'))
$disabled = 'disabled="true"';
else
$disabled = '';
$request = $smcFunc['db_query']('', "
SELECT personal_text
FROM {db_prefix}members
WHERE id_member = {int:member}",
array('member' => $user_info['id'])
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$personalText = !empty($row['personal_text']) ? $row['personal_text'] : $personalText;
$smcFunc['db_free_result']($request);
echo '
<form action="', $currentPage, '" method="post">
<dl class="centertext">
<dt>
<strong>', $txt['personal_text'], '</strong>
</dt>
<dd style="position:relative;display:block;margin-left:0px;">
<input type="text" name="personal_text" id="personal_text" size="20" value="' . $personalText . '" maxlength="50" class="input_text" ' . $disabled . '/>
</dd>
<dd style="position:relative;display:block;margin-left:0px;padding-top:0.5em;">
<input type="submit" value="Submit" class="button_submit" />
<input type="hidden" name="submit_ptext" />
</dd>
</dl>
</form>';
$sanitizedData = !empty($_REQUEST['personal_text']) && isset($_REQUEST['submit_ptext']) ? htmlspecialchars__recursive($_REQUEST['personal_text']) : false;
if (!empty($sanitizedData) && empty($disabled))
{
updateMemberData($user_info['id'], array('personal_text' => $sanitizedData));
redirectexit($currentPage);
}
function currentPageUrlPtext($pageURL = 'http://')
{
if (!empty($_SERVER["HTTPS"]))
$pageURL = "https://";
if ($_SERVER["SERVER_PORT"] != "80")
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
else
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
return $pageURL;
}
Regards.