Tarea #1080 -> No se descuenta bien el nº de dedicatorias sin mirar

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@180 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-09-19 18:41:12 +00:00
parent 6e56cdc433
commit bf26dd8ad6
2 changed files with 23 additions and 2 deletions

View File

@ -802,6 +802,27 @@ function gp_get_total_unread_dedications() {
else return 0;
}
function gp_get_unread_dedications() {
$result = array();
if(is_user_logged_in()) {
$user_id = mar_get_user_id();
$read_ids = mar_get_user_read_posts( $user_id );
$args = array(
'exclude' => $read_ids,
'numberposts' => -1,
'cat' => DEDICATION_CATEGORY_SLUG,
'meta_key' => 'ghostpool_destination_user_id',
'meta_value' => $user_id
);
$unread_posts = get_posts( $args );
foreach ($unread_posts as $unread) {
$result[] = $unread->ID;
}
}
return $result;
}
function set_from_email($email) {
/*$new_email = $email;
if ($email == 'noreply@asong2u.com') :*/

View File

@ -61,9 +61,9 @@ if ($gp_settings['from_user_id'] == mar_get_user_id()) :
$mark_as_read = mar_add_to_usermeta($post->ID);
$update_count = mar_increase_count($post->ID);
endif;
$read_posts = mar_get_user_read_posts( mar_get_user_id() );
$gp_settings['unreaded'] = (!in_array($post->ID, $read_posts));
$read_posts = gp_get_unread_dedications( mar_get_user_id() );
$gp_settings['unreaded'] = (in_array($post->ID, $read_posts));
// to user
$gp_settings['to_user_id'] = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);