View Full Version : Add adsense site links to signature of first post?
doogie88
04-15-2016, 01:03 PM
How hard would it be to add site links by adsense to the signature of the first or second post?
MarkFL
04-15-2016, 01:22 PM
To add to the signature of the first post in a thread, you could create a plugin hooked at "postbit_display_complete" with the plugin PHP code:
if ($post['postid'] == $thread['firstpostid'])
{
$add = '<br /><br /><div style="color:green">This is added text</div>';
$post['signature'] .= $add;
}
Edit the content of the $add string to contain the HTML you want to add. :)
doogie88
04-15-2016, 01:31 PM
Could I do second post?
MarkFL
04-15-2016, 01:43 PM
Could I do second post?
Yes, change the code to:
if ($post['postcount'] == 2)
{
$add = '<br /><br /><div style="color:green">This is added text</div>';
$post['signature'] .= $add;
}
For the first post, instead of using what I originally posted, just use:
if ($post['postcount'] == 1)
{
$add = '<br /><br /><div style="color:green">This is added text</div>';
$post['signature'] .= $add;
}
edit: You likely do not want the two line breaks if the author of the post to which the text is added does not have a signature being shown, so change the code to:
if ($post['postcount'] == X)
{
$add = '<div style="color:green">This is added text</div>';
if ($post['signature'])
{
$add = '<br /><br />' . $add;
}
$post['signature'] .= $add;
}
"X" is the post number in the thread you want to affect.
doogie88
04-17-2016, 04:02 AM
Looks like it's working fine. Thanks a lot!
doogie88
07-17-2016, 03:37 PM
Yes, change the code to:
How can I change this so it's last post of every page? So not just say post #15, but last post on threads with numerous pages?
MarkFL
07-17-2016, 05:06 PM
How can I change this so it's last post of every page? So not just say post #15, but last post on threads with numerous pages?
Try the following conditional:
if ($post['islastshown'])
RichieBoy67
07-17-2016, 08:48 PM
What I usually do is after the first post and after the last post if there is at least a certain amount of posts showing.. This way you will have more than one though I do not use adsense..
doogie88
07-17-2016, 11:03 PM
Try the following conditional:
if ($post['islastshown'])
That worked, thanks a lot.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.