git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@122 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
|
|
|
function bp_dedication_send_dedication_notification( $post_id, $to_user_email, $from_user_id ) {
|
|
global $bp;
|
|
|
|
/* Let's grab both user's names to use in the email. */
|
|
$sender_ud = get_userdata( $from_user_id );
|
|
|
|
|
|
$sender_username = $sender_ud->user_login;
|
|
$sender_name = bp_core_get_user_displayname( $sender_username );
|
|
//$reciever_name = bp_core_get_user_displayname( $to_user_id, false );
|
|
|
|
|
|
/* Now we need to construct the URL's that we are going to use in the email */
|
|
//$sender_profile_link = bp_core_get_userlink($from_user_id, false, true);
|
|
|
|
$enc_link = bp_dedication_encode(get_permalink($post_id));
|
|
|
|
$post_link = get_option('siteurl') . '/index.php';
|
|
$post_link = add_query_arg('refid', $enc_link, $post_link);
|
|
|
|
/* Set up and send the message */
|
|
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s dedicated a song 2 u!', 'bp-dedication' ), stripslashes($sender_name) );
|
|
|
|
$message = sprintf( __(
|
|
'%s (%s) sent you a dedication!
|
|
|
|
To see %s\'s dedication: %s
|
|
|
|
---------------------
|
|
', 'bp-dedication' ), $sender_name, $sender_username, $sender_username, $post_link );
|
|
|
|
//$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'bp-example' ), $reciever_settings_link );
|
|
|
|
// Send it!
|
|
$result = wp_mail( $to_user_email, $subject, $message );
|
|
}
|
|
add_action( 'bp_dedication_create_new_dedication', 'bp_dedication_send_dedication_notification', 10, 3 );
|
|
|
|
?>
|