Viewing 8 replies - 1 through 8 (of 8 total)
  • Which plugin were you using?

    May I suggest this plugin to use? Members

    Thread Starter valeriedore

    (@valeriedore)

    Hi,

    Thanks for your answer.

    That’s the one I used in the first place, but the box does not appear in the WYSIWYG Widget, unfortunately…

    Perhaps with some code in the function file, it would work, but I do not have the skills to code that.

    To me, it would be silly to use functions.php to prevent a user from editing a very specific post since functions.php is used to deal with changes on a bigger scale. This is why the plugin would better serve that purpose. By using that plugin, you don’t have to use it as a widget. You can configure a role for that user that will prevent editing then go to that specific post to select that role for the disabling of editing to take effect. I hope that makes sense.

    Thread Starter valeriedore

    (@valeriedore)

    The plugin it’s exactly what I need, but unfortunately, is not working with the plugin I use (WYSIWYG Widget). So I need to found an other way. This is why I post here. :/

    I use this plugin for my client who don’t knows how to code. And they want give restrictions to their editor on which widget they can edit in the site.

    Valerie, your client can easily use the Members plugin without writing/reading a single line of code and doesn’t need to use WYSIWYG Widget. All the client needs to do is log in the backend, go to the Members admin page then create a role to disable posting for a certain user.

    Alternatively, you may want to consider limiting users to only editing their own posts?

    Thread Starter valeriedore

    (@valeriedore)

    Sorry, I have trouble explaining what I want to do.

    The widget must stay, it is part of the site and replaces the “text” widget. Its aim is to be able to edit the same way as in a post.

    What they want is to restrain the user to edit “Aujourd’hui” only.

    https://www.dropbox.com/sc/3fyo88573fq9yhy/AAAvkaDjyZRd6TnH0nolBqPia
    https://www.dropbox.com/sc/qlcypudb9fvax5t/AAA3_0puFHVSVKQhVzuufe6sa

    I have a solution! You can use functions.php. Here’s the code:

    add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );
    function remove_row_actions( $actions )
    {
        global $post;
        global $current_user;
        get_currentuserinfo();
    
        if( get_post_type() === 'post' && $post->ID == 1 && $current_user->user_login == 'valerie' ) {
    
            unset( $actions['edit'] );
            unset( $actions['view'] );
            unset( $actions['trash'] );
            unset( $actions['inline hide-if-no-js'] );
    
         }
        return $actions;
    }

    Replace the number 1 with the correct post ID number and replace valerie with the user’s login. You can allow the user to view the post only by removing the line that says unset ($actions['view'] ); This is true for the other actions.

    Thread Starter valeriedore

    (@valeriedore)

    Hi,

    Unfortunately, it does not work. However, thank you so much for the help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Want to give access to edit a particular post to particular role’ is closed to new replies.