mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Added text_value parm to the USER_EXTENDED shortcode, this will only show the field name and value if there is a value, see forum viewtopic template for usage
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
//USAGE: {EXTENDED=<field_name>.[text|value|icon].<user_id>}
|
||||
//USAGE: {EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
|
||||
//EXAMPLE: {EXTENDED=user_gender.value.5} will show the value of the extended field user_gender for user #5
|
||||
include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
|
||||
$parms = explode(".", $parm);
|
||||
global $currentUser, $sql, $tp, $loop_uid, $e107, $imode;
|
||||
global $currentUser, $sql, $tp, $loop_uid, $e107, $imode, $sc_style;
|
||||
if(isset($loop_uid) && intval($loop_uid) == 0) { return ""; }
|
||||
$ueStruct = getcachedvars("user_extended_struct");
|
||||
if(!$ueStruct)
|
||||
{
|
||||
require_once(e_HANDLER."user_extended_class.php");
|
||||
$ueStruct = e107_user_extended::user_extended_getStruct();
|
||||
cachevars("user_extended_struct", $ueStruct);
|
||||
}
|
||||
$key = $parms[0].".".$parms[1];
|
||||
$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
|
||||
$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
|
||||
include_once(e_HANDLER."user_extended_class.php");
|
||||
$ueStruct = e107_user_extended::user_extended_getStruct();
|
||||
|
||||
$uid = intval($parms[2]);
|
||||
if($uid == 0)
|
||||
@@ -45,6 +43,20 @@ if (
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if($parms[1] == 'text_value')
|
||||
{
|
||||
$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
|
||||
if($_value)
|
||||
{
|
||||
$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
|
||||
$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
|
||||
$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
|
||||
$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : "");
|
||||
return $__pre.$_text.$_mid.$_value.$__post;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parms[1] == 'text')
|
||||
{
|
||||
$text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text'];
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_viewtopic_template.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:19 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2006-12-16 14:13:28 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -30,7 +30,8 @@ $sc_style['LEVEL']['post'] = "</div>";
|
||||
$sc_style['ANON_IP']['pre'] = "<br /><div class='smalltext'>";
|
||||
$sc_style['ANON_IP']['post'] = "</div>";
|
||||
|
||||
$location_tpl = (array_key_exists('user_location', $currentUser) ? "{USER_EXTENDED=location.text}: {USER_EXTENDED=location.value}" : "");
|
||||
$sc_style['USER_EXTENDED']['location.text_value']['mid'] = ": ";
|
||||
$sc_style['USER_EXTENDED']['location.text_value']['post'] = "<br />";
|
||||
|
||||
$FORUMSTART = "<a id='top'></a><div style='text-align:center'>
|
||||
<div class='spacer'>
|
||||
@@ -118,7 +119,7 @@ $FORUMTHREADSTYLE = "<tr>
|
||||
{LEVEL=pic}
|
||||
{LEVEL=userid}
|
||||
{JOINED}
|
||||
{$location_tpl}<br />
|
||||
{USER_EXTENDED=location.text_value}
|
||||
{POSTS}
|
||||
</div>
|
||||
</td>
|
||||
@@ -204,7 +205,7 @@ $FORUMREPLYSTYLE = "<tr>
|
||||
{LEVEL=pic}
|
||||
{LEVEL=userid}
|
||||
{JOINED}
|
||||
{$location_tpl}<br />
|
||||
{USER_EXTENDED=location.text_value}
|
||||
{POSTS}
|
||||
</div>
|
||||
</td>
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/e107v4a/forum_template.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:47 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2006-12-16 14:13:28 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -21,7 +21,9 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$sc_style['ANON_IP']['pre'] = "<br /><span class='smalltext'>";
|
||||
$sc_style['ANON_IP']['post'] = "</span>";
|
||||
$location_tpl = (array_key_exists('user_location', $currentUser) ? "{USER_EXTENDED=location.text}: {USER_EXTENDED=location.value}" : "");
|
||||
|
||||
$sc_style['USER_EXTENDED']['location.text_value']['mid'] = ": ";
|
||||
$sc_style['USER_EXTENDED']['location.text_value']['post'] = "<br />";
|
||||
|
||||
$FORUMSTART = "
|
||||
<table style='width:100%' class='nforumholder' cellpadding='0' cellspacing='0'>
|
||||
@@ -70,7 +72,7 @@ $FORUMTHREADSTYLE = "
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<div class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{$location_tpl}<br />\n{POSTS}\n</div>\n</td>
|
||||
<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<div class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{USER_EXTENDED=location.text_value}\n{POSTS}\n</div>\n</td>
|
||||
<td class='nforumthread' style='vertical-align:top'>{POLL}\n{POST}\n{SIGNATURE}\n</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -102,7 +104,7 @@ $FORUMREPLYSTYLE = "
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{$location_tpl}<br />\n{POSTS}\n</span>\n</td>
|
||||
<td class='nforumthread' style='vertical-align:top'>\n{AVATAR}\n<span class='smalltext'>\n{CUSTOMTITLE}\n{LEVEL}\n{MEMBERID}\n{JOINED}\n{USER_EXTENDED=location.text_value}\n{POSTS}\n</span>\n</td>
|
||||
<td class='nforumthread' style='vertical-align:top'>\n{POST}\n{SIGNATURE}\n</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user