mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Merge pull request #2068 from lonalore/master
Issue #2055 - Show readonly values in readonly textfield.
This commit is contained in:
@@ -22,22 +22,34 @@ class usersettings_shortcodes extends e_shortcode
|
||||
function sc_username($parm) // This is the 'display name'
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
$dis_name_len = varset($pref['displayname_maxlength'], 15);
|
||||
|
||||
if (check_class($pref['displayname_class']) || $pref['allowEmailLogin'] == 1) // display if email is used for login.
|
||||
if(check_class($pref['displayname_class']) || $pref['allowEmailLogin'] == 1) // display if email is used for login.
|
||||
{
|
||||
$dis_name_len = varset($pref['displayname_maxlength'],15);
|
||||
$options = array('title'=> LAN_USER_80, 'size' => 40);
|
||||
$options = array(
|
||||
'title' => LAN_USER_80,
|
||||
'size' => 40,
|
||||
);
|
||||
|
||||
return e107::getForm()->text('username',$this->var['user_name'], $dis_name_len, $options);
|
||||
return e107::getForm()->text('username', $this->var['user_name'], $dis_name_len, $options);
|
||||
}
|
||||
else
|
||||
|
||||
if($parm == 'show') // Show it, but as a readonly field.
|
||||
{
|
||||
return ($parm == 'show') ? $this->var['user_name'] : ''; // ; if it can't be changed then hide it.
|
||||
$options = array(
|
||||
'title' => LAN_USER_80,
|
||||
'size' => 40,
|
||||
'readonly' => true,
|
||||
);
|
||||
|
||||
return e107::getForm()->text('username', $this->var['user_name'], $dis_name_len, $options);
|
||||
}
|
||||
|
||||
// Hide it!
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sc_loginname($parm)
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
@@ -47,22 +59,21 @@ class usersettings_shortcodes extends e_shortcode
|
||||
return; // hide login name when email-login is being used. (may contain social login info)
|
||||
}
|
||||
|
||||
if (ADMIN && getperms("4"))
|
||||
$log_name_length = varset($pref['loginname_maxlength'], 30);
|
||||
|
||||
$options = array(
|
||||
'title' => ($pref['allowEmailLogin'] == 1) ? LAN_USER_82 : LAN_USER_80,
|
||||
'size' => 40,
|
||||
);
|
||||
|
||||
if(ADMIN && getperms("4")) // Has write permission.
|
||||
{
|
||||
|
||||
$log_name_length = varset($pref['loginname_maxlength'],30);
|
||||
|
||||
$options = array(
|
||||
'title'=> ($pref['allowEmailLogin'] ==1 ) ? LAN_USER_82 : LAN_USER_80,
|
||||
'size' => 40
|
||||
);
|
||||
|
||||
return e107::getForm()->text('loginname',$this->var['user_loginname'], $log_name_length, $options);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->var['user_loginname'];
|
||||
return e107::getForm()->text('loginname', $this->var['user_loginname'], $log_name_length, $options);
|
||||
}
|
||||
|
||||
// No write permission.
|
||||
$options['readonly'] = true;
|
||||
return e107::getForm()->text('loginname', $this->var['user_loginname'], $log_name_length, $options);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,15 +91,21 @@ class usersettings_shortcodes extends e_shortcode
|
||||
|
||||
function sc_realname($parm)
|
||||
{
|
||||
if(!empty($this->var['user_xup'])) // social login active.
|
||||
$pref = e107::getPref();
|
||||
$sc = e107::getScBatch('usersettings');
|
||||
|
||||
$options = array(
|
||||
'title' => '',
|
||||
'size' => 40,
|
||||
'required' => $pref['signup_option_realname'],
|
||||
);
|
||||
|
||||
if(!empty($sc->var['user_login']) && !empty($sc->var['user_xup'])) // social login active.
|
||||
{
|
||||
return $this->var['user_login'];
|
||||
$options['readonly'] = true;
|
||||
}
|
||||
|
||||
|
||||
$pref = e107::getPref();
|
||||
$options = array('title'=> '', 'size' => 40,'required'=>$pref['signup_option_realname']);
|
||||
return e107::getForm()->text('realname',$this->var['user_login'], 100, $options);
|
||||
return e107::getForm()->text('realname', $sc->var['user_login'], 100, $options);
|
||||
}
|
||||
|
||||
|
||||
@@ -147,13 +164,20 @@ class usersettings_shortcodes extends e_shortcode
|
||||
|
||||
function sc_email($parm)
|
||||
{
|
||||
if(!empty($this->var['user_xup'])) // social login active.
|
||||
$sc = e107::getScBatch('usersettings');
|
||||
|
||||
$options = array(
|
||||
'size' => 40,
|
||||
'title' => '',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
if(!empty($sc->var['user_email']) && !empty($sc->var['user_xup'])) // social login active.
|
||||
{
|
||||
return $this->var['user_email'];
|
||||
$options['readonly'] = true;
|
||||
}
|
||||
|
||||
$options = array('size' => 40,'title'=>'','required'=>true);
|
||||
return e107::getForm()->email('email', $this->var['user_email'], 100, $options);
|
||||
return e107::getForm()->email('email', $sc->var['user_email'], 100, $options);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user