PDA

View Full Version : issue with blog statistics on forumhome statistics


peugeot405
08-03-2012, 02:00 PM
Hi all,

I seem to have an issue with issue with blog statistics on forumhome statistics on my custom skin.

I customized the template blog_forumhome_stats to match the statistics on forumhome. (see pic1)

140279

I replaced

<dl>
<dt>{vb:rawphrase blogs}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=bloglist">{vb:raw blogstats.total_blog_users}</a></dd>
<dt>{vb:rawphrase entries}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=list">{vb:raw blogstats.total_blog_entries}</a></dd>
<dt>{vb:rawphrase last_24_hours}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=list&amp;span=24">{vb:raw blogstats.entries_in_24hours}</a></dd>
</dl>

<vb:if condition="$latestentry['title']">
<p>
<vb:if condition="$show['blogtitle']">
{vb:rawphrase latest_blog_entry_by_x_in_blog_y, {vb:link entry, {vb:raw latestentry}, null, blogid, title}, {vb:raw latestentry.title}, {vb:link member, {vb:raw latestentry}, null, postedby_userid, postedby_username}, {vb:raw latestentry.postedby_username}, {vb:link blog, {vb:raw latestentry}, null, userid, blogtitle}, {vb:raw latestentry.blogtitle}}
<vb:else />
{vb:rawphrase latest_blog_entry_by_x, {vb:link entry, {vb:raw latestentry}, null, blogid, title}, {vb:raw latestentry.title}, {vb:link member, {vb:raw latestentry}, null, postedby_userid, postedby_username}, {vb:raw latestentry.postedby_username}}
</vb:if>
</p>
</vb:if>

with

<div id="wgo_stats" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/forum_stats.png" alt="{vb:rawphrase x_statistics, {vb:raw vboptions.bbtitle}}" /></h3>
<div class="wgo_new_blk1">
<dl>
<dt>{vb:rawphrase blogs}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=bloglist">{vb:raw blogstats.total_blog_users}</a></dd>
<dt>{vb:rawphrase entries}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=list">{vb:raw blogstats.total_blog_entries}</a></dd>
<dt>{vb:rawphrase last_24_hours}</dt>
<dd><a href="{vb:raw $vboptions.vbblog_url}{vb:if "$vboptions['vbblog_url']", '/', ''}blog.php?{vb:raw session.sessionurl}do=list&amp;span=24">{vb:raw blogstats.entries_in_24hours}</a></dd>
</dl>

<vb:if condition="$latestentry['title']">
<p>
<vb:if condition="$show['blogtitle']">
{vb:rawphrase latest_blog_entry_by_x_in_blog_y, {vb:link entry, {vb:raw latestentry}, null, blogid, title}, {vb:raw latestentry.title}, {vb:link member, {vb:raw latestentry}, null, postedby_userid, postedby_username}, {vb:raw latestentry.postedby_username}, {vb:link blog, {vb:raw latestentry}, null, userid, blogtitle}, {vb:raw latestentry.blogtitle}}
<vb:else />
{vb:rawphrase latest_blog_entry_by_x, {vb:link entry, {vb:raw latestentry}, null, blogid, title}, {vb:raw latestentry.title}, {vb:link member, {vb:raw latestentry}, null, postedby_userid, postedby_username}, {vb:raw latestentry.postedby_username}}
</vb:if>
</p>
</vb:if>
</div>
</div>

the problem is when i reimport the skin the template blog_forumhome_stats is reverted back to the original state and the statistic is messed up. (see pic2)

140280

Any idee why this is happening and how to avoid that?

I tried to alter the statistics on forumhome template as well but then i hav another issue. When blog is disabled in plugin manager or the user doesn't have view and post permission the statistics itself are gone, showing an empty block. (see pic3)

140281

what's going on coding on forumhome template:

<!-- what's going on box -->
<div id="wgo" class="collapse wgo_block block">
<h2 class="blockhead">{vb:rawphrase whats_going_on}</h2>
<div class="blockbody formcontrols floatcontainer">
{vb:raw template_hook.forumhome_wgo_pos1}
<vb:if condition="$show['loggedinusers']">
<!-- logged-in users -->
<div id="wgo_onlineusers" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/users_online.png" alt="{vb:rawphrase currently_active_users}" /></h3>
<div class="wgo_new_blk1">
<div class="wgo_infolist_blk">
<p>{vb:rawphrase there_are_x_y_online_link, {vb:raw totalonline}, {vb:raw session.sessionurl_q}} <span class="shade_wgo">{vb:rawphrase x_members_and_y_guests, {vb:raw numberregistered}, {vb:raw numberguest}}</span></p>
<p>{vb:rawphrase most_users_ever_online_was_x_y_at_z, {vb:raw recordusers}, {vb:raw recorddate}, {vb:raw recordtime}}</p>
<p><vb:if condition="$activeusers">
<ol class="commalist" id="wgo_onlineusers_list">
<vb:each from="activeusers" value="loggedin">
<li>{vb:stylevar dirmark}<a class="username" href="{vb:link member, {vb:raw loggedin}}">{vb:raw loggedin.musername}</a>{vb:raw loggedin.invisiblemark}{vb:raw loggedin.buddymark}{vb:raw loggedin.comma}</li>
</vb:each>
</ol>
</vb:if></p>
</div>

</div>
</div>
<!-- end logged-in users -->
</vb:if>
{vb:raw template_hook.forumhome_wgo_pos2}
<!-- Start Members Today -->
<vb:if condition="$show['wgo_members']">
<div id="wgo_wgo_members_users" class="wgo_subblock section collapse">
<h3 class="blocksubhead"><a href="{vb:raw wgo_members.url}"><img src="{vb:stylevar imgdir_misc}/forum_stats.png" alt="{vb:phrase wgo_members_alt_title}"/></a></h3>
<div class="wgo_new_blk1">
<!--<a class="collapse" id="collapse_wgo_members_list" href="{vb:raw relpath}#top"><img src="{vb:stylevar imgdir_button}/collapse_40b{vb:raw wgo_members.collapse}.png" alt="" title="{vb:rawphrase collapse_expand}" /></a>-->
<p>{vb:raw wgo_members.visitors}</p>
<vb:if condition="$vboptions['wgo_members_names']">
<vb:if condition="$wgo_members['totaltoday'] == 0">
{vb:phrase no_members_list}
<vb:else />
<ul class="commalist" id="wgo_wgo_members_list">
<vb:if condition="$wgo_members['template_hook']">
{vb:raw wgo_members.template_hook}
<vb:else />
<vb:each from="wgo_members_list" value="row">
<li>{vb:stylevar dirmark}<a class="username" href="{vb:link member, {vb:raw row}}" title="{vb:raw row.wrdate}">{vb:raw row.musername}</a>{vb:raw row.markinv}{vb:raw row.comma}</li>
</vb:each>
</vb:if>
</ul>
</vb:if>
<vb:else />
{vb:phrase member_list_disabled}
</vb:if>

</div>
</div>
</vb:if>
<!-- End Members Today -->
{vb:raw template_hook.forumhome_wgo_pos6}
<vb:if condition="$show['upcomingevents']">
<div id="wgo_events" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/event.png" alt="{vb:rawphrase todays_events}" /></h3>
<div class="wgo_new_blk1">
<ol>
{vb:raw upcomingevents}
</ol>
</div>
</div>
</vb:if>
{vb:raw template_hook.forumhome_wgo_pos3}
<vb:if condition="$show['birthdays']">
<!-- today's birthdays -->
<div id="wgo_birthdays" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/birthday.png" alt="{vb:rawphrase todays_birthdays}" /></h3>
<div class="wgo_new_blk1">
<ol class="commalist">
<vb:each from="birthdays" value="row">
<li><a href="{vb:link member, {vb:raw row}}">{vb:raw row.username}</a><vb:if condition="$row['age']"> ({vb:raw row.age})</vb:if>{vb:raw row.comma}</li>
</vb:each>
</ol>
</div>
</div>
<!-- end today's birthdays -->
</vb:if>
{vb:raw template_hook.forumhome_wgo_pos4}
<div id="wgo_stats" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/forum_stats.png" alt="{vb:rawphrase x_statistics, {vb:raw vboptions.bbtitle}}" /></h3>
<div class="wgo_new_blk1">
<dl>
<dt>{vb:rawphrase threads}</dt>
<dd>{vb:raw totalthreads}</dd>
<dt>{vb:rawphrase posts}</dt>
<dd>{vb:raw totalposts}</dd>
<dt>{vb:rawphrase members}</dt>
<dd>{vb:raw numbermembers}</dd>
<vb:if condition="$show['activemembers']">
<dt>{vb:rawphrase active_members}</dt>
<dd>{vb:raw activemembers}</dd>
</vb:if>
</dl>
<p>{vb:rawphrase welcome_to_our_newest_member_x, {vb:link member, {vb:raw newuserinfo}}, {vb:raw newuserinfo.username}}</p>

</div>
</div>
{vb:raw template_hook.forumhome_wgo_stats}

<div id="wgo_legend" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/legend.png" alt="{vb:rawphrase icon_legend}" /></h3>
<div class="wgo_new_blk1">
<dl class="icon_legends dvb_fh" id="icon_legends">
<dt><img src="{vb:stylevar imgdir_statusicon}/forum_new-16.png" alt="{vb:rawphrase new_posts_forum}" /></dt><dd>{vb:rawphrase new_posts_forum}</dd>
<dt><img src="{vb:stylevar imgdir_statusicon}/forum_old-16.png" alt="{vb:rawphrase no_new_posts_forum}" /></dt><dd>{vb:rawphrase no_new_posts_forum}</dd>
<vb:if condition="$vboptions['showlocks']"><dt><img src="{vb:stylevar imgdir_statusicon}/forum_lock-16.png" alt="{vb:rawphrase forum_is_closed_for_posting}" /></dt><dd>{vb:rawphrase forum_is_closed_for_posting}</dd></vb:if>
<dt><img src="{vb:stylevar imgdir_statusicon}/category-16.png" alt="{vb:rawphrase category_forum}" /></dt><dd>{vb:rawphrase category_forum}</dd>
<dt><img src="{vb:stylevar imgdir_statusicon}/forum_link-16.png" alt="{vb:rawphrase link_forum}" /></dt><dd>{vb:rawphrase link_forum}</dd>
{vb:raw template_hook.forumhome_icon_legend}
</dl>
</div>
</div>
{vb:raw template_hook.forumhome_wgo_pos5}
</div>
</div>
<!-- end what's going on box -->


I guess i would require some conditionals to hide it if no permission or disabled. The only thing I found is this php coding in plugin manager forum_home_complete:

if (is_array($vbulletin->blogstats) AND $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])
{
if ($latestentry = $vbulletin->blogstats['lastentry'])
{
require_once(DIR . '/includes/blog_functions_shared.php');
prepare_blog_category_permissions($vbulletin->userinfo);

if ($vbulletin->userinfo['userid'] OR $latestentry['guestcanview'])
{
$entrycats = explode(',', $latestentry['categories']);
if (array_intersect($vbulletin->userinfo['blogcategorypermissions']['cantview'], $entrycats) AND $vbulletin->userinfo['userid'] != $latestentry['userid'])
{
$latestentry = fetch_latest_entry($vbulletin->userinfo);
}
else if ($vbulletin->userinfo['userid'] == $latestentry['userid'] AND !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']))
{
$latestentry = fetch_latest_entry($vbulletin->userinfo);
}
else if (in_coventry($latestentry['userid']) AND $vbulletin->userinfo['userid'] != $latestentry['userid'])
{
$latestentry = fetch_latest_entry($vbulletin->userinfo);
}
}
else if ($latestentry = $vbulletin->blogstats['lastentry_guest'])
{
// oh do nothing, we just wanted the assignment ;)
}
}

if ($latestentry['userid'] != $latestentry['postedby_userid'] OR !empty($latestentry['blogtitle']))
{
$show['blogtitle'] = true;
if (empty($latestentry['blogtitle']))
{
$latestentry['blogtitle'] = $latestentry['username'];
}
}

$blogstats['total_blog_users'] = vb_number_format($vbulletin->blogstats['total_blog_users']);
$blogstats['total_blog_entries'] = vb_number_format($vbulletin->blogstats['total_blog_entries']);
$blogstats['entries_in_24hours'] = vb_number_format($vbulletin->blogstats['entries_in_24hours']);

$templater = vB_Template::create('blog_forumhome_stats');
$templater->register('blogstats', $blogstats);
$templater->register('latestentry', $latestentry);
$template_hook['forumhome_wgo_stats'] .= $templater->render();
}

Lynne
08-03-2012, 03:14 PM
Can we get a link to see the problem.

Also, make sure you only use an id once per page or you could have odd things go on.

peugeot405
08-03-2012, 03:23 PM
thanks for replying Lynne,

Can we get a link to see the problem.

Also, make sure you only use an id once per page or you could have odd things go on.

its a developper site on local host using xampp, not quite sure what the link would be. I can give you acces through a screen sharing program.

i affraid i don't understand what you mean with only use an id once per page. I'm still very novice when it comes to coding.

Lynne
08-03-2012, 06:04 PM
You posted that you changed the blogs stats to something that starts with this line:
<div id="wgo_stats" class="wgo_subblock section">

That id, wgo_stats, is already being used on the page (normally). So, you cannot have two areas on that page with that id.

peugeot405
08-03-2012, 06:59 PM
You posted that you changed the blogs stats to something that starts with this line:
<div id="wgo_stats" class="wgo_subblock section">

That id, wgo_stats, is already being used on the page (normally). So, you cannot have two areas on that page with that id.

ok so i changed wgo_stats and changed wgo_subblock as well and even every bit of coding i added, but the results is the seem.

I affraid i'm gonna need more information on this.

Would it be possible to change it on forumhome instead and add a conditional to hide it if blog is disabled or doesn't have permission to view own and others' blog

--------------- Added 1344030995 at 1344030995 ---------------

I reverted the blog_forumhome_stats template back to its original state and changed the following on forumhome template:

I changed:


{vb:raw template_hook.forumhome_wgo_stats}


with:

<div id="wgo_stats" class="wgo_subblock section">
<h3 class="blocksubhead"><img src="{vb:stylevar imgdir_misc}/forum_stats.png" alt="{vb:rawphrase x_statistics, {vb:raw vboptions.bbtitle}}" /></h3>
<div class="wgo_new_blk1">
{vb:raw template_hook.forumhome_wgo_stats}
</div>
</div>

that resolves the problem with the messud up blog stats when reimporting the skin.

Now i need to find the conditionals to hide that complete block when blog is disabled in product manager or user doesn't have permission to view own and others' blogs. (see pic3 in first post)

Any idee?