vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Add adsense site links to signature of first post? (https://vborg.vbsupport.ru/showthread.php?t=322370)

doogie88 04-15-2016 01:03 PM

Add adsense site links to signature of first post?
 
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:

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

Quote:

Originally Posted by doogie88 (Post 2569019)
Could I do second post?

Yes, change the code to:

PHP Code:

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:

PHP Code:

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:

PHP Code:

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

Quote:

Originally Posted by MarkFL (Post 2569021)
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

Quote:

Originally Posted by doogie88 (Post 2573314)
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:

PHP Code:

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

Quote:

Originally Posted by MarkFL (Post 2573319)
Try the following conditional:

PHP Code:

if ($post['islastshown']) 


That worked, thanks a lot.


All times are GMT. The time now is 02:32 PM.

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.01496 seconds
  • Memory Usage 1,744KB
  • 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
  • (6)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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