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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2013, 07:18 PM
Gripi Gripi is offline
 
Join Date: Jul 2009
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Plugin code to show for specific usergroup only

Hello..

how to change this code to work inside the plugin:

show to specific group only:

PHP Code:
<if condition="is_member_of($vbulletin->userinfo, 1, 2, 3)"></if> 
i already try:

PHP Code:
if (is_member_of($vbulletin->userinfo123)) {


but no luck.

thanks
Reply With Quote
  #2  
Old 06-14-2013, 07:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That should work. Which hook are you using? You may need to add
Code:
global $vbulletin;

to the beginning of your plugin code.
Reply With Quote
  #3  
Old 06-15-2013, 04:38 AM
Gripi Gripi is offline
 
Join Date: Jul 2009
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello.. not working..

i use it in forumhome_complete
Reply With Quote
  #4  
Old 06-15-2013, 07:08 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm...I don't see why that wouldn't work, and you don't need a "global" statement there. If you're using it to decide to add something to the FORUMHOME template, are you registering your variable to the template?
Reply With Quote
  #5  
Old 06-15-2013, 07:33 AM
Gripi Gripi is offline
 
Join Date: Jul 2009
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I installed one mod from vb.org, and i saw the plugin named "Stat render", using forumhome_complete, i just want to show the stat for admin only, here is the complete code:

PHP Code:
if (is_member_of($bbuserinfo6)) {

                if ((
$vbulletin->options['glowhostspamomatic_stat_show_denied'] == 1) || ($vbulletin->options['glowhostspamomatic_stat_show_banned'] == 1)) { 
                    
//$vbulletin-> 

                    
$stats $vbulletin->db->query_first("SELECT * FROM " TABLE_PREFIX "glowhostspamomatic_stats"); 

                    
//echo '<pre>'; 
                    //print_r($vbulletin->stylevars['imgdir_misc']); 
                    //echo '</pre>'; 

                    
$template_hook[forumhome_wgo_pos2] .= 

                         <div class="wgo_subblock section"> 
                           <h3 class="blocksubhead"><img src="'
.$vbulletin->stylevars['imgdir_misc']['imagedir'].'/forum_stats.png" alt="Spam-O-Matic Statistics" />'

                    if (
$vbulletin->options['glowhostspamomatic_stat_show_link'] == 1) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<a href="https://vborg.vbsupport.ru/showthread.php?t=248042" target="_blank">Spam-O-Matic Statistics</a>'
                    } else { 
                        
$template_hook[forumhome_wgo_pos2] .= 'Spam-O-Matic Statistics'
                    } 


                    
$template_hook[forumhome_wgo_pos2] .= '       </h3> 
                           <div>'


                    if ((
$vbulletin->options['glowhostspamomatic_stat_show_denied'] == 1) && ($stats['denied'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['denied'].' Spammer'.(($stats['denied'] > 1)?'s':'').' Denied Registration</p>'
                    } 

                    if ((
$vbulletin->options['glowhostspamomatic_stat_show_banned'] == 1) && ($stats['banned'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['banned'].' Spammer'.(($stats['banned'] > 1)?'s':'').' Permanently Banned</p>'
                    } 

                    if ((
$vbulletin->options['glowhostspamomatic_stat_show_s_sfs'] == 1) && ($stats['s_sfs'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['s_sfs'].' Spammer'.(($stats['s_sfs'] > 1)?'s':'').' submitted to StopForumSpam</p>';
                    } 

                    if ((
$vbulletin->options['glowhostspamomatic_stat_show_s_akismet'] == 1) && ($stats['s_akismet'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['s_akismet'].' Spammer'.(($stats['s_akismet'] > 1)?'s':'').' submitted to Akismet</p>'
                    } 

                    if ((
$vbulletin->options['glowhostspamomatic_stat_show_mod'] == 1) && ($stats['moderated'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['moderated'].' Spammy Post'.(($stats['moderated'] > 1)?'s':'').' Automatically Moderated</p>'
                    } 

                     if ((
$vbulletin->options['glowhostspamomatic_stat_show_removed'] == 1) && ($stats['removed'] > 0)) { 
                        
$template_hook[forumhome_wgo_pos2] .= '<p>'.$stats['removed'].' Spammy Post'.(($stats['removed'] > 1)?'s':'').' Removed</p>'
                    } 

                    
$template_hook[forumhome_wgo_pos2] .= '       </div> 
                       </div> 
                    '


                } 

            } 
but the code above hide the stat to all usergroup.
Reply With Quote
  #6  
Old 06-15-2013, 07:45 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, I think you should use:
Code:
if (is_member_of($vbulletin->userinfo, 6)) {
if you haven't tried that already. $bbuserinfo is a shortcut that only works in a template.
Reply With Quote
  #7  
Old 06-15-2013, 07:26 PM
Gripi Gripi is offline
 
Join Date: Jul 2009
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello..

Thank you.. working now
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 12:00 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.08134 seconds
  • Memory Usage 2,255KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (3)bbcode_php
  • (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_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