1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 20:51:53 +02:00

User/Member List may now include extended user-field data. Use {USER_EUF: field=xxxx} (excluding the 'user_' ) in your user_template.

This commit is contained in:
Cameron 2016-03-22 16:52:54 -07:00
parent 0b27b3d760
commit 846be2c23c
4 changed files with 68 additions and 23 deletions

View File

@ -660,8 +660,27 @@ class user_shortcodes extends e_shortcode
";
}
}
// v2.x extended user field data.
/**
* Usage {USER_EUF: field=xxxx} (excluding the 'user_' )
* @param string $parm
* @return string
*/
function sc_user_euf($parm='')
{
if(!empty($parm['field']))
{
$fld = 'user_'.$parm['field'];
$val = $this->var[$fld];
return e107::getUserExt()->renderValue($val); //TODO auto-detect type, from within the user-extended class.
}
return ' ';
}
function sc_user_extended_all($parm)
{

View File

@ -189,6 +189,7 @@
'link' => 'blogcalendar_menu/config.php',
),
)]]></core>
<core name="membersonly_redirect">login</core>
<core name="meta_tag"></core>
<core name="multilanguage">0</core>
<core name="nbr_cols">1</core>

View File

@ -141,12 +141,12 @@ class user_class
if ($temp = $e107->ecache->retrieve_sys(UC_CACHE_TAG))
{
$this->class_tree = e107::getArrayStorage()->read($temp);
$this->class_tree = e107::unserialize($temp);
unset($temp);
}
else
{
if($this->sql_r->field('userclass_classes','userclass_parent') && $this->sql_r->select('userclass_classes', '*', 'ORDER BY userclass_parent', 'nowhere')) // The order statement should give a consistent return
if($this->sql_r->field('userclass_classes','userclass_parent') && $this->sql_r->select('userclass_classes', '*', 'ORDER BY userclass_parent,userclass_name', 'nowhere')) // The order statement should give a consistent return
{
while ($row = $this->sql_r->fetch())
{
@ -221,6 +221,9 @@ class user_class
{
$is = array();
$start_array = explode(',', $startList);
foreach ($start_array as $sa)
{ // Merge in latest values - should eliminate duplicates as it goes
$is[] = $sa; // add parent to the flat list first

View File

@ -235,30 +235,52 @@ if (isset($id))
exit;
}
$users_total = $sql->count("user","(*)", "WHERE user_ban = 0");
// $users_total = $sql->count("user","(*)", "WHERE user_ban = 0");
if (!$sql->select("user", "*", "user_ban = 0 ORDER BY user_id $order LIMIT $from,$records"))
{
echo "<div style='text-align:center'><b>".LAN_USER_53."</b></div>";
}
else
{
$userList = $sql->db_getList();
$text = $tp->parseTemplate($USER_SHORT_TEMPLATE_START, TRUE, $user_shortcodes);
foreach ($userList as $row)
// --------------------- List Users ------------------------ //TODO Put all of this into a class.
$users_total= 0;
$query = "SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON u.user_id = ue.user_extended_id WHERE u.user_ban = 0 ORDER BY u.user_id ".$order." LIMIT ".intval($from).",".intval($records);
if (!$data = $sql->retrieve($query,true))
// if (!$sql->select("user", "*", "user_ban = 0 ORDER BY user_id $order LIMIT $from,$records"))
{
$loop_uid = $row['user_id'];
$text .= renderuser($row, "short");
echo "<div style='text-align:center'><b>".LAN_USER_53."</b></div>";
}
$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
}
else
{
$users_total = count($data);
// $userList = $sql->db_getList();
$text = $tp->parseTemplate($USER_SHORT_TEMPLATE_START, TRUE, $user_shortcodes);
foreach ($data as $row)
{
$loop_uid = $row['user_id'];
// $text .= renderuser($row, "short");
e107::getScBatch('user')->setVars($row);
$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE, TRUE, $user_shortcodes);
}
$text .= $tp->parseTemplate($USER_SHORT_TEMPLATE_END, TRUE, $user_shortcodes);
}
$ns->tablerender(LAN_USER_52, $text);
$parms = $users_total.",".$records.",".$from.",".e_SELF.'?[FROM].'.$records.".".$order;
echo "<div class='nextprev form-inline'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
$ns->tablerender(LAN_USER_52, $text);
$parms = $users_total.",".$records.",".$from.",".e_SELF.'?[FROM].'.$records.".".$order;
echo "<div class='nextprev form-inline'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
function renderuser($uid, $mode = "verbose")
@ -281,7 +303,7 @@ function renderuser($uid, $mode = "verbose")
}
}
e107::getScBatch('user')->setVars($user);
if($mode == 'verbose')
{