WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
Author role adding custom types (1 post)

  1. button999
    Member
    Posted 2 years ago #

    Hello!

    First of all, excellent work on the Types plugin. I've decided to use it mostly because it has parent / children relationships available.

    Now, the problem I'm facing is the Author capability to post custom types. I have a custom type named "Tool" which can have several "Tool versions" (parent/children relationship). When posting as an Administrator, everything works. But because I want to beef up my security, I've decided to post as an Author and use Admin account from time to time and only for administration purposes. I've discovered that Author can't add new children or connect children to the desired parent. The ajax loading ring appears, but nothing happens, no new entry or anything. Furthermore, I have discovered that to do so, the Author role has to have "manage_options" capability. When I add this capability to the Author, everything works, but the Author can then also edit the different options AND custom types (actually all the types plugin options are made available that way), which is again undesirable.

    Code to add capability, add this to functions.php:

    // get the "author" role object
    $role = get_role('author');
    
    // add "manage_options" to this role object
    $role -> add_cap('manage_options');

    To achieve my goal, I have changed 'manage_options' to 'publish_posts' in both /embedded/includes/ajax.php and /includes/ajax.php files line 7, and it seems to be working now. The goal was to allow anyone with publishing capabilities to add custom parent/children capability.

    Now, my question and suggestion is to make this available by default or by an option in future versions, because I think being able to use the custom types and being able to edit them should be separated.

    http://wordpress.org/extend/plugins/types/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic