1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-25 07:21:03 +02:00

Closes #756 v2 standards for user profile.

This commit is contained in:
Cameron
2014-10-14 12:51:51 -07:00
parent ca3be14770
commit 69c69f14ae
6 changed files with 99 additions and 42 deletions

View File

@@ -60,7 +60,7 @@ class user_shortcodes extends e_shortcode
function sc_user_commentposts($parm)
{
return $this->var['user_comments'];
return "<a href='".e_HTTP."userposts.php?0.comments.".$this->var['user_id']."'>".$this->var['user_comments']."</a>";
}
@@ -110,7 +110,7 @@ class user_shortcodes extends e_shortcode
$commentposts = intval($sql->count("comments"));
e107::setRegistry('total_commentposts', $commentposts);
}
return ($commentposts > 0) ? round(($this->var['user_comments']/$commentposts) * 100, 2) : 0;
return ($commentposts > 0) ? "<a href='".e_HTTP."userposts.php?0.comments.".$this->var['user_id']."'>".round(($this->var['user_comments']/$commentposts) * 100, 2)."</a>" : 0;
}
@@ -505,11 +505,11 @@ class user_shortcodes extends e_shortcode
if (USERID == $this->var['user_id'])
{
//return "<a href='".$url->create('user/myprofile/edit')."'>".LAN_USER_38."</a>";
return "<a href='".e_HTTP."usersettings.php'>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
return "<a class='btn btn-default' href='".e_HTTP."usersettings.php'>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
}
else if(ADMIN && getperms("4") && !$this->var['user_admin'])
{
return "<a href='".$url->create('user/profile/edit', array('id' => $this->var['user_id'], 'name' => $this->var['user_name']))."'>".LAN_USER_39."</a>";
return "<a class='btn btn-default' href='".$url->create('user/profile/edit', array('id' => $this->var['user_id'], 'name' => $this->var['user_name']))."'>".LAN_USER_39."</a>";
}
}
@@ -519,6 +519,8 @@ class user_shortcodes extends e_shortcode
{
global $full_perms;
$sql = e107::getDb();
$tp = e107::getParser();
if (!$full_perms) return;
$url = e107::getUrl();
if(!$userjump = e107::getRegistry('userjump'))
@@ -539,13 +541,23 @@ class user_shortcodes extends e_shortcode
}
e107::setRegistry('userjump', $userjump);
}
if($parm == 'prev')
{
return isset($userjump['prev']['id']) ? "&lt;&lt; ".LAN_USER_40." [ <a href='".$url->create('user/profile/view', $userjump['prev'])."'>".$userjump['prev']['name']."</a> ]" : "&nbsp;";
$icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-left') : '&lt;&lt;';
return isset($userjump['prev']['id']) ? "<a class='e-tip' href='".$url->create('user/profile/view', $userjump['prev']) ."' title=\"".$userjump['prev']['name']."\">".$icon." ".LAN_USER_40."</a>\n" : "&nbsp;";
// return isset($userjump['prev']['id']) ? "&lt;&lt; ".LAN_USER_40." [ <a href='".$url->create('user/profile/view', $userjump['prev'])."'>".$userjump['prev']['name']."</a> ]" : "&nbsp;";
}
else
{
return isset($userjump['next']['id']) ? "[ <a href='".$url->create('user/profile/view', $userjump['next'])."'>".$userjump['next']['name']."</a> ] ".LAN_USER_41." &gt;&gt;" : "&nbsp;";
$icon = (deftrue('BOOTSTRAP')) ? $tp->toGlyph('chevron-right') : '&gt;&gt;';
return isset($userjump['next']['id']) ? "<a class='e-tip' href='".$url->create('user/profile/view', $userjump['next'])."' title=\"".$userjump['next']['name']."\">".LAN_USER_41." ".$icon."</a>\n" : "&nbsp;";
// return isset($userjump['next']['id']) ? "[ <a href='".$url->create('user/profile/view', $userjump['next'])."'>".$userjump['next']['name']."</a> ] ".LAN_USER_41." &gt;&gt;" : "&nbsp;";
}
}
@@ -763,7 +775,7 @@ class user_shortcodes extends e_shortcode
{
$template = e107::getCoreTemplate('user','addon');
$tp = e107::getParser();
$data = e107::getAddonConfig('e_user',null,'profile');
$data = e107::getAddonConfig('e_user',null,'profile',$this->var);
if(empty($data))
{
@@ -776,9 +788,11 @@ class user_shortcodes extends e_shortcode
{
foreach($val as $v)
{
$value = vartrue($v['url']) ? "<a href=\"".$v['url']."\">".$v['text']."</a>" : $v['text'];
$array = array(
'USER_ADDON_LABEL' => $v['label'],
'USER_ADDON_TEXT' => $v['text']
'USER_ADDON_TEXT' => $value
);
$text .= $tp->parseTemplate($template, true, $array);

View File

@@ -15,7 +15,11 @@
*/
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH")){ define("USER_WIDTH", "width:95%"); }
if (!defined("USER_WIDTH"))
{
$legacyWidth = deftrue('BOOTSTRAP') ? "" : "width:95%";
define("USER_WIDTH", $legacyWidth);
}
global $user_shortcodes, $pref, $user;
//Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page
@@ -174,38 +178,33 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
</tr>
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_67."</td>
<td style='width:70%' class='forumheader3'>{USER_CHATPOSTS} ( {USER_CHATPER}% )</td>
<td style='width:30%' class='forumheader3'>".LAN_USER_66."</td>
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
</tr>
{USER_ADDONS}
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_68."</td>
<td style='width:70%' class='forumheader3'>{USER_COMMENTPOSTS} ( {USER_COMMENTPER}% )</td>
</tr>
{USER_COMMENTS_LINK}
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_69."</td>
<td style='width:70%' class='forumheader3'>{USER_FORUMPOSTS} ( {USER_FORUMPER}% )</td>
</tr>
{USER_FORUM_LINK}
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_66."</td>
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
</tr>
{USER_ADDONS}
{USER_UPDATE_LINK}
<tr>
<td colspan='2' class='forumheader3 center'>
<table style='width:95%'>
<tr>
<td style='width:50%'>{USER_JUMP_LINK=prev}</td>
<td class='right' style='width:50%;'>{USER_JUMP_LINK=next}</td>
</tr>
</table>
</td>
</tr>
</table></div>
</table>
<ul class='pager user-view-nextprev'>
<li class='previous'>
{USER_JUMP_LINK=prev}
</li>
<li>
<!-- Back to List? -->
</li>
<li class='next'>
{USER_JUMP_LINK=next}
</li>
</ul>
</div>
{PROFILE_COMMENTS}
{PROFILE_COMMENT_FORM}
";
@@ -216,7 +215,9 @@ $USER_EMBED_USERPROFILE_TEMPLATE = "
<td class='forumheader3'>{USER_ADDON_TEXT}</td>
</tr>";
// Convert v1 to v2 Standards.
// Convert Templates from v1.x to v2.x Standards.
$USER_TEMPLATE['view'] = $USER_FULL_TEMPLATE;
$USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_START;
@@ -228,7 +229,7 @@ $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.
// Convert Shortcode Wrappers 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'];
@@ -236,7 +237,6 @@ $USER_WRAPPER['view']['USER_UPDATE_LINK'] = $sc_style['USER_UPDATE_LINK']['pre'
$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'];
$USER_WRAPPER['view']['USER_LOGINNAME'] = $sc_style['USER_LOGINNAME']['pre']."{---}";
?>