Tareas #971 -> En el perfil, cargar dedicatorias de las columnas sin cargar otra página

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@88 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-08 18:43:53 +00:00
parent 41d53975c7
commit bbb35ec2e6
8 changed files with 91 additions and 146 deletions

View File

@ -1,44 +1,25 @@
<?php
global $bp, $post, $gp_settings;
global $bp, $post, $gp_settings, $paged;
require(ghostpool_inc . 'options.php');
$dedications = bp_dedication_get_dedications_to_user( $bp->displayed_user->id );
$user_id = $bp->displayed_user->id;
$args = $GLOBALS['wp_query']->query;
$args['ignore_sticky_posts'] = 1;
$args['orderby'] = $orderby;
$args['order'] = $order;
$args['paged'] = $paged;
$args['post_status'] = $post_status;
$args['posts_per_page'] = 3; //$gp_settings['posts_per_page'];
$args['category'] = get_cat_id('dedication');
$args['meta_key'] = 'ghostpool_destination_user_id';
$args['meta_value'] = $user_id;
query_posts($args);
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
include(dirname(__FILE__).'/../../post-loop-dedication-template.php');
?>
<?php foreach ($dedications as $post) : ?>
<?php setup_postdata($post); ?>
<?php
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
?>
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
<div <?php post_class('post-loop'); ?>>
<!--Begin Image-->
<?php if (has_post_thumbnail()) { ?>
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else {
echo get_the_title();
} ?>" />
</a>
</div>
<?php } ?>
<!--End Image-->
<!--Begin Post Text-->
<div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>
<!--End Post Text-->
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>

View File

@ -3,8 +3,7 @@ global $bp, $post, $gp_settings;
require(ghostpool_inc . 'options.php');
$from_dedications = bp_dedication_get_dedications_to_user($bp->displayed_user->id);
$count = 0;
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/dedicated-2u/';
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/dedicated-2u/page/2/';
?>
<h4><?php _e('Dedicatited 2 me'); ?></h4>
<?php foreach ($from_dedications as $post) :
@ -28,7 +27,7 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
<img src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else {
echo get_the_title();

View File

@ -3,7 +3,7 @@ global $bp, $post, $gp_settings;
require(ghostpool_inc . 'options.php');
$from_dedications = bp_dedication_get_dedications_from_user($bp->displayed_user->id);
$count = 0;
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/my-dedications/';
$dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) . $bp->dedications->slug . '/my-dedications/page/2/';
?>
<h4><?php _e('My dedications'); ?></h4>
<?php foreach ($from_dedications as $post) :
@ -11,6 +11,7 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
if ($count > 3) {?>
<a href="<?php echo $dedication_link; ?>" class="read-more" title="<?php _e('See More', 'gp_lang'); ?>"><?php _e('See More', 'gp_lang'); ?> &raquo;</a>
<?php break; } ?>
<?php setup_postdata($post); ?>
<?php
@ -26,7 +27,7 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
<img src="<?php echo $image['url']; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else {
echo get_the_title();
@ -39,7 +40,7 @@ $dedication_link = bp_core_get_userlink($bp->displayed_user->id, false, true) .
<!--Begin Post Text-->
<div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['to_flag']; ?>
<?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>
<!--End Post Text-->

View File

@ -1,8 +1,8 @@
<div class="columns two first text-left">
<div class="columns two first text-left home_column_my_dedications">
<?php include('home-column-my-dedications.php'); ?>
</div>
<div class="columns two last text-left">
<div class="columns two last text-left home_column_dedicated_2_me">
<?php include('home-column-dedicated-2-me.php'); ?>
</div>

View File

@ -1,45 +1,26 @@
<?php
global $bp, $post, $gp_settings;
global $bp, $post, $gp_settings, $paged;
require(ghostpool_inc . 'options.php');
$dedications = bp_dedication_get_dedications_from_user($bp->displayed_user->id);
$user_id = $bp->displayed_user->id;
$args = $GLOBALS['wp_query']->query;
$args['ignore_sticky_posts'] = 1;
$args['orderby'] = $orderby;
$args['order'] = $order;
$args['paged'] = $paged;
$args['post_status'] = $post_status;
$args['posts_per_page'] = 3; //$gp_settings['posts_per_page'];
$args['category'] = get_cat_id('dedication');
$args['author'] = $user_id;
query_posts($args);
_log($args);
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
include(dirname(__FILE__).'/../../post-loop-dedication-template.php');
?>
<?php foreach ($dedications as $post) : ?>
<?php setup_postdata($post); ?>
<?php
$gp_settings['thumbnail_width'] = $theme_cat_thumbnail_width;
$gp_settings['thumbnail_height'] = $theme_cat_thumbnail_height;
?>
<?php include(dirname(__FILE__).'/../../loop-dedication-data.php'); ?>
<div <?php post_class('post-loop'); ?>>
<!--Begin Image-->
<?php if (has_post_thumbnail()) { ?>
<div class="post-thumbnail<?php if ($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img src="<?php echo $image[url]; ?>" alt="<?php if (get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) {
echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
} else {
echo get_the_title();
} ?>" />
</a>
</div>
<?php } ?>
<!--End Image-->
<!--Begin Post Text-->
<div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['to_flag']; ?>
<span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>
<!--End Post Text-->
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>

View File

@ -717,8 +717,6 @@ function asociate_dedications_to_new_user($user_id) {
$category_name = 'dedication';
$post_status = array('publish', 'private');
_log('Email del usuario => ' . $user->user_email);
$args = array(
'post_type' => array('post'),
'posts_per_page' => -1,

View File

@ -47,6 +47,42 @@ jQuery(document).ready(function(){
});
});
});
jQuery('.my-account .dedication-profile .home_column_my_dedications a.read-more').live('click', function(e){
e.preventDefault();
link = jQuery(this).attr('href');
jQuery('.my-account .dedication-profile .home_column_my_dedications a.read-more').remove();
jQuery.get(link, function(data) {
var kids = jQuery(data).find('#content').children();
jQuery.each(kids, function(){
if (jQuery(this).hasClass('post-loop')) {
jQuery(this).removeClass();
jQuery(this).addClass('home-my-dedications post-loop');
}
jQuery('.my-account .dedication-profile .home_column_my_dedications').append(jQuery(this));
});
});
});
jQuery('.my-account .dedication-profile .home_column_dedicated_2_me a.read-more').live('click', function(e){
e.preventDefault();
link = jQuery(this).attr('href');
jQuery('.my-account .dedication-profile .home_column_dedicated_2_me a.read-more').remove();
jQuery.get(link, function(data) {
var kids = jQuery(data).find('#content').children();
jQuery.each(kids, function(){
if (jQuery(this).hasClass('post-loop')) {
jQuery(this).removeClass();
jQuery(this).addClass('home-dedicated-2-me post-loop');
}
jQuery('.my-account .dedication-profile .home_column_dedicated_2_me').append(jQuery(this));
});
});
});
});
var aIndex=-1;

View File

@ -19,7 +19,7 @@
<?php $post_status = 'publish'; ?>
<?php
$args = $GLOBALS['wp_query']->query;
$args['caller_get_posts'] = 1;
$args['ignore_sticky_posts'] = 1;
$args['orderby'] = $orderby;
$args['order'] = $order;
$args['gdsr_sort'] = $gdsr_sort;
@ -31,55 +31,4 @@
<?php query_posts($args); ?>
<div id="content" class="fullwidth<?php if($gp_settings['dropdown_filter'] == "0") { ?> shift-down<?php } ?>">
<?php if (have_posts()) : while (have_posts()) : the_post(); include('loop-dedication-data.php'); ?>
<?php
$displayed_id = bp_displayed_user_id();
// Usuario actual puede ver la dedicatoria?
if ($post->post_status == 'private') {
if (($displayed_id != $gp_settings['from_user_id']) && ($displayed_id != $gp_settings['to_user_id'])) {
continue; // me salto esta dedicatoria
}
}
$contador += 1;
?>
<div <?php post_class('post-loop'); ?>>
<!--Begin Image-->
<?php if(has_post_thumbnail()) { ?>
<div class="post-thumbnail<?php if($gp_settings['image_wrap'] == "Disable") { ?> thumbnail-no-wrap<?php } ?>">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php $image = vt_resize(get_post_thumbnail_id(), '', $gp_settings['image_width'], $gp_settings['image_height'], true); ?>
<img src="<?php echo $image[url]; ?>" alt="<?php if(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)) { echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); } else { echo get_the_title(); } ?>" />
</a>
</div>
<?php } ?>
<!--End Image-->
<!--Begin Post Text-->
<div class="post-text">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo $gp_settings['artist_song']; ?>"><?php echo $gp_settings['artist_song_span_short']; ?></a></h2>
<?php echo $gp_settings['from_flag']; ?><span>FROM: <?php echo $gp_settings['from_user_link']; ?></span>&nbsp;
<?php echo $gp_settings['to_flag']; ?><span>TO: <?php echo $gp_settings['to_user_link']; ?></span>
</div>
<!--End Post Text-->
</div>
<?php endwhile; ?>
<?php gp_pagination(); ?>
<?php if($gp_settings['dropdown_filter'] == "0") { require_once('dropdown-filter.php'); } ?>
<?php else : ?>
<h4><?php _e('Try searching for a different term.', 'gp_lang'); ?></h4>
<?php endif; wp_reset_query(); ?>
</div>
<?php include('post-loop-dedication-template.php'); ?>