Select roles to see subscriber list

Hi, I have this plugin installed on a client site and would like to allow them to view the full list of subscribers. However, my client's user role is not set to administrator. Is there a line of code I can add to my themes functions.php to change the permissions on who is allowed to see the subscribers page?

  • Majid
    • Syntax Hero

    Hey Sanders,

    To be able to manage subscription, a user must have Manage Subscribe By Email capability.
    so to give this permission to the user you want you will add this snippet to your theme's functions.php file.

    function add_manage_emails_cap() {
    	// The user you want to grant the capability to
    	$user_id = 2;
    	$user = new WP_User( $user_id );
    	$user->add_cap( 'manage_subscribe_by_email' );
    add_action( 'init', 'add_manage_emails_cap' );

    with $user_id of your choice in this example it's user with an ID of 2.

    Let me know if it works for you.
    Have a good day,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.