PDA

View Full Version : Add-On Releases - Mid Post Advertisements (middle of the post)


YankForum
14 Aug 2014, 19:11
Hello
although vbulletin 5 has no good options for developers and make the life hard for us , but I decided to go through it and adopt my previouse mods to vbulletin 5 hope you guys like em.

1What does this hack do ?

This mod simply lets you put your desired ads or any other codes just in the middle of first post , in each page of a thread .
This mod is updated in such a way that it recognized end of the sentences by ".!?" so it wont break the post content on the wrong place instead it only inserts ads after the sentence , near to the middle of the post.

http://www.vbulletin.org/forum/attachment.php?attachmentid=150103&stc=1&d=1408039701

https://www.vbulletin.org/forum/


1Known Issues :
you shouldn't edit your first post , that causes real problems , and you lose all the contents of first post. (this is solved in version 1.1)
Vbulletin 5 AJAX and Post caching sucks! and this might have a little bit conflicts with that system since vbulletin 5 is not written professionally and has many and many bugs and downsides.
sometimes it's not exactly in the middle of posts , that's because in logic sometimes there is no real half point , while some posts have even number of lines and some posts have odd number of lines . but it tries to put it to the nearest location to the mid point! :)1Try not to mention following things :
if you think it's against google TOS then don't install it ;) but keep in mind you can also use it with other network ads , and keep in mind at no point google directly mentioned it's against their TOS to put adsense in between content , so do not insist :D
1Installation Guide:

1- upload the MidPostAds folder to its equivalent folder on your FTP site.
there is only 1 folder: yourwebsite/core/packages/MidPostads

2- goto: Admincp=>Products & Hooks=>Manage Products=>[Add/Import Product]
choose the xml file we provided : MidPostAds.xml , set overwrite to YES (if it's upgrade) and hit "Import"

3- File edit (only 3 lines) : open this file : yourwebsite/includes/vb5/template/nodetext.php
search for this line:
$found = $cache->read(array_keys($this->placeHolders));

and after it add this:
if (class_exists('MidPostAds_Api_node')) {$found = MidPostAds_Api_node::MidPostAdsInsertion($found); }$i=1;

--------------------

now search for this line:
$parsed = $parser->doParse(

and just BEFORE it add this:
if (class_exists('MidPostAds_Api_node')) {$textData['rawtext'] = MidPostAds_Api_node::MidPostAdsInsertionRaw($textData['rawtext'],$i);}$i=$i+1;

--------------------

find this line:
$cache->write($cacheKey, $parsed, 10080, $events);

and remove it or comment it

DONE

you can now go to admincp => Settings => MidpostAds
and change the settings or import your Ads code to be shown.

please keep in mind vbulletin 5 has lots if issues with posts Caching and sometimes needs to refresh the page or wait for changes to take effect
1Updates
version 1.0 : Initial release FIXED
version 1.1 : Now it works with vBulletin5 Caching system and without FIXED

1Enjoy and please please try not to forget to click as Installed (http://www.vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=251787) if you liked it you can also Nominate it for MOTM (http://www.vbulletin.org/forum/vborg_miscactions.php?do=nominate&threadid=251787&type=1) , that's optional but clicking as installed is a must :)

Edit by Staff: This modification adds a copyright to the bottom of your site which includes more than one link. If you do not wish for the copyright to be included at the bottom of your site do not use this modification OR ask for permission to remove them from the developer directly via private message (https://www.vbulletin.org/forum/private.php?do=newpm&u=375379).

YankForum
14 Aug 2014, 19:30
first post is reserved
by the way , vBulletin 5 needs serious updates!

Good to know: This mod doesn't break post content , first it searched for the middle of the post then it looks for end of sentence there based on symbols (.?!) and inserts ADS after that sentence.

shneler2010
07 Oct 2016, 15:04
not working ?! in VB5.2.4
please update

Qsrr.Net
29 Nov 2017, 19:49
Doesn't work for my vB 5.3.3. All pages became blank with this error in error_log:


PHP Fatal error: Broken Extension Class: MidPostAds_node in /home/xx/public_html/core/vb/api/extensions.php on line 310