WordPress.org

Ready to get started?Download WordPress

Forums

CMS Tree Page View
Tree ordering allowed only for admins and editors role based solution (6 posts)

  1. mattdwo
    Member
    Posted 6 months ago #

    Hi,
    great plugin, saves time and have almost everything I need, except one option.
    Tree order can be change by every user role Admin, Editor, Author, Contributor. Even if we base on role customizing plugins like Members or User Role Editor there is no way to disable tree ordering functionality only for Author or Contributor or another custom role.

    I write some code to add custom capability move_cms_tree_view_page to role. This changes https://github.com/magicmat/cms-tree-page-view-permission/commit/db33756539b8099b9679166f9605b9b087fe87e2 declare role capability on plugin activation and remove on deactivation. So the role customizing plugins can see that capability. Then you can check or uncheck this capability from role manager or editor

    If there is simpler and cleaner solution I would be happy to see it.
    Maybe someone find this functionality useful too?

    Thank you
    Matt

    http://wordpress.org/plugins/cms-tree-page-view/

  2. Pär Thernström
    Member
    Plugin Author

    Posted 6 months ago #

    Thanks a lot! I'll take a look at this and if I like/understand the approach I'll add it to the next update.

  3. mattdwo
    Member
    Posted 6 months ago #

    Hi Par,

    One thought appered today, that maybe javascript mouse drag should bind only when there is permission from !current_user_can( CMS_TPV_MOVE_PERMISSION ) I dont know structure of your plugin but maybe you know easy way to do this.
    Other solution could be show user message from ajax.
    I add just die("Error: you dont have permission");
    In this way of course ajax dont show this message to user

    Im not wordpress expert but permission based on core wordpress role capabilities may be useful when more options of this type will come to plugin

    Thanks
    Matt

  4. mattdwo
    Member
    Posted 6 months ago #

    So maybe I summarize my small corrections to this plugin.
    Its all about permissions.

    I need show tree with posts to Contributor but be sure that Contributor dont publish any of write posts also dont move tree order.

    For example if we work on fresh wordpress installation there is a "Submit for Review" on /post-new.php for Contributor. If I'm not wrong its "Publish" for Admin, Editor and Author by default.

    When enable this plugin and follow the path: Posts->Tree View we have access to radio "Published" before "Add" button. After hit "Add" plugin redirect us to some ajax, but never redirects. Anyway, plugin publish post as Contributor.

    So I merge my fixes with leatest version of this plugin

    Fixes:
    - only roles with right permission can change tree order (Contributor and any role which have unset custom 'move_cms_tree_view_page' capability. Plugins sets it on installation)
    - only roles with right permission can publish posts and pages from the tree menu
    Tested on (WordPress 3.6.1)
    Direct download with fixes

    Please note if I missed something.

    Thanks
    Matt

  5. Pär Thernström
    Member
    Plugin Author

    Posted 6 months ago #

    I added the plugin to github som you can create pull requests and issues there:
    https://github.com/bonny/WordPress-CMS-Tree-Page-View

  6. mattdwo
    Member
    Posted 6 months ago #

    Thanks, I created pull request

Reply

You must log in to post.

About this Plugin

About this Topic