anonymized-13749270
(@anonymized-13749270)
Dear Javier,
Love this plugin as well. It is quite nice and simple, so is the design, and it does what it says.
To achieve this little feature, there are so many workarounds to emit the email notification upon friend request is sent, try this:
add_action("updated_user_meta", function( $meta_id, $user_id, $meta_key, $meta_value ) {
if ( "request_list" == $meta_key && isset($_POST['request']) ) {
if ( !function_exists('bbp_get_displayed_user_id') || !bbp_get_displayed_user_id() ) return;
// the user whom profile is being viewed (so added as friend)
$added_user = get_userdata( bbp_get_displayed_user_id() );
// current user
global $current_user;
// send the email
wp_mail(
$added_user->user_email,
sprintf(
"%s has sent you a friendship request on %s!",
$current_user->display_name,
get_bloginfo('name')
),
sprintf(
"Dear %s,\n\n%s has just sent you a friendship request through your bbPress Profile!\n\nKindly login and visit your profile to accept or decline this request:\n%s\n\nYours,\nJavier.",
$added_user->display_name,
$current_user->display_name,
home_url( bbp_get_user_slug() . '/' . $added_user->user_nicename . '/' )
)
);
} return;
}, 0, 4);
Add that code to your child theme’s functions file, or with a custom plugin.
I did not test it quite well, hope it works somehow.
Samuel
-
This reply was modified 9 years, 7 months ago by
anonymized-13749270.