Tarea #978 -> Fallan los envíos de los emails.

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@102 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-10 10:36:55 +00:00
parent b8bcb094e0
commit a1820805ab
2 changed files with 9 additions and 11 deletions

View File

@ -127,7 +127,8 @@ function bp_dedication_create_new_dedication() {
if (count($friend_ids) > 1) {
$friend_info = get_userdata($friend_ids[1]);
add_post_meta($post_id, 'ghostpool_destination_user_id', $friend_info->ID);
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
$friend_email = $friend_info->user_email;
}
if (isset($friend_email) && (is_email($friend_email))) {
@ -178,7 +179,7 @@ function bp_dedication_create_new_dedication() {
/*$user_id = $bp->loggedin_user->id;
$user_link = bp_core_get_userlink($user_id);*/
do_action( 'bp_dedication_create_new_dedication', $post_id, $friend_info->ID, $bp->loggedin_user->id);
do_action( 'bp_dedication_create_new_dedication', $post_id, $friend_email, $bp->loggedin_user->id);
return true;
}

View File

@ -1,19 +1,17 @@
<?php
function bp_dedication_send_dedication_notification( $post_id, $to_user_id, $from_user_id ) {
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_name = bp_core_get_user_displayname( $from_user_id, false );
$reciever_name = bp_core_get_user_displayname( $to_user_id, false );
//$reciever_name = bp_core_get_user_displayname( $to_user_id, false );
/* Get the userdata for the reciever and sender, this will include usernames and emails that we need. */
$reciever_ud = get_userdata( $to_user_id );
$sender_ud = get_userdata( $from_user_id );
/* Get the userdata for the sender. */
//$sender_ud = get_userdata( $from_user_id );
/* 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);
$sender_new_dedication_link = bp_core_get_userlink($to_user_id, false, true) . $bp->dedications->slug . '/new-dedication/user/' . $from_user_id;
//$sender_profile_link = bp_core_get_userlink($from_user_id, false, true);
$enc_link = bp_dedication_encode(get_permalink($post_id));
@ -21,7 +19,6 @@ function bp_dedication_send_dedication_notification( $post_id, $to_user_id, $fro
$post_link = add_query_arg('refid', $enc_link, $post_link);
/* Set up and send the message */
$to = $reciever_ud->user_email;
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s dedicated a song 2 u!', 'bp-dedication' ), stripslashes($sender_name) );
$message = sprintf( __(
@ -35,7 +32,7 @@ To see %s\'s dedication: %s
//$message .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'bp-example' ), $reciever_settings_link );
// Send it!
wp_mail( $to, $subject, $message );
$result = wp_mail( $to_user_email, $subject, $message );
}
add_action( 'bp_dedication_create_new_dedication', 'bp_dedication_send_dedication_notification', 10, 3 );