View Single Post
  #25  
Old 06-11-2002, 05:56 PM
James Cridland James Cridland is offline
 
Join Date: Nov 2001
Location: London, UK
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's very easy to modify, this hack.

For a "ad banner for unreg / text ad for registered / no ad for donated" then...
PHP Code:
    if ($bbuserinfo['userid']<"1") {
    
$adcode="your ad banner for unregistered users";
    }
    elseif (
$bbuserinfo['usergroupid']=="13") {
    
$adcode="(no ad banner)";
    }
    else {
    
$adcode="your text ad";
    } 
You need to know the category number for your user group of people who have donated - I've used 13 here. Skim further up the thread to find out how this is done.

I'm running a much more complicated version of this hack, which rotates ad banners. One day I might document that, if anyone's interested.


Quote:
Originally posted by danrak
This may be simple but I'm still learning PHP. Anyway, is there a way to add multiable groups? For example, I would prerfer my mentors and moderators not to see the ads since they help out.
PHP is really easy(ish).

$bbuserinfo['userid'] is the user number, and will always be "0" (or not exist) if the user isn't registered.

$bbuserinfo['usergroupid'] is the group that the user is in.

if ($bbuserinfo['usergroupid']=="5") {echo "Hello world";} will do the thing in curly brackets - print "Hello world" in this example - if the usergroupid = 5.

if ($bbuserinfo['usergroupid']!="5") {echo "Hello world";} will do the thing in curly brackets if the usergroupid is NOT 5.

if ($bbuserinfo['usergroupid']>="5") {echo "Hello world";} will do the thing in curly brackets if the usergroupid is 5 OR LARGER.

and if ($bbuserinfo['usergroupid']=="5") {echo "Hello world";}else {echo "Goodbye world";} will only print "Hello world" if the usergroupid is 5 (as above), but will print "Goodbye world" if the usergroupid is anything else.

Does that help work out how you'd show one thing to one user group and another thing to another? Hope so.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01287 seconds
  • Memory Usage 1,776KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete