Publish any post from dashboard of admin user role

This topic contains 6 reply and 2 voices, and was last updated by Rebecca 9 years, 2 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
May 4, 2014 at 6:16 am 19846
Rebecca 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.
May 4, 2014 at 6:18 am 19847
Rebecca Rebecca

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

May 4, 2014 at 4:02 pm 19855
Oritro Ahmed Oritro Ahmed

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

May 4, 2014 at 9:09 pm 19873
Rebecca Rebecca

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!

February 4, 2015 at 9:22 pm 35775
Rebecca Rebecca This reply has been marked as private.
February 6, 2015 at 1:03 am 35910
Rebecca Rebecca

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?

February 6, 2015 at 1:04 am 35911
Rebecca Rebecca

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 6 Posts - 1 through 6 (of 6 total)