1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01: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']."{---}";
?>

View File

@ -1806,7 +1806,7 @@ class e107
* @param string $methodName [optional] (if different from 'config')
* @return none
*/
public function getAddonConfig($addonName, $className = '', $methodName='config' )
public function getAddonConfig($addonName, $className = '', $methodName='config', $param=null )
{
$new_addon = array();
$sql = e107::getDb(); // Might be used by older plugins.
@ -1828,7 +1828,7 @@ class e107
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
$class_name = $key.'_'.$className;
$array = self::callMethod($class_name, $methodName);
$array = self::callMethod($class_name, $methodName,$param);
if($array)
{

View File

@ -14,7 +14,7 @@ if (!defined('e107_INIT')) { exit; }
class chatbox_menu_user // plugin-folder + '_user'
{
function profile()
function profile($udata)
{
if(!$chatposts = e107::getRegistry('total_chatposts'))
@ -27,9 +27,11 @@ class chatbox_menu_user // plugin-folder + '_user'
e107::setRegistry('total_chatposts', $chatposts);
}
$perc = ($chatposts > 0) ? round(($udata['user_chats']/$chatposts) * 100, 2) : 0;
$var = array(
0 => array('label' => LAN_PLUGIN_CHATBOX_MENU_POST, 'text' => $chatposts)
0 => array('label' => LAN_PLUGIN_CHATBOX_MENU_POSTS, 'text' => $udata['user_chats']." ( ".$perc."% )")
);
return $var;

View File

@ -0,0 +1,41 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2014 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
if (!defined('e107_INIT')) { exit; }
// v2.x Standard
class forum_user // plugin-folder + '_user'
{
function profile($udata)
{
$sql = e107::getDb();
if(!$total_forumposts = e107::getRegistry('total_forumposts'))
{
$total_forumposts = intval($sql->count("forum_post"));
e107::setRegistry('total_forumposts', $total_forumposts);
}
$count = $sql->retrieve('user_extended', 'user_plugin_forum_posts', 'user_extended_id = '.$udata['user_id']);
$perc = ($total_forumposts > 0 && $count) ? round(($count / $total_forumposts) * 100, 2) : 0;
$url = ($count> 0) ? e_HTTP."userposts.php?0.forums.".$udata['user_id'] : null;
$var = array(
0 => array('label' => LAN_PLUGIN_FORUM_POSTS, 'text' => intval($count)." ( ".$perc."% )", 'url'=> $url)
);
return $var;
}
}

View File

@ -2,7 +2,7 @@
define("LAN_PLUGIN_FORUM_NAME", "Forum");
define("LAN_PLUGIN_FORUM_DESC", "This plugin is a fully featured forum system.");
define("LAN_PLUGIN_FORUM_POSTS", "Forum posts");
// Notify
// TODO - LAN cleanup (see e_notify)