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.
Options

Feature requests

bobthemanbobtheman
edited September 2010 in Vanilla 2.0 - 2.8
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
«1

Comments

  • Options
    I'd love to be able to protect certain pages by member role... Is there something that I can add to my page to get vanilla to do this?

    There was an error rendering this rich post.

  • Options
    ddumontddumont ✭✭
    edited November 2010
    I'd love to be able to protect certain pages by member role... Is there something that I can add to my page to get vanilla to do this?
    I'd love for a way to do this more automatically, but here's how I ended up doing it.
    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' ),



    There was an error rendering this rich post.

  • Options
    A revision feature would be swaggedy!
  • Options
    Revision feature for what exactly, @yusf?
  • Options
    @hyphy
    A functionality for version rollback and such. A wiki more or less. :)
  • Options
    PamelaPamela ✭✭
    edited June 2012

    ddumont said:
    I'd love to be able to protect certain pages by member role... Is there something that I can add to my page to get vanilla to do this?

    I'd love for a way to do this more automatically, but here's how I ended up doing it.
    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'
    ),

    Many thanks to share this tip but is it the best way? for do it :) now... with v2.0.18.4

  • Options
    peregrineperegrine MVP
    edited June 2012

    the above should work in 2.18.0.4. Can't answer if it is the best way.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    PamelaPamela ✭✭

    peregrine said:
    the above should work in 2.18.0.4. Can't answer if it is the best way.

    Ok, thank you :) so, I will try...

  • Options
    SheilaSheila ✭✭

    Hi!

    Could I get more detailed (n00b proof) info, how to add code that dumond posted?

  • Options

    what don't you understand?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SheilaSheila ✭✭

    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..

  • Options
    peregrineperegrine MVP
    edited July 2012

    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'
    );
    

    and add this to your custom page food.

        $perm_manage = Gdn::Session()->CheckPermission('Plugins.CustomPageFood.Manage');
        $perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFood.View');
        if (!($perm_view || $perm_manage)) {
        exit();
        }
    

    obviously if food is not your custom page change it accordingly.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SheilaSheila ✭✭
    edited July 2012

    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.

  • Options
    peregrineperegrine MVP
    edited July 2012

    did you wrap it in php tags?

    <?php 
     $perm_manage=Gdn::Session()->CheckPermission('Plugins.CustomPageFood.Manage');
    
     $perm_view = Gdn::Session()->CheckPermission('Plugins.CustomPageFood.View');
    
      if (!($perm_view || $perm_manage)) { exit();  }
        ?>
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited July 2012

    the options for permissions will show up in each role towards the bottom just before the default category permissions.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SheilaSheila ✭✭
    edited July 2012

    peregrine said:
    did you wrap it in php tags?

    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'); ?>

  • Options

    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.
    

    }

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SheilaSheila ✭✭
    edited July 2012

    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.

  • Options

    How did you add it to the menu in the first place?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    SheilaSheila ✭✭

    It is included in Air theme default.master.php,
    $this->Menu->AddLink('FAQS', T('FAQS'), '/faqs');

Sign In or Register to comment.