This discussion is related to the Custom Pages addon.
some features i would love to see in this app
ability to edit pages from admin dashboard wysiwyg editor private pages, password protected media upload ability comment system, could use the discussion application for this
And in the default.php for the CustomPages plugin I added this: $PluginInfo['CustomPages'] = array( 'Name' => 'Custom Pages', 'Description' => 'A plugin that lets you add custom pages...', 'Version' => '1', // I added the line below: 'RegisterPermissions' => array( 'Plugins.CustomPageFood.Manage', 'Plugins.CustomPageFood.View' ),
And in the default.php for the CustomPages plugin I added this:
$PluginInfo['CustomPages'] = array(
'Name' => 'Custom Pages',
'Description' => 'A plugin that lets you add custom pages...',
'Version' => '1',
// I added the line below:
'RegisterPermissions' => array(
'Plugins.CustomPageFood.Manage',
'Plugins.CustomPageFood.View'
),
Many thanks to share this tip but is it the best way? for do it :) now... with v2.0.18.4
The exact lines where to add the code, and if I should wrap it within php -function and if, then how to do it. Sorry, I'm really bad with these. Willing to learn but..
I haven't tested the custom pages aspect - but it does put permissions in your dashboard.
he's saying to the CustomPages plugin - default.php
$PluginInfo['CustomPages'] = array(
'Name' => 'Custom Pages',
'Description' => 'A plugin that lets you add custom pages. You need to add them to the "pages" folder of this plugin.',
'Version' => '1',
'Author' => "Mark O'Sullivan",
'AuthorEmail' => 'mark@vanillaforums.com',
'AuthorUrl' => 'http://vanillaforums.com'
);
to this... (this should give you manage and view options for CustomPageFood in the dashboard permissions.
$PluginInfo['CustomPages'] = array(
'Name' => 'Custom Pages',
'Description' => 'A plugin that lets you add custom pages. You need to add them to the "pages" folder of this plugin.',
'Version' => '1',
'RegisterPermissions' =>array('Plugins.CustomPageFood.Manage','Plugins.CustomPageFood.View'),
'Author' => "Mark O'Sullivan",
'AuthorEmail' => 'mark@vanillaforums.com',
'AuthorUrl' => 'http://vanillaforums.com'
);
To be honest, I kept just staring the part <?php if (!defined('APPLICATION')) exit(); ?> and wondering, were exactly is the place to add this other function.
At least something happened since there's a WSOD now. No new permissions in the admin thou.
This is what I used:
<?php
$perm_manage=Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.Manage');
$perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.View');
?>
This is what I used:
<?php
> $perm_manage=Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.Manage');
> $perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.View');
> ?>
What exactly is you goal. to only have people logged in, able to view it?
in that case you could just check for (and forget about the mods to plugin).
$Session = Gdn::Session();
// this tests to see is user is logged in
if ($Session->IsValid()) {
// do the faq stuff
} else {
// display you don't have permission to view.
}
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
peregrine said:
What exactly is you goal. to only have people logged in, able to view it?
Yes, just to set that page visible for logged in members only. Most ideal would be, if menu link also is hidden. I think it's often just more user friendly to hide things completely than give those 'You don't have permission to...' -messages.
put this in the default.master.php
if (Gdn::$Session->IsValid()) {
$this->Menu->AddLink('FAQS', T('FAQS'), '/faqs');
}
put this in the application
if (!Gdn::Session()->IsValid()) {
exit();
}
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
^ Just superb! That did it. Thank you once again :)
That hided also other custom page link that is listed after 'Faq' and which I want guests to see since it's a contact page, but I solved that with adding manage and view options to contact-page.
I could have naturally moved contact link before faq if it was any other page, but contact just shoudn't be in the middle of main menu unless that is most important page of the site.
peregrine said:
the options for permissions will show up in each role towards the bottom just before the default category permissions.
Comments
My addons: NillaBlog | Vanoogle
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •in my custom page:
$perm_manage = Gdn::Session()->CheckPermission('Plugins.CustomPageFood.Manage');$perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFood.View');
if (!($perm_view || $perm_manage)) {
exit();
}
And in the default.php for the CustomPages plugin I added this:
$PluginInfo['CustomPages'] = array('Name' => 'Custom Pages',
'Description' => 'A plugin that lets you add custom pages...',
'Version' => '1',
// I added the line below:
'RegisterPermissions' => array(
'Plugins.CustomPageFood.Manage',
'Plugins.CustomPageFood.View'
),
My addons: NillaBlog | Vanoogle
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •A functionality for version rollback and such. A wiki more or less. :)
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Many thanks to share this tip but is it the best way? for do it :) now... with v2.0.18.4
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •the above should work in 2.18.0.4. Can't answer if it is the best way.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
1 • Off Topic Insightful 1Awesome LOL •Ok, thank you :) so, I will try...
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Hi!
Could I get more detailed (n00b proof) info, how to add code that dumond posted?
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •what don't you understand?
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
1 • Off Topic Insightful 1Awesome LOL •The exact lines where to add the code, and if I should wrap it within php -function and if, then how to do it. Sorry, I'm really bad with these. Willing to learn but..
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I haven't tested the custom pages aspect - but it does put permissions in your dashboard.
he's saying to the CustomPages plugin - default.php
to this... (this should give you manage and view options for CustomPageFood in the dashboard permissions.
and add this to your custom page food.
obviously if food is not your custom page change it accordingly.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Okay, thanks. Seems like I did it right then in a first place. But no new options in the admin and code is visible on the public side.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •did you wrap it in php tags?
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •the options for permissions will show up in each role towards the bottom just before the default category permissions.
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Of course not! ;)
To be honest, I kept just staring the part
<?php if (!defined('APPLICATION')) exit(); ?>and wondering, were exactly is the place to add this other function.At least something happened since there's a WSOD now. No new permissions in the admin thou.
This is what I used:
<?php $perm_manage=Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.Manage'); $perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFaqs.View'); ?>- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •What exactly is you goal. to only have people logged in, able to view it?
in that case you could just check for (and forget about the mods to plugin).
}
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Yes, just to set that page visible for logged in members only. Most ideal would be, if menu link also is hidden. I think it's often just more user friendly to hide things completely than give those 'You don't have permission to...' -messages.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •How did you add it to the menu in the first place?
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •It is included in Air theme default.master.php,
$this->Menu->AddLink('FAQS', T('FAQS'), '/faqs');- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
1 • Off Topic Insightful 1Awesome LOL •I get Fatal error: Access to undeclared static property: Gdn::$Session in /themes/default/views/default.master.php on line 32
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •try this then
factoid: Most questions have been previously answered, try the search box first, please provide your Vanilla version Number!
Peregrine's Addons - donations gladly accepted for "successful solutions" and addons - kind of like tipping a waiter at a restaurant
- Spam
- Abuse
- Troll
1 • Off Topic Insightful 1Awesome LOL •^ Just superb! That did it. Thank you once again :)
That hided also other custom page link that is listed after 'Faq' and which I want guests to see since it's a contact page, but I solved that with adding manage and view options to contact-page.
I could have naturally moved contact link before faq if it was any other page, but contact just shoudn't be in the middle of main menu unless that is most important page of the site.
I found an answer to this, why I did not see any new options in role management. In order to changes take an effect, plugin needs to be turned off and back on.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •