Home › Forums › Front End PM PRO › Turn off email notifications
- This topic has 6 replies, 2 voices, and was last updated 4 years, 9 months ago by aless.napoletani.
- AuthorPosts
- November 19, 2020 at 8:41 pm #41826aless.napoletaniParticipant
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?
November 19, 2020 at 11:23 pm #41834Shamim HasanKeymasterYou can go to Dashboard > Front End PM PRO > Settings > Emails and empty email subjects, That will do the trick.
Let me know.December 14, 2020 at 6:07 pm #42045aless.napoletaniParticipantThank you – that has worked.
Is there a way to enable email notifications for certain roles?
December 15, 2020 at 10:33 am #42052Shamim HasanKeymasterYes, 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.
March 2, 2021 at 4:05 pm #42613aless.napoletaniParticipantHi 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?
March 2, 2021 at 9:24 pm #42619Shamim HasanKeymasterinstead of
$user = wp_get_current_user();use$user = get_userdata( $userid );March 3, 2021 at 3:15 pm #42625aless.napoletaniParticipantThank you – that’s worked perfectly.
- AuthorPosts
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.