Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 05-07-2011, 11:22 PM
yfkamakazi yfkamakazi is offline
 
Join Date: Feb 2009
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default First Plugin - King of the Forum Modification

Hi everyone,

Sorry if this is the wrong forum, but I'm just looking for some suggestions on how to do this.

The idea is to use a hook in the plugin system to insert some HTML into the page when it's writing out a post for a specific user. The idea is:

PHP Code:
if ($userID == 42) {
    
$post .= '<div class="kotf-post"><img alt="King" src="images/king.png" /></div>';

Hopefully as simple as this.

The problem is, I know next to nothing about vBulletin, which hook to use (I was thinking 'postbit_display_start'), or what variable to use to insert it into. Am I supposed to search through the code for it?

Sorry for the open-ended question. Any advice you can give would be appreciated.
Reply With Quote
  #2  
Old 05-08-2011, 11:02 AM
vbresults vbresults is offline
 
Join Date: Apr 2009
Posts: 687
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by yfkamakazi View Post
Hi everyone,

Sorry if this is the wrong forum, but I'm just looking for some suggestions on how to do this.

The idea is to use a hook in the plugin system to insert some HTML into the page when it's writing out a post for a specific user. The idea is:

PHP Code:
if ($userID == 42) {
    
$post .= '<div class="kotf-post"><img alt="King" src="images/king.png" /></div>';

Hopefully as simple as this.

The problem is, I know next to nothing about vBulletin, which hook to use (I was thinking 'postbit_display_start'), or what variable to use to insert it into. Am I supposed to search through the code for it?

Sorry for the open-ended question. Any advice you can give would be appreciated.
A simpler way to accomplish what you are trying to do is to create a usergroup for this "King" and make him the only member of it.

As far as posts, just make a template edit in postbit (or postbit_legacy if that is what you are using) and wrap the appropriate part with:

Code:
<vb:if condition="is_member_of($bbuserinfo, KING_USERGROUP_ID)">
	<div class="kotf-post">
		<img alt="King" src="images/king.png" />
</vb:if>

<!-- template contents? -->

<vb:if condition="is_member_of($bbuserinfo, KING_USERGROUP_ID)">
	</div>
</vb:if>
Reply With Quote
  #3  
Old 05-09-2011, 04:05 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What lance says about the template edit is the correct way to do this, but I think adding a usergroup is overkill IMO, you can test for an individual userid...

In VB 4.x find the line in the postbit/postbit_legacy template:

Code:
{vb:raw post.message}
Right before add the code:
Code:
<vb:if condition="$bbuserinfo[userid] == 42">
<div class="kotf-post"><img alt="King" src="images/king.png" />
</vb:if>
right after it add the code:

Code:
<vb:if condition="$bbuserinfo[userid] == 42">
</div>
</vb:if>

If it's VB3 the code would be:

Find:
Code:
$post[message]
Right before add the code:
Code:
<if condition="$bbuserinfo[userid] == 42">
<div class="kotf-post"><img alt="King" src="images/king.png" />
</if>
and after:
Code:
<if condition="$bbuserinfo[userid] == 42">
</div>
</if>
Reply With Quote
  #4  
Old 05-12-2011, 05:27 PM
vbresults vbresults is offline
 
Join Date: Apr 2009
Posts: 687
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I considered a userid only, but the reason I suggested a usergroup is so a template edit doesn't need to be made every time there is a new king.
Reply With Quote
  #5  
Old 05-14-2011, 12:07 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lancerforhire View Post
I considered a userid only, but the reason I suggested a usergroup is so a template edit doesn't need to be made every time there is a new king.
I thought Kings were for life?
Reply With Quote
  #6  
Old 05-14-2011, 01:05 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
I thought Kings were for life?
LMAO
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03619 seconds
  • Memory Usage 2,220KB
  • 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
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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