vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   First Plugin - King of the Forum Modification (https://vborg.vbsupport.ru/showthread.php?t=263306)

yfkamakazi 05-07-2011 11:22 PM

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.

vbresults 05-08-2011 11:02 AM

Quote:

Originally Posted by yfkamakazi (Post 2193154)
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>


BirdOPrey5 05-09-2011 04:05 PM

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>


vbresults 05-12-2011 05:27 PM

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.

BirdOPrey5 05-14-2011 12:07 AM

Quote:

Originally Posted by Lancerforhire (Post 2194850)
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? :p

Boofo 05-14-2011 01:05 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2195395)
I thought Kings were for life? :p

LMAO


All times are GMT. The time now is 01:52 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.01202 seconds
  • Memory Usage 1,735KB
  • 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
  • (7)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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