Advertisement:

Author Topic: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc  (Read 1685 times)

jimzubemo

  • Newbie
  • *
  • Posts: 29
As per Google Adsense Ad placement policy, it states that -
"Publishers are not permitted to place ads on any non-content based pages like thank you, error, log in, or exit pages. "
More info here: https://support.google.com/adsense/answer/1346295?hl=en#Ads_on_non_content_pages

Bender theme and Bender_Black Theme has "Ads Management" in Theme Settings, using which we can place Google Adsense on various regions such as Header, Search Results Page Top & Bottom, Sidebar etc. This provision is very convenient instead of placing ads manually in php files.

But ads (placed in Header) also apears on Login, Register and also on error pages, which may cause issues with Google Adsense later.

I have the following code in header.php

<?php if( osc_get_preference('header-728x90', 'osclasswizards_theme') !=""){ ?>
<div class="ads_header ads-headers"> <?php echo osc_get_preference('header-728x90', 'osclasswizards_theme'); ?> </div>
<?php } ?>

and

user-login.php includes the header.php
osc_current_web_theme_path('header.php');

I want to continue to use the default ADs Management feature. But how to disable Ads from appearing in login, register pages etc.?

We can disable content from displaying using CSS code. But in this case, I can't think of selectively disabling depending on page type

Any help is appreciated.
« Last Edit: August 26, 2017, 09:22:02 pm by jimzubemo »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Search for osclass helpers that tell you if the page is for login etc.
Then, put your adsense code into an if statement.

Ex.

<?php if( !osc_is_login_form() ) { ?>

Ad  code

<?php } ?>

Helpers for location

osc_is_ad_page() - Get if user is on ad page
osc_is_search_page() - Get if user is on search page
osc_is_static_page() - Get if user is on a static page
osc_is_home_page() - Get if user is on homepage
osc_is_user_dashboard() - Get if user is on user dashboard
osc_is_publish_page() - Get if user is on publish page
osc_is_login_form() - Get if user is on login form
osc_get_osclass_location() - Get location
osc_get_osclass_section() - Get section
« Last Edit: August 25, 2017, 10:42:29 pm by marius-ciclistu »

jimzubemo

  • Newbie
  • *
  • Posts: 29
Search for osclass helpers that tell you if the page is for login etc.
Then, put your adsense code into an if statement.

Ex.

<?php if( !osc_is_login_form() ) { ?>

Ad  code

<?php } ?>

Helpers for location

osc_is_ad_page() - Get if user is on ad page
osc_is_search_page() - Get if user is on search page
osc_is_static_page() - Get if user is on a static page
osc_is_home_page() - Get if user is on homepage
osc_is_user_dashboard() - Get if user is on user dashboard
osc_is_publish_page() - Get if user is on publish page
osc_is_login_form() - Get if user is on login form
osc_get_osclass_location() - Get location
osc_get_osclass_section() - Get section


Successfully tried for login page.
Will apply on other pages as well.

Thank you!

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
You can put || in that if and put another contition and so on, meaning OR.

And you can put solved in the topic's title.
« Last Edit: August 25, 2017, 11:49:47 pm by marius-ciclistu »

Aficionado

  • Guest
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.


jimzubemo

  • Newbie
  • *
  • Posts: 29
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.

Not that established  :D
Don't want to risk getting banned by Google Adsense. Things may look alright but suddenly they may ban.  :o

Anyway, thanks for the help and suggestions.

Aficionado

  • Guest
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.

Not that established  :D
Don't want to risk getting banned by Google Adsense. Things may look alright but suddenly they may ban.  :o

Anyway, thanks for the help and suggestions.

What i mean is, for example: If you put ads in your search results AND your search results are EMPTY, then you MIGHT have a problem. If you have plenty of results ( a busy site with lots of ads) then probably you are ok.

Google doesn't like much Classified ads sites, for one reason: Thin (little) content. But it is the nature of such site. So try not to have pages than have .... only google ads and no content (other than the menus etc).

good luck !

mrtsoftware

  • Sr. Member
  • ****
  • Posts: 343
Untill now, I did not read and heard about GOOGLE was banned an ads website just due tue having login, register etc. page.
Google looks your content / number of visitors / site traffic and adsense RPM values...

No worry if you have a site which has good organic traffic.

muratbora

  • Full Member
  • ***
  • Posts: 234
jimzubemo@
I could not manage to block showing adsense ads on /user/login, user/register, contact  pages...
Can you please help me how to implement this?

Today GOOGLE sent me violation report regaring showing ads on login, register, contact pages...

jimzubemo

  • Newbie
  • *
  • Posts: 29
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.

Aficionado

  • Guest
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.

Not sure if this

Code: [Select]
<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>
is correct and working. The register part.
« Last Edit: October 03, 2018, 12:50:34 am by Aficionado »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.

Not sure if this

Code: [Select]
<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>
is correct and working. The register part.

Hello,

From the documentation, this is what the osc_register_account_url() function does:

osc_register_account_url() - Create automatically the url to register an account

I believe it can be replaced with Params::getParam('page') == 'register'.

Regards-

muratbora

  • Full Member
  • ***
  • Posts: 234
I really could not manage to disable adsense ads for user-login.php

I use only adsense auto ads code placed into header.php, that's way it is showing ads wherever google wants.

Here osclasswizards theme user-login.php codes, please can you customize code where it disable adsense ads indicating?

<?php
    //

    // meta tag robots
    osc_add_hook('header','osclasswizards_nofollow_construct');

    osclasswizards_add_body_class('login');
   
    osc_current_web_theme_path('header.php');
?>

<div class="row">
  <div class="col-lg-4 col-md-7" id="user-login">
    <div class="wraps">
      <div class="title">
        <h1>
          <?php _e('Please Login', OSCLASSWIZARDS_THEME_FOLDER); ?>
        </h1>
      </div>
      <form action="<?php echo osc_base_url(true); ?>" method="post" >
        <input type="hidden" name="page" value="login" />
        <input type="hidden" name="action" value="login_post" />
        <div class="form-group">
          <label class="control-label" for="email">
            <?php _e('E-mail', OSCLASSWIZARDS_THEME_FOLDER); ?> <sup>*</sup>
          </label>
          <div class="controls">
            <?php UserForm::email_login_text(); ?>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label" for="password">
            <?php _e('Password', OSCLASSWIZARDS_THEME_FOLDER); ?> <sup>*</sup>
          </label>
          <div class="controls">
            <?php UserForm::password_login_text(); ?>
          </div>
        </div>
        <div class="form-group">
          <div class="controls checkbox">
            <?php UserForm::rememberme_login_checkbox();?>
            <label for="remember">
              <?php _e('Remember me', OSCLASSWIZARDS_THEME_FOLDER); ?>
            </label>
          </div>
        </div>
        <div class="form-group">
          <div class="controls">
        <p><?php osc_run_hook("anr_captcha_form_field"); ?></p>
            <button type="submit" class="btn btn-success">
            <?php _e("Log in", OSCLASSWIZARDS_THEME_FOLDER);?>
            </button>
          </div>
        </div>
        <div class="actions"> <a href="<?php echo osc_register_account_url(); ?>">
          <?php _e("Register for a free account", OSCLASSWIZARDS_THEME_FOLDER); ?>
          </a><br />
          <a href="<?php echo osc_recover_user_password_url(); ?>">
          <?php _e("Forgot password?", OSCLASSWIZARDS_THEME_FOLDER); ?>
          </a> </div>
      </form>
    </div>
  </div>
</div>
<?php osc_current_web_theme_path('footer.php') ; ?>