Home Forums Plugin Support WP User Frontend (Free Version) Can editor role edit all posts

This topic is: resolved

This topic contains 8 replies, has 2 voices, and was last updated by  jannon 5 years, 10 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #7163

    jannon
    Participant
    Post count: 4

    I have the free version and am happy to buy the pro if it is possible to set it so the editor role can see all posts from all users and be able to edit them. This is for an online magazine and their are several writers that contribute stories but they all have to be edited by our editor.

    I've looked through the documentation and forums but I can't seem to find out anything about this.

    thanks

    #7165

    Tareq Hasan
    Keymaster
    Post count: 2831

    The feature is not there in the plugin, but that can be achieved by modifying 1/2 lines of the plugin and via some filters. I can assist you with the pro version.

    #7171

    Tareq Hasan
    Keymaster
    Post count: 2831

    By default, editors can edit all users post. But the problem is the dashboard, it only shows the current users post. So below is the code that enables only editor roles to display all posts into their dashboard, so they can edit all of them. Insert the code in your themes functions.php

    [php]

    /**
    * Get a user role type by user id
    *
    * @example
    * returns by giving user id is: ‘administrator' or ‘editor' or ‘subscriber'
    *
    * @global object $wpdb
    * @param int $user_id
    * @return string
    */
    function wedevs_get_user_role( $user_id ) {
    global $wpdb;

    $user = get_userdata( $user_id );

    if ( $user->ID ) {
    $capabilities = $user->{$wpdb->prefix . ‘capabilities'};

    if ( !isset( $wp_roles ) ) {
    $wp_roles = new WP_Roles();
    }

    foreach ($wp_roles->role_names as $role => $name) {
    if ( array_key_exists( $role, $capabilities ) ) {
    return $role;
    }
    }
    }

    return false;
    }

    function wpufe_dashboard_query( $args ) {
    $user_id = get_current_user_id();

    if ( $user_id && wedevs_get_user_role( $user_id ) == ‘editor' ) {
    unset( $args[‘author'] );
    }

    return $args;
    }

    add_filter( ‘wpuf_dashboard_query', ‘wpufe_dashboard_query' );
    [/php]

    #7172

    jannon
    Participant
    Post count: 4

    Hi, I decided to buy the plugin but I'm having trouble with the labels on the registration form, they're not showing.

    #7173

    jannon
    Participant
    Post count: 4

    Hi Tareq the code worked pretty well, the editor can see all of the posts but can't edit them, just delete them.

    #7174

    Tareq Hasan
    Keymaster
    Post count: 2831

    Follow the setup of post editing and also re-save the plugin settings (Dashboard tab).

    #7175

    jannon
    Participant
    Post count: 4

    That fixed the editor dashboard. Thank you. I still don't see the field labels on the registration form. Can you help me there?

    #7177

    Tareq Hasan
    Keymaster
    Post count: 2831

    Have you actually given any labels on the the registration form? Can you give a screenshot?

    #7181

    jannon
    Participant
    Post count: 4

    Sorry Tareq, I totally missed the filling out the label field. Thank you and great plugin.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Can editor role edit all posts’ is closed to new replies.