vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Member Profile Hook Location (https://vborg.vbsupport.ru/showthread.php?t=201676)

dfc005 01-13-2009 09:35 PM

Member Profile Hook Location
 
Hey guys,

I've written a little plugin to calculate some stats about a users posting. I'd like to add these new stats to the "Statistics" tab on the members profile page. So, added the variables to the 'memberinfo_block_statistics' template but can't seem to get it to work for the life of me.

Any idea what hook I need to use for that to work? Have tried a bunch including 'member_complete' and 'profile_complete' but non seem to work.

My plugin does the right calculations as I can print out the stats from within the plugin, they just never seem to show up in my templates.

Cheers.

Lynne 01-13-2009 10:37 PM

How about member_build_blocks_start? Take a look at the member.php page and see all the hooks in there, don't just randomly pick one from the drop-down (profile hooks are from a complete different page).

dfc005 01-13-2009 10:50 PM

Hmmm, OK. The hooks on the member.php page are....

member_start
member_start_fetch_user
member_execute_start
member_build_blocks_start
member_complete

Tried all of those and no dice. As I said, I've added the variables to be outputted into the 'memberinfo_block_statistics' template. It has a template hook called 'profile_stats_first' right at the start of it which was why I was using the profile hooks.

Bellardia 01-13-2009 11:30 PM

Are you sure it's the hooks that aren't working and not the code?

dfc005 01-13-2009 11:34 PM

Righto, I put an echo in the plugin to print out the new stat. Using member_build_blocks_start, I see the stat at the top of the page but not in the Statistics tab like it should be.

So, I assume the plugin is being executed but the code I have in the template is not working then?

Here's the code quickly....

Plugin
PHP Code:

    $stats$db->query_read("
    SELECT round(sum(replycount)/count(*),2) AS average, round(sum(views)/count(*),2) AS strikerate 
    FROM `thread` 
    WHERE `forumid` != 384 
    AND `forumid` != 20 
    AND `forumid` != 375 
    AND `postuserid` = 
$userinfo[userid]
"
);

$stat $db->fetch_array($stats);
$thread_average $stat['average'];
$thread_strikerate $stat['strikerate'];

echo 
$thread_average

Template
PHP Code:

    <li><span class="shade">$vbphrase[total_posts]:</span$prepared[posts]</li>
    <
li><span class="shade">$vbphrase[posts_per_day]:</span$prepared[postsperday]</li>
    <
li><span class="shade">Thread Average (replies):</span$thread_average</li>
    <
li><span class="shade">Thread Strike Rate (views):</span$thread_strikerate</li

Am I missing something?

Lynne 01-14-2009 02:32 AM

In your template, try calling it $GLOBALS[thread_average] instead.

dfc005 01-14-2009 02:41 AM

Bingo! That works wonderfully now. Cheers Lynne!


All times are GMT. The time now is 12:19 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03270 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete