Turn off email notifications


Home Forums Front End PM PRO Turn off email notifications

This topic is: Not Resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41826
    aless.napoletani
    Participant

    I’d like to turn off the email notification for when you receive a new message.

    Can I do this site wide with some code in the functions.php file?

    #41834
    shamim
    Keymaster

    You can go to Dashboard > Front End PM PRO > Settings > Emails and empty email subjects, That will do the trick.
    Let me know.

    #42045
    aless.napoletani
    Participant

    Thank you – that has worked.

    Is there a way to enable email notifications for certain roles?

    #42052
    shamim
    Keymaster

    Yes, possible. In that case fill out subject in settings and add following code in functions.php

    add_filter('fep_get_user_option', function( $value, $option, $default, $userid, $is_default ){
        if( 'allow_emails' !== $option ){
            return $value;
        }
        if( fep_is_user_admin() ){
            $value = true;
        } else {
            $value = false;
        }
        return $value;
    }, 10, 5);
    

    This will send notification only to admins.

    #42613
    aless.napoletani
    Participant

    Hi Shamim,

    I’ve added that function, I had to amend it as I only want users within a particular role to receive email notifications:

    // Allow Frontend PM Admin (frontend_pm_admin) to receive email notifications from Front End PM PRO
    add_filter('fep_get_user_option', function( $value, $option, $default, $userid, $is_default ){
        if( 'allow_emails' !== $option ){
            return $value;
        }
        $user = wp_get_current_user();
    	if ( in_array( 'frontend_pm_admin', (array) $user->roles ) ) {
            $value = true;
        } else {
            $value = false;
        }
        return $value;
    }, 10, 5);
    

    But now, it only sends if BOTH the users are in this ‘frontend_pm_admin’ role. If the user sending the message is a normal user, then the notification doesn’t happen. It only happens if BOTH users are in the ‘frontend_pm_admin’ role.

    Is there a way to only allow notifications for this ‘frontend_pm_admin’ role please?

    #42619
    shamim
    Keymaster

    instead of $user = wp_get_current_user(); use $user = get_userdata( $userid );

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

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.