mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Issue #1767 - Signup extended user field refinements.
This commit is contained in:
@@ -452,7 +452,7 @@ class signup_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function sc_signup_extended_user_fields()
|
function sc_signup_extended_user_fields($parm=null)
|
||||||
{
|
{
|
||||||
global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $SIGNUP_EXTENDED_CAT;
|
global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $SIGNUP_EXTENDED_CAT;
|
||||||
$text = "";
|
$text = "";
|
||||||
@@ -501,10 +501,17 @@ class signup_shortcodes extends e_shortcode
|
|||||||
$done_heading = true;
|
$done_heading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$label = $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), false, 'emotes_off,defs');
|
||||||
|
|
||||||
|
if(!empty($parm['placeholder']))
|
||||||
|
{
|
||||||
|
$parm['placeholder'] = str_replace('[label]', $label, $parm['placeholder']);
|
||||||
|
}
|
||||||
|
|
||||||
$replace = array(
|
$replace = array(
|
||||||
$tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), false, 'emotes_off,defs'),
|
$label,
|
||||||
($ext['user_extended_struct_required'] == 1 ? $this->sc_signup_is_mandatory('true') : ''),
|
($ext['user_extended_struct_required'] == 1 ? $this->sc_signup_is_mandatory('true') : ''),
|
||||||
$usere->user_extended_edit($ext, $_POST['ue']['user_' . $ext['user_extended_struct_name']])
|
$usere->renderElement($ext, $_POST['ue']['user_' . $ext['user_extended_struct_name']], $parm)
|
||||||
);
|
);
|
||||||
|
|
||||||
$text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
|
$text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);
|
||||||
|
@@ -871,11 +871,12 @@ class e107_user_extended
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $struct
|
* @param array $struct
|
||||||
* @param $curval
|
* @param mixed $curval
|
||||||
|
* @param array $opts
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
function renderElement($struct, $curval)
|
public function renderElement($struct, $curval, $opts=array())
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
@@ -901,7 +902,8 @@ class e107_user_extended
|
|||||||
$fid = $frm->name2id($fname);
|
$fid = $frm->name2id($fname);
|
||||||
$placeholder = (!empty($parms[4])) ? "placeholder=\"".$tp->toAttribute($parms[4])."\"" : "";
|
$placeholder = (!empty($parms[4])) ? "placeholder=\"".$tp->toAttribute($parms[4])."\"" : "";
|
||||||
|
|
||||||
$class = "form-control tbox";
|
$class = !empty($opts['class']) ? $opts['class'] : "form-control tbox";
|
||||||
|
$placeholder = !empty($opts['placeholder']) ? "placeholder=\"".$tp->toAttribute($opts['placeholder'])."\"" : $placeholder;
|
||||||
|
|
||||||
if(!empty($parms[5]))
|
if(!empty($parms[5]))
|
||||||
{
|
{
|
||||||
@@ -924,7 +926,7 @@ class e107_user_extended
|
|||||||
{
|
{
|
||||||
|
|
||||||
case EUF_COUNTRY:
|
case EUF_COUNTRY:
|
||||||
return e107::getForm()->country($fname,$curval);
|
return e107::getForm()->country($fname,$curval, $opts);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@@ -960,7 +962,7 @@ class e107_user_extended
|
|||||||
|
|
||||||
if(deftrue('BOOTSTRAP'))
|
if(deftrue('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
$ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required']));
|
$ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> !empty($required)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1075,10 +1077,23 @@ class e107_user_extended
|
|||||||
|
|
||||||
if(THEME_LEGACY === true)
|
if(THEME_LEGACY === true)
|
||||||
{
|
{
|
||||||
return e107::getForm()->text($fname,$curval,10,array('placeholder'=>'yyyy-mm-dd'));
|
if(empty($opts['placeholder']))
|
||||||
|
{
|
||||||
|
$opts['placeholder'] = 'yyyy-mm-dd';
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getForm()->text($fname,$curval,10,$opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
return e107::getForm()->datepicker($fname,$curval,array('format'=>'yyyy-mm-dd','return'=>'string'));
|
$opts['format'] = 'yyyy-mm-dd';
|
||||||
|
$opts['return'] = 'string';
|
||||||
|
|
||||||
|
if(!empty($required))
|
||||||
|
{
|
||||||
|
$opts['required'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getForm()->datepicker($fname,$curval,$opts);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EUF_LANGUAGE : // language
|
case EUF_LANGUAGE : // language
|
||||||
|
Reference in New Issue
Block a user