Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP loop not filtering on “load more”


  • pravdamien
    Participant

    @pravdamien

    HELP !

    Inside my theme (a child of the One community theme, I built page with custom loop showing only status updates (in order to have seperate “Status updates” and “group updates” links in my main menu).

    The object filtering works fine on first load, but when scrolling down to the read more, the loop then loads all Bp activity instead of applying my object filter.

    Any idea what i might be doing wrong ?

    Here is my custom-activity-loop.php :

    
    
    <?php do_action( 'bp_before_activity_loop' ); ?>
    
    <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&object=activity' ) ) : ?>
    <?php /* if ( bp_has_activities( 'action=joined_group' ) ) :*/?>
    
    	<?php if ( empty( $_POST['page'] ) ) : ?>
    
    		<ul id="activity-stream" class="activity-list item-list">
    
    	<?php endif; ?>
    
    	<?php while ( bp_activities() ) : bp_the_activity(); ?>
    
    		<?php locate_template( array( 'activity/entry.php' ), true, false ); ?>
    
    	<?php endwhile; ?>
    
    	<?php if ( bp_activity_has_more_items() ) : ?>
    
    		<li class="load-more">
    			<a href="<?php bp_activity_load_more_link() ?>"><?php _e( 'Load More', 'buddypress' ); ?></a>
    		</li>
    
    	<?php endif; ?>
    
    	<?php if ( empty( $_POST['page'] ) ) : ?>
    
    		</ul>
    
    	<?php endif; ?>
    
    <?php else : ?>
    
    	<div id="message" class="info">
    		<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ); ?></p>
    	</div>
    
    <?php endif; ?>
    
    <?php do_action( 'bp_after_activity_loop' ); ?>
    
    <form action="" name="activity-loop-form" id="activity-loop-form" method="post">
    
    	<?php wp_nonce_field( 'activity_filter', '_wpnonce_activity_filter' ); ?>
    
    </form>
Viewing 5 replies - 1 through 5 (of 5 total)

  • pravdamien
    Participant

    @pravdamien

    update : from what i understand, the way the read more link works is it fetches my basic activity-loop.php template:

    `function bp_get_activity_load_more_link() {
    global $activities_template;

    $url = bp_get_requested_url();
    $link = add_query_arg( $activities_template->pag_arg, $activities_template->pag_page + 1, $url );

    /**
    * Filters the Load More link URL.
    *
    * @since 2.1.0
    *
    * @param string $link The “Load More” link URL with appropriate query args.
    * @param string $url The original URL.
    * @param object $activities_template The activity template loop global.
    */
    return apply_filters( ‘bp_get_activity_load_more_link’, $link, $url, $activities_template );
    }
    `

    so how can I have one loop with a read more returning only status updates, and another returning group activity ???


    shanebp
    Moderator

    @shanebp

    Try changing '&object=activity' to '&action=activity_update'


    pravdamien
    Participant

    @pravdamien

    That helps, but only fixes 80% of the problem.

    Instead of first loading only status updates (20 in the loop), then loading all bp activity upon “load more”, it now first loads only status updates, then a loop of 20 items of all bp activity, then continuous loops of 20 activity updates at a time.

    So it basically works, then forgets to work for one loop, then works again until the end. HOW is that even remotely possible ? (sooo frustrating)


    pravdamien
    Participant

    @pravdamien

    Ok, slipped in a reset query and now seems to be working. Thank you.


    pravdamien
    Participant

    @pravdamien

    However, my true issue was that i wanted one activity stream with ONLY MY GROUPS activity, and another with all other activities, excluding group contents, event the public ones (so, including profile updates, group joined, group created, docs created etc etc).

    Should i now do that by combining actions ? Can you please point me in the right direction ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘BP loop not filtering on “load more”’ is closed to new replies.
Skip to toolbar