• Resolved Grievy

    (@grievy)


    Is there a way to change it so when a post is submitted for review rather than emailing the administrator it instead emails a user with the Editor role??

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would be interested in this as well.

    Thread Starter Grievy

    (@grievy)

    Insert the following into php/templates/functions.php

    add_action( 'ef_init', 'ef_x_init_email_all_admins' );
    
    function ef_x_init_email_all_admins() {
    
    	add_filter( 'ef_notification_recipients', 'ef_x_email_all_admins', 10, 3 );
    
    }
    
    function ef_x_email_all_admins( $recipients, $post, $return_as_string ) {
    
    	$admins = ef_x_get_users_in_role( 'editor' );
    
    	if( ! empty( $admins ) ) {
    
    		foreach( $admins as $admin ) {
    
    			$recipients[] = $admin->user_email;
    
    		}
    
    	}
    
    	return $recipients;
    
    }
    
    function ef_x_get_users_in_role( $role ) {
    
    	$users = array();
    
    	if( function_exists( 'get_users' ) ) {
    
    		$users = get_users( array( 'role' => $role ) ); 
    
    	} elseif( class_exists( 'WP_User_Search' ) ) {
    
    		global $wpdb;
    
    		$wp_user_search = new WP_User_Search( '', '', $role );
    
    		foreach( $wp_user_search->get_results() as $user_id ) {
    
    			$users[] = new WP_User( $user_id );
    
    		}
    
    	}
    
    	return $users;
    
    }

    Just change editor to whatever userrole you want notified.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Notify a non-admin of posts awaiting review’ is closed to new replies.