• Resolved vinnyegc

    (@vinnyegc)


    Hello, I have a custom user role named Franchisee, (gtt_franchisee) I also have a custom post type named Locations (location).

    The Post type has 2 capabilities for the location pages, edit_locations and edit_published_locations.

    When I try to edit anything it doesnt work, I can update but it goes live and not set for review. However if I give that same user role only edit_page for the default page post type, it works fine and I can submit for review. How do I get this to work properly?

    Here is a screen shot of my user role permissions for my Locations post type.
    https://ibb.co/e9w7wo

    This is default Pages post type.
    https://ibb.co/jmwU98

    Thank you in advance.

    • This topic was modified 6 years, 8 months ago by vinnyegc.
Viewing 12 replies - 16 through 27 (of 27 total)
  • Plugin Author jamiechong

    (@jamiechong)

    Sorry – my bad. My dev setup uses URE also and I had added page capabilities to the Contributor role. This made everything work because you have this in your CPT definition:

    'capability_type' => 'page',

    If you remove that it defaults to post and then by default things work fine. Otherwise add edit_pages and delete_pages caps to your contributor role.

    Thread Starter vinnyegc

    (@vinnyegc)

    if i add edit_page to my custom role, it works with pages, but not my cpt.

    i am not using the contributor role, it is a custom role called franchisee.

    Plugin Author jamiechong

    (@jamiechong)

    Then show me how your role is configured. I need all the infoz dude.

    Thread Starter vinnyegc

    (@vinnyegc)

    yeah i dont know how to export the role, with User Role Editor. i can take some screen shots i guess.

    https://ibb.co/k1jQj8
    https://ibb.co/kz7BP8
    https://ibb.co/iicNWo

    hope that helps.

    Plugin Author jamiechong

    (@jamiechong)

    I’m using the code you provided to create the Locations CPT, I’m using URE and created a new role, but I’m not seeing the same capability options for the Location CPT as you. This is what I see.

    https://www.dropbox.com/s/zpsf1l9g3fj8knl/Screenshot%202018-07-11%2009.26.26.png?dl=0

    What other code do you have that I’m not seeing?

    Thread Starter vinnyegc

    (@vinnyegc)

    for that post type, nothing. i barely even have any plugins installed.

    i am going to try deleting the user role, and recreating it. maybe it will work.

    Plugin Author jamiechong

    (@jamiechong)

    The Addon is meant for Contributors (it’s called Contributors Can, not Franchisees Can). I haven’t tested with custom roles. You can also try this, but I can’t guarantee it’ll work.

    add_filter('revisionize_user_can_revisionize', function($can) {
      return $can || current_user_can('edit_locations');
    }, 20, 1);
    
    add_filter('revisionize_is_create_enabled', function($can, $post) {
      return $can || ($post->post_status == 'publish' && !\Revisionize\get_revision_of($post) && $post->post_type == 'locations' && current_user_can('edit_locations'));
    }, 20, 2);
    
    add_filter('revisionize_user_can_publish_revision', function($can) {
      return $can || current_user_can('publish_locations');
    }, 20, 1);
    • This reply was modified 6 years, 8 months ago by jamiechong.
    Thread Starter vinnyegc

    (@vinnyegc)

    added those filters, still didnt work, this is what i get.

    https://ibb.co/en3FZ8

    Plugin Author jamiechong

    (@jamiechong)

    Who are you logged in as? A franchisee?

    If so, You need to “revisionize” first. Then on the revision you can submit for review.

    Thread Starter vinnyegc

    (@vinnyegc)

    is there a way to do so you dont have to “revisionize” first, or just hide the update button, the users arent the brightest bulb in the box and wont hit that button.

    when i go to a page i can edit without hitting “revisionize” first

    Thread Starter vinnyegc

    (@vinnyegc)

    nevermind i must have hit it and not remebered, is there a way to add the revisionize text next to the view on the on there? so i can turn off edit_published_locations

    Thread Starter vinnyegc

    (@vinnyegc)

    ok i got it, i used your filters you provided, but i noticed you had locations as the post type, its singular, location. changed that and it works perfectly now.

    Thanks so much for all the help I truly appreciate it. Im going to 5 star review this.

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Custom User Role and CPT’ is closed to new replies.