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.
Check that a moderator is signed in?
baldonius
New
I have implemented AdSense code onto my Vanilla forum site by creating and editing a default.master.php for my custom theme. It works fine, but to stay safe I want to dynamically add the following line:
google_adtest = “on”;
...into the AdSense code whenever I am logged into the forum. I know that whenever I am logged in the forum shows the 'Dashboard' link in the menu, which doesn't show for normal users, and the PHP for that is simply:
$this->Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', array('Garden.Settings.Manage'), array('class' => 'Dashboard'));
...since I based my default.master.php file off Vanilla's default.
So can you help me out guys?
0
Comments
php code could be
if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) {
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Since you are using a default.master.php, you should try what @peregrine posted.
In smarty you could do
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
@Bleistivt best not to use a name, use permission an assign a role.
grep is your friend.
Yes, if you wanna go the smarty way, the best would be to build a custom smarty Plugin, but just using whats there, there is not much of a choice:
I wish Vanilla would at least assign the UserID to a smarty variable.
But OP is using a php template anyway, so theres no need for this.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanks for the tips.
You could use the block permission smarty tag:
https://github.com/vanilla/vanilla/blob/2.1/library/vendors/SmartyPlugins/block.permission.php.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
https://github.com/vanilla/vanilla/blob/master/library/core/class.smarty.php#L46
you could ask them to add this line after line 46 on github.
'UserID' => $Session->User->UserID,
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
It is really easy to add smarty functions. You can do in a themehooks file.
grep is your friend.
Like this:
/themes/MyTheme/class.mythemethemehooks.php
And that:
/themes/MyTheme/SmartyPlugins/function.is_moderator.php
@r_j the above is grist for a new tutorial in the tutorial category. don't let it get lost in the noise.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Done