Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Adsense in first post
Raize
vancouver ✭✭
What's the best way to put some text ads in the first post of a discussion, where the users signature would usually be?
0
Comments
public function DiscussionController_AfterCommentBody_Handler($Sender)
Inside the method, check that you're in the first post by going like this:
$Type = strtolower($RawType = $Controller->EventArguments['Type']); if ($Type == 'comment') return;
Then insert whatever code you need to output your advertising.
Vanilla Forums COO [GitHub, Twitter, About.me]
$Type = strtolower($RawType = $Controller->EventArguments['Type']);
$Type = (comment|discussion)
if ($Type == 'comment') return;
Thus, "check the type. if it is a comment, get out and do nothing, else show ads".
Vanilla Forums COO [GitHub, Twitter, About.me]
Have I missed something? I have this horrible feeling like you're going to point out a giant turd on my head...
Vanilla Forums COO [GitHub, Twitter, About.me]
<?php echo $this->FetchView('comments'); ?>
applications/vanilla/views/discussion/comments.php -
line 8-10
if ($CurrentOffset == 0 && !$this->Data('NewComments', FALSE)) { echo WriteComment($this->Discussion, $this, $Session, $CurrentOffset); }
line 14-18
foreach ($CommentData as $Comment) { ++$CurrentOffset; $this->CurrentComment = $Comment; WriteComment($Comment, $this, $Session, $CurrentOffset); }
applications/vanilla/views/discussion/helper_functions.php
$Type = property_exists($Object, 'CommentID') ? 'Comment' : 'Discussion'; $Sender->EventArguments['Type'] = $Type;
<?php $Sender->FireEvent('AfterCommentBody'); ?>
Vanilla Forums COO [GitHub, Twitter, About.me]