1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-25 23:36:29 +02:00

Fixes #544 - Extended user fields not visible.

This commit is contained in:
Cameron
2014-10-14 02:09:53 -07:00
parent 01f0751c04
commit f644b7b8a3
5 changed files with 118 additions and 21 deletions

View File

@@ -599,7 +599,13 @@ class user_shortcodes extends e_shortcode
$sql = e107::getDb();
$tp = e107::getParser();
global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE;
$template = e107::getCoreTemplate('user','extended');
$EXTENDED_CATEGORY_START = $template['start'];
$EXTENDED_CATEGORY_END = $template['end'];
$EXTENDED_CATEGORY_TABLE = $template['item'];;
$qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f
LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id
ORDER BY c.user_extended_struct_order ASC, f.user_extended_struct_order ASC
@@ -607,23 +613,37 @@ class user_shortcodes extends e_shortcode
require_once(e_HANDLER."user_extended_class.php");
$ue = new e107_user_extended;
$ueCatList = $ue->user_extended_get_categories();
$ueFieldList = $ue->user_extended_get_fields();
$ueCatList[0][0] = array('user_extended_struct_name' => LAN_USER_44, 'user_extended_struct_text' => '');
// print_a($ueFieldList);
$ret = "";
foreach($ueCatList as $catnum => $cat)
{
$key = $cat[0]['user_extended_struct_text'] ? $cat[0]['user_extended_struct_text'] : $cat[0]['user_extended_struct_name'];
$cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE);
$cat_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE); //XXX FIXME Fails
$cat_name = true; //XXX TEMP Fix.
if($cat_name != FALSE && count($ueFieldList[$catnum]))
{
$ret .= str_replace("{EXTENDED_NAME}", $key, $EXTENDED_CATEGORY_START);
foreach($ueFieldList[$catnum] as $f)
{
$key = $f['user_extended_struct_name'];
if($ue_name = $tp->parseTemplate("{USER_EXTENDED={$key}.text.{$this->var['user_id']}}", TRUE))
{
@@ -739,11 +759,47 @@ class user_shortcodes extends e_shortcode
}
function sc_user_embed_userprofile($parm)
function sc_user_addons($parm='')
{
global $pref, $USER_EMBED_USERPROFILE_TEMPLATE, $embed_already_rendered;
$template = e107::getCoreTemplate('user','addon');
$tp = e107::getParser();
$data = e107::getAddonConfig('e_user',null,'profile');
if(empty($data))
{
return;
}
$text = '';
foreach($data as $plugin=>$val)
{
foreach($val as $v)
{
$array = array(
'USER_ADDON_LABEL' => $v['label'],
'USER_ADDON_TEXT' => $v['text']
);
$text .= $tp->parseTemplate($template, true, $array);
}
}
return $text;
}
/**
* @Deprecated Use {USER_ADDONS} instead.
*/
function sc_user_embed_userprofile($parm='')
{
return $this->sc_user_addons($parm);
//if no parm, it means we render ALL embedded contents
//so we're preloading all registerd e_userprofile files
$key = varset($pref['e_userprofile_list']);

View File

@@ -25,11 +25,9 @@ $EXTENDED_CATEGORY_START = "<tr><td colspan='2' class='forumheader center'>{EXTE
$EXTENDED_CATEGORY_TABLE = "
<tr>
<td style='width:40%' class='forumheader3'>
{EXTENDED_ICON}&nbsp;
{EXTENDED_NAME}
<td style='width:30%' class='forumheader3'>{EXTENDED_ICON}{EXTENDED_NAME}
</td>
<td style='width:60%' class='forumheader3'>{EXTENDED_VALUE}</td>
<td style='width:70%' class='forumheader3'>{EXTENDED_VALUE}</td>
</tr>
";
@@ -96,6 +94,9 @@ $sc_style['USER_RATING']['post'] = "</div></td></tr>";
$sc_style['USER_LOGINNAME']['pre'] = " : ";
//FIXME TODO - Remove IF statements from template.
if(isset($pref['photo_upload']) && $pref['photo_upload'])
{
@@ -192,7 +193,7 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
<td style='width:30%' class='forumheader3'>".LAN_USER_66."</td>
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
</tr>
{USER_EMBED_USERPROFILE}
{USER_ADDONS}
{USER_UPDATE_LINK}
<tr>
<td colspan='2' class='forumheader3 center'>
@@ -210,7 +211,32 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
";
$USER_EMBED_USERPROFILE_TEMPLATE = "
<tr><td colspan='2' class='fcaption'>{USER_EMBED_USERPROFILE_CAPTION}</td></tr>
<tr><td colspan='2' class='forumheader3'>{USER_EMBED_USERPROFILE_TEXT}</td></tr>";
<tr>
<td class='forumheader3'>{USER_ADDON_LABEL}</td>
<td class='forumheader3'>{USER_ADDON_TEXT}</td>
</tr>";
// Convert v1 to v2 Standards.
$USER_TEMPLATE['view'] = $USER_FULL_TEMPLATE;
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_START;
$USER_TEMPLATE['extended']['item'] = $EXTENDED_CATEGORY_TABLE ;
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_END;
$USER_TEMPLATE['addon'] = $USER_EMBED_USERPROFILE_TEMPLATE;
$USER_TEMPLATE['list']['start'] = $USER_SHORT_TEMPLATE_START;
$USER_TEMPLATE['list']['item'] = $USER_SHORT_TEMPLATE;
$USER_TEMPLATE['list']['end'] = $USER_SHORT_TEMPLATE_END;
// Convert Shortcode Wrappres from v1.x to v2.x standards.
$USER_WRAPPER['view']['USER_COMMENTS_LINK'] = $sc_style['USER_COMMENTS_LINK']['pre']."{---}".$sc_style['USER_COMMENTS_LINK']['post'];
$USER_WRAPPER['view']['USER_SIGNATURE'] = $sc_style['USER_SIGNATURE']['pre']."{---}".$sc_style['USER_SIGNATURE']['post'];
$USER_WRAPPER['view']['USER_UPDATE_LINK'] = $sc_style['USER_UPDATE_LINK']['pre']."{---}".$sc_style['USER_UPDATE_LINK']['post'];
$USER_WRAPPER['view']['USER_FORUM_LINK'] = $sc_style['USER_FORUM_LINK']['pre']."{---}".$sc_style['USER_FORUM_LINK']['post'];
$USER_WRAPPER['view']['USER_RATING'] = $sc_style['USER_RATING']['pre']."{---}".$sc_style['USER_RATING']['post'];
$USER_WRAPPER['view']['USER_SENDPM'] = $sc_style['USER_SENDPM']['pre']."{---}".$sc_style['USER_SENDPM']['post'];
?>