• Resolved manuelseffe

    (@manuelseffe)


    I host multiple domains on my Cpanel now I want to use your `WebFacing – Email Accounts in cPanel? to fetch a particular set of emails for each admin user of these WordPress websites.

    for instance: domianA.com has [email protected] and [email protected]
    then domainB.com has [email protected] and [email protected]

    The current function for `WebFacing – Email Accounts in cPanel? is to enable admin users to have access to email addresses from the Cpanel.

    So, my question is can I fetch domainA.com emails only for the admin using domainA.com? likewise the same for domainB.com admin user.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Knut Sparhell

    (@knutsp)

    Yes, site administrators can manage all email addresses on the subsite domain (as defined as home_url seen on /wp-admin/network/sites.php), but not the ones belonging to other domains found in cPanel. Is this not working for you?

    Other users can manage their own (by user_email) if, and only if, they, or their role, has granted a custom capabilty “cpanel” (and their registered user_email is on site domain).

    Plugin Author Knut Sparhell

    (@knutsp)

    By “a particular set” do you mean limiting to certain email addresses, not all on domain, for Administrators?

    In that case such set has to be defined somewhere, and I may add a filter, passing back the site, in a soon upcoming development version, for you to test. Assuming you are able to add filters in another plugin or functions.php.

    Plugin Author Knut Sparhell

    (@knutsp)

    Please update to and test version 2.6.2-beta from development version

    Then add something like this in a plugin or functions.php:

    add_filter( 'wf_cpanel_email_site_admin_emails', function( array $allowed_emails, \WP_Site $site ) {
    	if ( $site->domain === 'domainb.com' ) {
    		$allowed_emails[] = '[email protected]';
    		$allowed_emails[] = '[email protected]';
    		$allowed_emails[] = '*@domainb.com';  // for default
    	}
    	return $allowed_emails;
    }, 10, 2 );
    • This reply was modified 2 years, 9 months ago by Knut Sparhell.
    Thread Starter manuelseffe

    (@manuelseffe)

    I just place the code with the development version yet I can still see other domain emails

    Plugin Author Knut Sparhell

    (@knutsp)

    It works here, so you must debug.

    Verify version 2.6.2-beta
    Verify being a site administrator user, not a Super Admin user
    Verify looking at page wp-admin/admin.php?page=wf-cpanel-email-accounts

    echo or var_dump some info inside your filter function, like $site->domain and return array $allowed_emails not being empty.

    Plugin Author Knut Sparhell

    (@knutsp)

    After some misunderstandings, I got it right, as this about single site installations (not a multisite, as I assumed).

    Please upgrade to version 2.7 or later and add this to you wp-config.php:
    define( 'WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY', true );

    Thanks for suggesting this, and many thanks for your patience. I close this as resolved. If any issues, please open a new thread.

    Plugin Author Knut Sparhell

    (@knutsp)

    As said.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fetch only a single set of Email Address’ is closed to new replies.