Support » Plugin: Contextual Related Posts » Doesn’t work with custom roles

  • I have a user with a custom role (which has rights to create an article) who can see the box to input custom related post ; but which changes aren’t saved (mine are saved fine).

    The checkbox restricting the metabox to the admin is unchecked, and what’s more, the user see the metabox.

    So my first guess is that CRP doesn’t work fine with custom roles from extensions like “members”

    A small fix would be to check if the user has the right to modify the post, whatever the role.

    A fix & improvement would be to add an ability to the list of user roles ability (I don’t know how it works, but at least yoast seo does it, so plugins definitely can do this). If “only admins” box (relabeled for more accuracy) is checked ; then the plugin would check if the editor has or not the ability to change CRP. If not, all the people having the right to modify the post would have the right to change CRP.

    I hope I’m clear enough.

Viewing 1 replies (of 1 total)
  • Plugin Author Ajay

    (@ajay)

    Hi, thanks for reporting this. I think there might be a potential solution for this. Are you in a position to edit /contextual-related-posts/admin/metabox.php and in the crp_save_meta_box function you replace this line:

    
    	if ( ! current_user_can( 'edit_posts' ) ) { return; }

    with

    
    	if ( ! current_user_can( 'edit_post', $post_id ) ) {
    		return;
    	}
    
    • This reply was modified 4 years, 3 months ago by Ajay.
Viewing 1 replies (of 1 total)
  • The topic ‘Doesn’t work with custom roles’ is closed to new replies.