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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2010, 05:56 AM
patt1293 patt1293 is offline
 
Join Date: Apr 2009
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default If statement depending if user is thread starter

What i am attempting to do is make it so i can change a bit of text depnding if the user in question was the original poster of the thread.

I am doing this in cyb advanced forum statistics i have edited it and want it to change if the post in latest posts was created by the user it should say {username} posted in {forumname} but if they are not the thread creator it should read {username} replied in {forumname}

I've gotten everything except the text change i was thinking an if statement should be used but for the life of me i cant figure out how to do it. Can anyone advise how to get this working?
Reply With Quote
  #2  
Old 11-27-2010, 09:34 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure I'm following - are any of the users you mention the logged in user (the user viewing the stats), or do you just want to compare the thread creator with the user who made the latest post in that thread?
Reply With Quote
  #3  
Old 11-28-2010, 02:47 AM
patt1293 patt1293 is offline
 
Join Date: Apr 2009
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes they are all logged in users, i just want it to check and if they are the thread creator it will say the posted in that forum otherwise it would say they replied in that forum
Reply With Quote
  #4  
Old 11-28-2010, 06:13 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm sorry I guess I didn't ask that right. In your first post, the first sentence refers to "the user in question" - which user is that exactly? Is it the "current" user who is viewing the stats, or the user who wrote the "latest post"? And is that the same as "the user" in the second sentence?

Sorry, maybe I'm being stupid or something.
Reply With Quote
  #5  
Old 11-28-2010, 06:43 PM
patt1293 patt1293 is offline
 
Join Date: Apr 2009
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It would be the user that wrote the latest post. all im trying to do is change "replied in" to "posted in" if that user is post number 1 in that preticular thread. hope thats worded better.
Reply With Quote
  #6  
Old 11-29-2010, 12:48 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, well hopefully I get it now. I think the problem is that when the plugin reads the latest post info from the db it doesn't get enough info to do what you want. But if you're willing to edit the plugin you can add it pretty easily. The plugin is "Cyb - Advanced Forum Statistics - FH", and you want to find this section (pretty near the top)

Code:
$get_stats_newposts = $vbulletin->db->query_read("
	SELECT thread.threadid, thread.title, thread.lastpost, 
                             thread.lastpostid, thread.forumid, thread.lastposter, 
                             thread.dateline, thread.views, thread.replycount, thread.visible, 
                             thread.open, thread.prefixid, user.username, user.userid, 
                             user.usergroupid, user.displaygroupid
	FROM " . TABLE_PREFIX . "thread AS thread
	LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter)

then add ", thread.postuserid" to the end of the list of fields, so it looks like this (you have to scroll right to see what I added):
Code:
$get_stats_newposts = $vbulletin->db->query_read("
	SELECT thread.threadid, thread.title, thread.lastpost, 
                             thread.lastpostid, thread.forumid, thread.lastposter, 
                             thread.dateline, thread.views, thread.replycount, thread.visible, 
                             thread.open, thread.prefixid, user.username, user.userid, 
                             user.usergroupid, user.displaygroupid, thread.postuserid	
                 FROM " . TABLE_PREFIX . "thread AS thread
	LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter)

Then, I assume you're editing the template cyb_topstats_newposts, you should be able to use this condition:
Code:
<if condition="$get_new_posts[postuserid] == $get_new_posts[userid]">
// user started thread
<else />
// user didn't start thread
</if>
Reply With Quote
  #7  
Old 11-29-2010, 03:01 AM
patt1293 patt1293 is offline
 
Join Date: Apr 2009
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, that worked like a charm it was actually in "Cyb - Advanced Forum Statistics - MN" but i bow down to you.
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 10:01 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.06480 seconds
  • Memory Usage 2,215KB
  • 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
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete