vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Stuck on php code for the postbit? lol (https://vborg.vbsupport.ru/showthread.php?t=270955)

HMBeaty 09-26-2011 08:24 PM

Stuck on php code for the postbit? lol
 
Ok, I'm a little confused as to why this isn't working. The code works, however, when I try adding in the option so only certain usergroups can('t) view the content, it doesn't work, nothing shows up. :p

Here's the current code I'm using:
Hook location: postbit_display_start
PHP Code:

$noadsense explode(','$vbulletin->options['usml_google_adsense_usergroups']);

if (
$this->registry->options['usml_google_adsense_enable'] && is_member_of($vbulletin->userinfo$noadsense))
{
    if (
$this->registry->options['usml_google_adsense_firstpost'] && $post['isfirstshown'])
    {
        
$template_hook['postbit_end'] .= '
        <li class="firstpost_advert_container">
            <div class="firstpost_advert">
                '
.$this->registry->options[usml_google_adsense_firstpostadcode].'
            </div>
        </li>'
;
    }


Obviously it's something silly I'm looking over (again :o), but what is the problem that
PHP Code:

is_member_of($vbulletin->userinfo$noadsense

doesn't work as it should? :confused:

Boofo 09-26-2011 09:19 PM

Try:

Code:

is_member_of($this->userinfo, $noadsense)

AND

Code:

$noadsense = explode(',', $this->registry->options['usml_google_adsense_usergroups']);

HMBeaty 09-26-2011 09:28 PM

Quote:

Originally Posted by Boofo (Post 2250367)
Try:

Code:

is_member_of($this->userinfo, $noadsense)
AND

Code:

$noadsense = explode(',', $this->registry->options['usml_google_adsense_usergroups']);

Still nothing lol

kh99 09-26-2011 09:30 PM

Maybe try $this->registry->userinfo.

The list of usergroups in the option is the groups that *will* see the ad, right?

HMBeaty 09-26-2011 09:33 PM

Quote:

Originally Posted by kh99 (Post 2250374)
Maybe try $this->registry->userinfo.

The list of usergroups in the option is the groups that *will* see the ad, right?

That didn't work either lol, and yes (for now anyway).

Boofo 09-26-2011 09:34 PM

Try using your old code and making $vbulletin global. Did you try using the postbit_display_complete hook instead?

HMBeaty 09-26-2011 09:40 PM

Quote:

Originally Posted by Boofo (Post 2250377)
Try using your old code and making $vbulletin global. Did you try using the postbit_display_complete hook instead?

Ok, did that and now it works :D (still with postbit_display_start). Thanks guys!

Boofo 09-26-2011 11:43 PM

I was going to suggest making $vbulletin global the first time around but I usually try avoiding doing that in the postbit hooks if at all possible.

HMBeaty 09-26-2011 11:45 PM

Quote:

Originally Posted by Boofo (Post 2250411)
but I usually try avoiding doing that in the postbit hooks if at all possible.

Why is that? Or is that just personal preference?

Boofo 09-26-2011 11:54 PM

They took out the global $vbulletin for the postbit a while back and I just got used to using to not having to make it global, I guess.


All times are GMT. The time now is 10:39 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.10100 seconds
  • Memory Usage 1,745KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete