1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Issue #988 - Comment stats were displaying on user profile even when comments were disabled.

This commit is contained in:
Cameron 2015-05-04 12:20:31 -07:00
parent 82eb5f6d7d
commit b5382c3792
2 changed files with 40 additions and 7 deletions

View File

@ -15,7 +15,24 @@ if (!defined('e107_INIT')) { exit; }
class user_shortcodes extends e_shortcode
{
private $commentsDisabled;
private $commentsEngine;
function __construct()
{
$pref = e107::getPref();
$this->commentsDisabled = vartrue($pref['comments_disabled']);
if(!empty($pref['comments_engine']))
{
$this->commentsEngine = $pref['comments_engine'];
}
}
function sc_total_chatposts($parm) {
$sql = e107::getDb();
if(!$chatposts = e107::getRegistry('total_chatposts'))
@ -60,6 +77,10 @@ class user_shortcodes extends e_shortcode
function sc_user_commentposts($parm)
{
if($this->commentsDisabled)
{
return false;
}
return "<a href='".e_HTTP."userposts.php?0.comments.".$this->var['user_id']."'>".$this->var['user_comments']."</a>";
}
@ -104,6 +125,12 @@ class user_shortcodes extends e_shortcode
function sc_user_commentper($parm)
{
if($this->commentsDisabled)
{
return false;
}
$sql = e107::getDb();
if(!$commentposts = e107::getRegistry('total_commentposts'))
{
@ -431,6 +458,10 @@ class user_shortcodes extends e_shortcode
function sc_user_comments_link($parm)
{
if($this->commentsDisabled)
{
return false;
}
return $this->var['user_comments'] ? "<a href='".e_HTTP."userposts.php?0.comments.".$this->var['user_id']."'>".LAN_USER_36."</a>" : "";
}

View File

@ -98,8 +98,11 @@ $sc_style['USER_RATING']['post'] = "</div></td></tr>";
$sc_style['USER_LOGINNAME']['pre'] = " : ";
$sc_style['USER_COMMENTPOSTS']['pre'] = "<tr><td style='width:30%' class='forumheader3'>".LAN_USER_68."</td><td style='width:70%' class='forumheader3'>";
$sc_style['USER_COMMENTPOSTS']['post'] = "";
$sc_style['USER_COMMENTPER']['pre'] = " ( ";
$sc_style['USER_COMMENTPER']['post'] = "% )</td></tr>";
//FIXME TODO - Remove IF statements from template.
if(isset($pref['photo_upload']) && $pref['photo_upload'])
@ -184,11 +187,8 @@ $USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
{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_COMMENTPOSTS}
{USER_COMMENTPER}
{USER_UPDATE_LINK}
@ -239,4 +239,6 @@ $USER_WRAPPER['view']['USER_RATING'] = $sc_style['USER_RATING']['pre']."{---}"
$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']."{---}";
$USER_WRAPPER['view']['USER_COMMENTPOSTS'] = $sc_style['USER_COMMENTPOSTS']['pre']."{---}";
$USER_WRAPPER['view']['USER_COMMENTPER'] = $sc_style['USER_COMMENTPER']['pre']."{---}".$sc_style['USER_COMMENTPER']['post'];
?>