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

  1. mattdwo
    Posted 2 years ago #

    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


  2. Pär Thernström
    Plugin Author

    Posted 2 years 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
    Posted 2 years 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


  4. mattdwo
    Posted 2 years 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

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


  5. Pär Thernström
    Plugin Author

    Posted 2 years ago #

    I added the plugin to github som you can create pull requests and issues there:

  6. mattdwo
    Posted 2 years ago #

    Thanks, I created pull request

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • CMS Tree Page View
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic