Announcement

Collapse
No announcement yet.

prevent adsense ads from 1 forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • prevent adsense ads from 1 forum

    hi guys,

    is there any help i can get with stopping google ads from showing on one particular forum on my site?

    i heard it could be done with conditionals but i don't know which variables/conditional to use or which template to edit....

    please help.

    thanks.

  • #2
    I've been trying to figure this out myself. I've tried using the conditionals listed at http://www.vbulletin.org/forum/showthread.php?t=215032, but they don't work. I need for ads not to show up in one particular forum (and its child forums), but am having NO luck whatsoever. Can ANYONE help me with this? If so, please PM me. Yes, I've posted on vb.org about this, gotten a few answers, but haven't gotten the problem resolved.

    Comment


    • #3
      What is the code you're trying, in what templates?

      Comment


      • #4
        Originally posted by Zachery View Post
        What is the code you're trying, in what templates?
        Here's the code:

        Code:
        <if condition="!in_array($foruminfo['forumid'], array(32,48,34,44,41,49,53,58,61,79,82,81,80,46,52,36,40))"><script type="text/javascript"><!--
        google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
        /* Forum Leaderboard */
        google_ad_slot = "xxxxxxxxxxx";
        google_ad_width = 728;
        google_ad_height = 90;
        //-->
        </script>
        <script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script></if>
        I was just told that it's definitely $foruminfo['forumid, but it's not working. I'm running PHP 5.2.16. Could that have anything to do with it? I'm at a loss.

        ETA: I'm testing it in ad_navbar_below.

        Comment


        • #5
          I'm currently using a script from vb.org so that I can block ads from these certain forums. However, I've been having a lot of problems with server load, and the problem is due to the script I'm using for Adsense, which is why I need to figure out something different.

          Comment


          • #6
            Use $GLOBALS[forumid] instead of foruminfo

            Comment


            • #7
              Originally posted by Zachery View Post
              Use $GLOBALS[forumid] instead of foruminfo
              You are a GOD. THANK YOU!

              Does the code below look right to you? This is to not only block ads from the forum IDs listed, but also completely block ALL ads on ANY part of the forum from usergroups 1,2, etc?

              Code:
              <if condition="!in_array($GLOBALS['forumid'], array(32,48,34,44,41,49,53,58,61,79,82,81,80,46,52,36,40)) AND !is_member_of($vbulletin->userinfo, 1,2)">

              Comment


              • #8
                I guess, is it working?

                Comment


                • #9
                  I didn't try the code (with the combined conditionals). I will give it a whirl!

                  Comment


                  • #10
                    Trial and error is always best, do note that it has to match BOTH conditions to show the code between the if tags

                    Comment


                    • #11
                      Holy crap, it works! As I said, you're a GOD!!!!!!!!!!!

                      If I want to use this same size banner everywhere, can I just paste the same code in whichever ad template I want?

                      Comment


                      • #12
                        Originally posted by Zachery View Post
                        Trial and error is always best, do note that it has to match BOTH conditions to show the code between the if tags
                        What does that mean? (Before I get TOO excited, lol.) I don't know how to write conditionals.

                        Does this look right? I'm not sure about those two end-parentheses in the first one...

                        Code:
                        <if condition="!in_array($GLOBALS['forumid'], array(32,48,34,44,41,49,53,58,61,79,82,81,80,46,52,36,40))">
                        Code:
                        <if condition="!is_member_of($vbulletin->userinfo, 1,2)">
                        How would I close off two if tags? Just two </if> at the end of the code?

                        Comment


                        • #13
                          Just saying the best way to learn is trial and error.

                          Also that your conditional has to match both bits to show the code. You have two conditions that need to be met, both A and B must be true to show the code in your conditional.

                          <vb:if condition=" $a == A AND $b == B"> both A and B are true, show the code </vb:if>

                          Comment


                          • #14
                            Did you see my edited post above yours? I don't want to screw anything up, but I'm pretty stupid when it comes to this kind of stuff. And I definitely don't want to do anything to increase my server load. I'm having enough problems with that as it is (but hopefully I'm 'bout to fix it).

                            Comment


                            • #15
                              Conditionals should not ever increase server load drasticly, they ask php to do a yes/no check Maybe 1/1000th of a second of time to process.

                              You only want to show ads to users when they're not in those forums, and you do not want to show ads to guests and registered users?

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X