1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-13 17:12:07 +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'];
?>

View File

@ -1803,9 +1803,10 @@ class e107
* Retrieves config() from all plugins for addons such as e_url.php, e_cron.php, e_sitelink.php
* @param string $addonName eg. e_cron, e_url
* @param string $className [optional] (if different from addonName)
* @param string $methodName [optional] (if different from 'config')
* @return none
*/
public function getAddonConfig($addonName, $className = '')
public function getAddonConfig($addonName, $className = '', $methodName='config' )
{
$new_addon = array();
$sql = e107::getDb(); // Might be used by older plugins.
@ -1827,7 +1828,7 @@ class e107
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
$class_name = $key.'_'.$className;
$array = self::callMethod($class_name, 'config');
$array = self::callMethod($class_name, $methodName);
if($array)
{
@ -2250,6 +2251,8 @@ class e107
//FIXME XXX URGENT - Add support for _WRAPPER and $sc_style BC. - save in registry and retrieve in getScBatch()?
// Use: list($pre,$post) = explode("{---}",$text,2);
$tp = self::getParser(); // BC FIx - avoid breaking old templates due to missing globals.
if(null === self::getRegistry($regPath))
{

View File

@ -44,9 +44,9 @@ class e107plugin
'e_event',
'e_comment',
'e_sql',
'e_userprofile',
// 'e_userprofile', @deprecated @see e_user
'e_header',
'e_userinfo',
// 'e_userinfo', @deprecated @see e_user
'e_tagwords',
'e_url',
@ -56,6 +56,7 @@ class e107plugin
'e_featurebox',
'e_related',
'e_rss',
'e_user'
);

View File

@ -68,10 +68,21 @@ if (isset($_POST['delp']))
$qs = explode(".", e_QUERY);
$self_page =($qs[0] == 'id' && intval($qs[1]) == USERID);
include_once(e107::coreTemplatePath('user')); //correct way to load a core template.
$USER_TEMPLATE = e107::getCoreTemplate('user');
e107::scStyle($sc_style);
if(empty($USER_TEMPLATE)) // BC Fix for loading old templates.
{
echo "DEBUG: Using v1.x user template";
include_once(e107::coreTemplatePath('user')); //correct way to load a core template.
}
$TEMPLATE = str_replace('{USER_EMBED_USERPROFILE}','{USER_ADDONS}', $TEMPLATE); // BC Fix
$user_shortcodes = e107::getScBatch('user');
$user_shortcodes->wrapper('user/view');
@ -214,7 +225,7 @@ echo "<div class='nextprev'>&nbsp;".$tp->parseTemplate("{NEXTPREV={$parms}}")."<
function renderuser($uid, $mode = "verbose")
{
global $sql, $pref, $tp, $sc_style, $user_shortcodes;
global $EXTENDED_START, $EXTENDED_TABLE, $EXTENDED_END, $USER_SHORT_TEMPLATE, $USER_FULL_TEMPLATE;
global $EXTENDED_START, $EXTENDED_TABLE, $EXTENDED_END, $USER_SHORT_TEMPLATE, $USER_FULL_TEMPLATE, $USER_TEMPLATE;
global $user;
if(is_array($uid))
@ -233,7 +244,7 @@ function renderuser($uid, $mode = "verbose")
if($mode == 'verbose')
{
return $tp->parseTemplate($USER_FULL_TEMPLATE, TRUE, $user_shortcodes);
return $tp->parseTemplate($USER_TEMPLATE['view'], TRUE, $user_shortcodes);
}
else
{