Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Hooks in the middle of discussion list
Is there a hook available that will allow me to add something in the middle of the discussion list. like something after the 5th Discussion or 5th Comment.
0
This discussion has been closed.
Comments
if ('comments.php' == $Context->SelfUrl) { Function TweenPost(&$CommentGrid) $RowNumber = &$CommentGrid->DelegateParameters['RowNumber']; $Comment = &$CommentGrid->DelegateParameters['Comment']; if ( 5 == $RowNumber ) { // close the existing CommentBody div, and open a new one that gets closed by the old div: $Comment->Body .= '</div><div class="TweenPost">' . $data; } $Context->AddToDelegate('CommentGrid', 'PreCommentOptionsRender', 'TweenPost'); }
Edit: Changed
TweenPost($$CommentGrid)
toTweenPost(&$CommentGrid)
Actually i want to display an ad after first comment ;-)
Thanks for your help guys
global $data;
but i have to do that for every single delegate I'm using. I was hoping to call the function with the data, which will make my code lot smaller than it is right now
function DisplayMenuNugget(&$Menu) { global $NuggetObj; for ($i=0; $i < count($NuggetObj->Nugget); $i++) { if ($NuggetObj->Nugget[$i]['status']//check status && in_array($Menu->Context->Session->User->RoleID, $NuggetObj->Nugget[$i]['roles']) // check roles && in_array($Menu->Context->SelfUrl, $NuggetObj->Nugget[$i]['pages']) //check pages && $NuggetObj->Nugget[$i]['position'] == 'MENU') { $NuggetObj->Nugget[$i]['html'] = AllowPHP($NuggetObj->Nugget[$i]['html']); if(!$NuggetObj->Nugget[$i]['hideName']) $DisplayNuggetString = '<h2>'.$NuggetObj->Nugget[$i]['name'].'</h2>'; $DisplayNuggetString = '<div class="Nugget '.$NuggetObj->Nugget[$i]['position'].'">'.$DisplayNuggetString. $NuggetObj->Nugget[$i]['html'].'</div>'; echo $DisplayNuggetString; } } } $Context->AddToDelegate('Menu', 'PreBodyRender', 'DisplayMenuNugget'); function DisplayBelowPanelNugget(&$Panel) { global $NuggetObj; for ($i=0; $i < count($NuggetObj->Nugget); $i++) { if ($NuggetObj->Nugget[$i]['status']//check status && in_array($Panel->Context->Session->User->RoleID, $NuggetObj->Nugget[$i]['roles']) // check roles && in_array($Panel->Context->SelfUrl, $NuggetObj->Nugget[$i]['pages']) //check pages && $NuggetObj->Nugget[$i]['position'] == 'BELOW_PANEL') { $NuggetObj->Nugget[$i]['html'] = AllowPHP($NuggetObj->Nugget[$i]['html']); if(!$NuggetObj->Nugget[$i]['hideName']) $DisplayNuggetString = '<h2>'.$NuggetObj->Nugget[$i]['name'].'</h2>'; $DisplayNuggetString = '<div class="Nugget '.$NuggetObj->Nugget[$i]['position'].'">'.$DisplayNuggetString. $NuggetObj->Nugget[$i]['html'].'</div>'; echo $DisplayNuggetString; } } } $Context->AddToDelegate('Panel', 'PostElementsRender', 'DisplayBelowPanelNugget');
I would like to just use one function, by passing appropriate parameters