- Cambios para optimizar el uso de memoria

- Cambios en el envio del email de la dedicatoria para evitar que cuente como SPAM

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@187 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-10-17 17:49:22 +00:00
parent fe80a2a007
commit 48ccd06dcf
8 changed files with 406 additions and 351 deletions

View File

@ -34,23 +34,28 @@ function bp_dedication_send_dedication_notification( $post_id, $to_user_email, $
$post_link = add_query_arg('y', '1', $post_link);
}
//$post_link = bp_dedication_getTinyUrl($post_link);
/* Set up and send the message */
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s has dedicated a song 2u!', 'bp-dedication' ), stripslashes($sender_name) );
$subject = get_blog_option( 1, 'blogname' ) . '. ' . sprintf( __( '%s has dedicated a song 2u', 'bp-dedication' ), stripslashes($sender_name) );
$message = sprintf( __(
'%s (%s) has sent you a dedication!
//create a boundary for the email. This
//$boundary = uniqid('np');
To see %s\'s dedication: %s
// headers - specify your from email address and name here
// and specify the boundary for the email
//$headers = "MIME-Version: 1.0\r\n";
//$headers .= "From: asong2u \r\n";
//$headers .= "To: ".$to_user_email."\r\n";
//$headers .= "Content-Type: text/html";
//$headers .= "Content-Type: multipart/alternative; boundary=" . $boundary . "\r\n";
---------------------
', 'bp-dedication' ), $sender_name, $sender_username, $sender_username, $post_link );
ob_start();
include(TEMPLATEPATH . '/_mails/mail_new_dedication.php');
$message = ob_get_contents();
ob_end_clean();
//$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 );
$result = wp_mail($to_user_email, $subject, $message, $headers);
}
add_action( 'bp_dedication_create_new_dedication', 'bp_dedication_send_dedication_notification', 10, 3 );

View File

@ -0,0 +1,11 @@
<?php echo "
<p><a href='$post_link'>$sender_name ($sender_username) has sent you a dedication.</a></p>
<h3>How to dedicate a song</h3>
<p>It's very easy. You only have to follow a few steps and in seconds you will have your video ready to send. You also have a tutorial that will show you how to do it, just in case.<br>
<p>All dedications go into our main page. Why? Because this is a site for everyone around the world. People will be sharing those magic moments with everybody else in different countries.<br>
<p>You also have the opportunity when you dedicate a song, to make it private and only that person will have the access to your dedication. Then, only you and him/her will be able to see it.<br>
<p>Try to send a video song of your favorite bands official video, in concert etc, instead of the cover, so everyone can enjoy them. We know, sometimes it's hard to find them and you only get to find the cover or a photograph.<br>
<p>But if you waste a little time trying to find it, your friends will appreciate it. It`s a little boring to watch a photograph for more than three minutes, so try to avoid it. We are sure everybody will appreciate it.</p>
<hr/>
<p>This email was sent by: <a href='http://www.asong2u.com/'>asong2u.com</a></p>
"; ?>

View File

@ -52,7 +52,6 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
</div>
<?php endforeach; ?>
<?php $from_dedications = NULL; ?>
<?php wp_reset_postdata(); ?>

View File

@ -51,7 +51,6 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
</div>
<?php endforeach; ?>
<?php $from_dedications = NULL; ?>
<?php wp_reset_postdata(); ?>

View File

@ -824,15 +824,16 @@ function gp_get_unread_dedications() {
}
function set_from_email($email) {
/*$new_email = $email;
if ($email == 'noreply@asong2u.com') :*/
$new_email = 'asong2u@asong2u.com';
//endif;
return $new_email;
return 'asong2u@asong2u.com';
}
add_filter('wp_mail_from', 'set_from_email');
function set_mail_content_type() {
return "text/html";
}
add_filter ("wp_mail_content_type", "set_mail_content_type");
remove_action( 'login_head', 'wp_no_robots', 10 );
?>

View File

@ -7,6 +7,44 @@ get_currentuserinfo();
?>
<?php
//$args = "cat=".$gp_settings['cats']."&caller_get_posts=1&orderby=$orderby&order=$order&gdsr_sort=$gdsr_sort&gdsr_order=$gdsr_order&paged=$paged&posts_per_page=-1";
/*
$args = array(
"cat" => $gp_settings['cats'],
"ignore_sticky_posts" => 1,
"orderby" => $orderby,
"order" => $order,
"paged" => $paged,
"posts_per_page" => -1
);
query_posts($args);
$urls_video = array();
$ids_descartados = array();
if (have_posts()) :
while (have_posts()) :
the_post();
include('loop-dedication-data.php');
// Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') {
if (($current_user->ID != $gp_settings['from_user_id']) && ($current_user->ID != $gp_settings['to_user_id'])) {
$ids_descartados[] = $post->ID;
}
}
if ($theme_homepage_not_repeat_videos) {
// Si la URL del video ya ha salido en una dedicatoria anterior, me la salto
if (in_array($gp_settings['video'], $urls_video)) {
$ids_descartados[] = $post->ID;
}
}
$urls_video[] = $gp_settings['video'];
endwhile;
endif;*/
$orderby = 'rand';
$args = array(
"cat" => $gp_settings['cats'],

View File

@ -44,9 +44,10 @@ function gp_ajax_video_data() {
$args = array(
'post_type' => array('post'),
'orderby' => $dedication_orderby,
'posts_per_page' => 10,
'numberposts' => 10,
'post_status' => $post_status,
'category_name' => $category_name,
'offset' => 1,
);
}
$array = array();

View File

@ -20,7 +20,8 @@ if ($_ishome || ( $bp->current_component == BP_DEDICATION_SLUG )) {
$args = array(
'post_type' => array('post'),
'orderby' => $dedication_orderby,
'posts_per_page' => -1,
//'posts_per_page' => -1,
'numberposts' => 5,
'post_status' => $post_status,
'category_name' => $category_name,
);