Skip to:
Content
Pages
Categories
Search
Top
Bottom

Second(ary) activity feed possible?


  • t.schwarz
    Participant

    @tschwarz-1

    Hi,

    I’m trying to show a part of the activtiy feed (entries categorized as “tips” with feed meta category) on a different page than the standard activity page. Using the activity loop in a custom page template it’s easy to display the restricted activities on a standard WP page.

    However, as the standard WordPress page is not a registered BuddyPress page none of the Buddypress CSS classes and Javascript is loaded, which means that the custom loop looks pretty bad and is largely non-functional.

    So far I’ve come up with two ideas about how to solve this:

    1) using different feed templates on the standard activity feed page and indicate which one to use by adding a variable in the URL – this approach runs into problems because the standard feed is loaded by Admin-Ajax and there’s no apparent way to add an additional URL induced context variable to the ajax query – or is there?

    2) turning the standard WordPress page into a BuddyPress page (so the activity JS and CSS is loaded). I’ve been thinking about actually comparing loaded scripts and manually enqueuing them for the new page-template, but I wonder if there is not a much simpler solution.

    I’ve tried ideas like this “prehistoric” one, but they don’t appear to work anymore – https://buddypress.org/support/topic/make-your-own-custom-buddypress-page/page/2/

    Is there a modern equivalent to this?

    Should I maybe approach this completely differently?

    Thanks for any help!

Viewing 6 replies - 1 through 6 (of 6 total)

  • t.schwarz
    Participant

    @tschwarz-1

    In case anyone is interested, this is how I solved it:

    Using the first route, I needed to get the $_GET in Javascript and then add it to the bp.nouveau.requestObject when the variable is present. That way the variable is included in the ajax $_POST using the activity-loop template. Then I can simply query for the meta value and only show activities that have the specified value.


    shanebp
    Moderator

    @shanebp

    An easier approach is to simply overload the activities loop template in your theme or child-theme.
    In that template, add whatever code you need gather the ids you want to use.
    for example, untested:

    $ids = an array of activity ids that you want to include. 
    $ids = a csv string from imploding $ids
    <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&include=$ids' ) ) : ?>

    t.schwarz
    Participant

    @tschwarz-1

    Thanks for the reply @shanebp and the idea – but how would I determine whether to show only the filtered IDs or the entire list? I’d still need that info (the GET variable in my approach) to switch between the two bp_ajax_querystrings, wouldn’t I?


    shanebp
    Moderator

    @shanebp

    If you are using a separate page, just check for the page slug.


    semih2400
    Participant

    @semih2400

    Hi, I have similar problem. I want to use my own activity loop on different page. This page is template for my custom post type. I created it php that named as ‘single-{mytype}.php’. I can use my own activity loop inside of this page but there is some wird behaviours. For example comment, favourite or delete buttons not seem properly also I think ajax/js doesnt work properly.
    I have used like this:

      <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&action=new_quote' ) ) : ?>
        <?php while ( bp_activities() ) : bp_the_activity(); ?>
     
    	<?php bp_get_template_part( 'activity/entry' ); ?>
    				
        <?php endwhile; ?>
    <?php endif; ?>

    Ben Roberts
    Participant

    @bouncingsprout

    New plugin just released may help: https://wordpress.org/plugins/activity-feed-anywhere/. It’s VERY new, so please leave any feedback/bug reports in the support forums.

    Ben R

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar