Home Forums Plugin Support WP User Frontend Pro Publish any post from dashboard of admin user role

This topic is: resolved

This topic contains 6 replies, has 2 voices, and was last updated by  Rebecca 4 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #19846

    Rebecca
    Member
    Post count: 8

    Great plugin! I've been trying to solve this one issue for a while now, searching the forum, trying everything, and have been unable to get this specific functionality worked out.

    What I'm trying to do:
    Subscriber level users can submit a post and edit it after submission. The post goes to “pending approval” status as desired.

    I have set up the admin front end dashboard to access all submitted posts through WP User Frontend Pro form so that the admin can review the new submitted posts there, edit them, AND (here's the part I need help with) change the status from Pending to Published.

    I have used this fix: http://wedevs.com/support/topic/post-status-for-roles/ to no avail. I've also tried a few other modifications of other suggestions in the forums, but nothing has affected the desired functionality.

    Can you help me enable the user role of administrator to publish posts submitted by other users from within the WP User Frontend Pro dashboard please?

    You have to log into the site to see the form and dashboards. Please let me know if you'd like admin access or subscriber access – whatever will help.
    Thank you.

    #19847

    Rebecca
    Member
    Post count: 8

    Isn't this the way things work? I just fixed it myself. Thanks.

    #19855

    Oritro Ahmed
    Spectator
    Post count: 155

    Rebecca It will be a Great help if you share with us, how you solved it !

    #19873

    Rebecca
    Member
    Post count: 8

    As suggested in this ticket: http://wedevs.com/support/topic/post-status-for-roles/, I used this snippet with the modification of “author” now “administrator”.

    function dlp_wpuf_editor_post_status( $postarr ) {
         
        $user = wp_get_current_user();
        $role = reset( $user->roles );
     
        if ( $role == 'administrator' ) {
            $postarr['post_status'] = 'publish';
        }
      
        return $postarr;
    }
      
    add_filter( 'wpuf_add_post_args', 'dlp_wpuf_editor_post_status' );
    add_filter( 'wpuf_update_post_args', 'dlp_wpuf_editor_post_status' );

    added in this to make all posts visible to admin as suggested in the help forums:

    function wpufe_dashboard_show_all_to_admin( $args ) {
        if ( current_user_can( 'manage_options' ) ) {
            unset( $args['author'] );
        }
     
        return $args;
    }

    And now I'm going to start researching how to make a drop-down for admin to set the status next to the “Update” button. Any suggestions or prior tickets with solutions welcomed. Thanks!

    #35775

    Rebecca
    Member
    Post count: 8
    This reply has been marked as private.
    #35910

    Rebecca
    Member
    Post count: 8

    Hello! It's been 8 months and I'm trying to do this again on a new site. Unfortunately my prior functions.php alterations are throwing errors on the new site. Here's what I put in:

    // Functions relating to WP User Frontend Pro

    function dlp_wpuf_editor_post_status( $postarr ) {

    $user = wp_get_current_user();
    $role = reset( $user->roles );

    if ( $role = ‘subscriber' ) {
    $postarr[‘post_status'] = ‘publish';
    }

    return $postarr;
    }

    add_filter( ‘wpuf_add_post_args', ‘dlp_wpuf_editor_post_status' );
    add_filter( ‘wpuf_update_post_args', ‘dlp_wpuf_editor_post_status' );

    Any idea why?

    #35911

    Rebecca
    Member
    Post count: 8

    Forgot the last bit – sorry!
    function wpufe_dashboard_show_all_to_admin( $args ) {
    if ( current_user_can( ‘update_themes' ) ) {
    unset( $args[‘subscriber'] );
    }

    return $args;
    }
    add_filter( ‘wpuf_dashboard_query', ‘wpufe_regular_admin_dashboard' );

    I've tried, in the unset line author and subscriber

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

The topic ‘Publish any post from dashboard of admin user role’ is closed to new replies.