vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - Google Adsense share for each publishers in CMS Article (https://vborg.vbsupport.ru/showthread.php?t=270617)

killer_t 09-19-2011 10:00 PM

Google Adsense share for each publishers in CMS Article
 
1 Attachment(s)
This mod is a combination between some mod that I found in this forum, with the help of some people, especially from Dead Eddie.

What is it? It enables publishers to place his advertising in their articles.

Why? because it would encourage them to write better articles, with each click to their article, they will earn $.

Ok let's start!

1- You need to create (only number) a extra field in user profile via admin panel.

Code:

admincp > User Profile Fields > Add New User Profile Field

Select - Single Line Text Box
Title - Google Adsense
Description - Put Your Adsense Code here Only 16 Numbers.
Max length of allowed user input - 16
Field Length - 25
Field Required - No
Field Editable by User - Yes
Private Field - Yes
Field Searchable on Members List - No       
Show on Members List - No
Regular Expression -  ^[0-9]{16}$
Display Page - Edit Profile

2 - Write down the name of the field ( my is field10 ) and change all fieldx in below code with your field name.

3 - Edit the vbcms_content_article_page template, and insert this code where you want to display advertising:

Code:

<!-- CMS-ADV-SHARE-START -->
<vb:if condition="$showuser">
<vb:if condition="$fieldx">
<div class="adv">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-{vb:raw fieldx}";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "flash_image";
google_ad_channel = "YOUR-ADSENSE-CHANNEL";
google_ui_features = "rc:0";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<vb:else />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-YOUR-ADSENSE-CODE";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "flash_image";
google_ad_channel = "YOUR-ADSENSE-CHANNEL";
google_ui_features = "rc:0";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</div>
</vb:if></vb:if>
<!-- CMS-ADV-SHARE-END -->


You can edit all size and type of google_ad code.

4 - Edit vbcms_article_populate_end plugin ( Admincp > Plugins & Product > Plugin Manager), and add this code at the end:

PHP Code:

if(self::VIEW_PAGE == $viewtype){
$field vB::$vbulletin->db->query_first('SELECT fieldx FROM ' TABLE_PREFIX ' userfield AS userfield WHERE userid = ' $view->authorid);

$view->fieldx $field['fieldx'];


The End.
Now you (and your publishers) can add Google Adsense Code in profile field.
You can Add (max3 for Google adsense terms) Advertising module in the vbcms_content_article_page.



Google adsense terms not allowed to use different adsense code in same page. So please careful if you have different Adsense code in your header/footer.

UPDATE 1 : Goes to official.
UPDATE 2 : Added function than remove advertisement when the author's name it is made ​​private (service communications),
UPDATE 3 : Added function than add YOUR advertisement when the author's field are empty.

killer_t 09-26-2011 07:19 PM

First post reserved.

barakuda 10-11-2011 09:12 PM

question ;
i can't find this "vbcms_article_populate_end"?in where?

nightfish 10-22-2012 07:19 PM

same here... cannot find vbcms_article_populate_end

dizzynation 01-22-2013 06:42 PM

This is kind of genius, only question I have is - What are the steps Google requires to allow other adsense on your domain? Also, lets say the writer gets an adsense account and they have their ad on my site next to their article, what if they click it a bunch? I know their adsense will get banned, but will my website be punished?


All times are GMT. The time now is 02:30 AM.

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.01882 seconds
  • Memory Usage 1,730KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete