Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 02-11-2010, 07:19 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I meant it should look like:

Code:
$count = $vbulletin->db->query_first("SELECT COUNT(*) AS count
                              FROM ".TABLE_PREFIX."thread 
                                WHERE postuserid = ".
                                    $vbulletin->userinfo['userid']."
                                    AND forumid IN(164, 165, 166)");
global $template_hook; 
$template_hook[profile_stats_threadcount] = $count['count'];
If that doesn't work I give up, someone else will have to help.
Reply With Quote
  #12  
Old 02-11-2010, 07:31 PM
bartek24m bartek24m is offline
 
Join Date: Nov 2005
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

unfortunately it doesn't work
ok, thank you for you time.
i hope that somene else answer.
Reply With Quote
  #13  
Old 02-11-2010, 07:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I hate to give up, so I actually went to the test site and tried this (which I should have done from the start and saved us both time).

I made this plugin and used the hook member_profileblock_fetch_unwrapped

Code:
if ($this->template_name == 'memberinfo_block_statistics')
{
   global $vbulletin;

   $count = $vbulletin->db->query_first("SELECT COUNT(*) AS count
                              FROM ".TABLE_PREFIX."thread 
                                WHERE postuserid = ".
                                    $vbulletin->userinfo['userid']."
                                    AND forumid IN(164, 165, 166)");
}
Then in the template I just used $count[count]. This avoids the global variable problem because the hook is in the same place as the template eval.

Sorry I wasted your time before, this time I *really* quit
Reply With Quote
  #14  
Old 02-11-2010, 08:31 PM
bartek24m bartek24m is offline
 
Join Date: Nov 2005
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are great man !
But i have still problem ...
It works perfect when I set specific number of postuserid like:

Code:
if ($this->template_name == 'memberinfo_block_statistics')
{
   global $vbulletin;

   $count = $vbulletin->db->query_first("SELECT COUNT(*) AS count
                              FROM thread 
                                WHERE postuserid = 1491
                                    AND forumid IN(164, 165, 166)");
}
and it doesn't when i use: ".$vbulletin->userinfo['userid'].":

Code:
if ($this->template_name == 'memberinfo_block_statistics')
{
   global $vbulletin;

   $count = $vbulletin->db->query_first("SELECT COUNT(*) AS count
                              FROM thread 
                                WHERE postuserid = ".$vbulletin->userinfo['userid']."
                                    AND forumid IN(164, 165, 166)");
}
instead of the number threads, the result of counting is always 0

is there any another way to replace
Quote:
".$vbulletin->userinfo['userid']."
in 3.7.4 version ?
Reply With Quote
  #15  
Old 02-11-2010, 09:03 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, I wish it were true, but in fact that problem is probably why it didn't work before. I should have thought of making sure that it was right.

Anyway, here we go again : I found this in class_profileblock.php (the same file where the hook is called):

Code:
$requirements = $this->registry->db->query_read_slave("
	SELECT blockid, requirement
	FROM " . TABLE_PREFIX . "profileblockprivacy
	WHERE userid = " . intval($this->profile->userinfo['userid']) . "
");
So maybe you can use intval($this->profile->userinfo['userid']).
Reply With Quote
  #16  
Old 02-11-2010, 09:40 PM
bartek24m bartek24m is offline
 
Join Date: Nov 2005
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

YEAH ! it works !
Exactly what i want !

Thank you again mate without your help i cant solve the problem!

Give via PM you paypal account.
Reply With Quote
  #17  
Old 06-20-2014, 02:00 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know this is an old thread Kevin but, I have edited this and edited this to get this to work on postbit_legacy with no luck.

I tried to get it to show (link) all threads by user in postbit_legacy but, only in select forum.

Any chance you could have a look at your code again and help me out?
I would really appreciate it.

Though, I have done a great deal of research before posting this request, I was not able to locate anything like this, so, if you or anyone that reads this know of an edit or addon that does what I am seeking please let me know...

Thank you for your time.... Tim
Reply With Quote
  #18  
Old 06-20-2014, 08:53 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, that's an old one. But I'm not sure what you're asking. The code above was only showing how many threads a user has in a certain set of forums. It sounds like you want links or something?
Reply With Quote
Благодарность от:
blind-eddie
  #19  
Old 06-20-2014, 11:01 AM
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Location: Michigan
Posts: 2,310
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am looking to edit this to show how many threads a user has in a certain set of forums, but not in a profile tab, I want it to show on the postbit_legacy, below total post.
I want to allow members to be able to click the link similar to what is show below, but in the postbit_legacy template, not in a profile tab.
I am only going to show the link in the same forum that I want it to show all the threads a user made in those forums.
I think I said that right....


Reply With Quote
  #20  
Old 06-20-2014, 11:24 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I guess you could do something like this, at hook postbit_display_complete:
Code:
$forumids=array(1, 2, 3);
$show['threadcount'] = in_array($post['forumid'], $forumids);
if ($show['threadcount'])
{
   $threadcount = $vbulletin->db->query_first("SELECT COUNT(*) AS count
                              FROM ".TABLE_PREFIX."thread 
                                WHERE postuserid = ". $post['userid']." 
                                    AND forumid IN (" . implode(',', $forumids) . ");
   if ($threadcount === FALSE)
      $show['threadcount'] = false;
   else
      $threadcount = $threadcount['count'];
}
and then in the postbit_legacy template, something like:
Code:
<if condition="$show['threadcount']">
Threads: $threadcount<br />
</if>
I see you said that you want it to be a link, but I don't know what you want it to link to. But you can probably change the html above to be a link.

I should also point out that adds a query for each postbit displayed. If you're concerned about that, you could add a column to the user table and adjust the count whenever a thread is created or deleted, but of course that takes more work and probably a few more plugins. You could also keep and array for users that you've already done the query for, so if for instance the same user posts 5 times on a page, you'd only be doing it once.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:43 AM.


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.02728 seconds
  • Memory Usage 2,265KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete