Powered By Blogger

Sunday, May 21, 2017

use user activity in custom template in buddypress

<?php

 if($memberId == get_current_user_id()) {
locate_template( 'buddypress/activity/index.php',true );
}

?>





<?php
do_action( 'bp_before_directory_activity' );
do_action( 'bp_before_directory_activity_content' );
do_action( 'template_notices' );
?>
<?php if ( is_user_logged_in() ) : ?>
<?php if(bp_displayed_user_id() == get_current_user_id()){ ?>
<?php bp_get_template_part( 'buddypress/activity/post-form' ); ?>
<?php } ?>
<?php endif; ?>



<?php
global $wpdb;
$userIdd = bp_loggedin_user_id();
$sql = "SELECT leader_id FROM sf_bp_follow WHERE follower_id=$userIdd";
$followers = $wpdb->get_col( $sql );
$friends_and_me =  '&user_id=' . $followers;
$followers = array_unique($followers);
$followers[] = bp_loggedin_user_id();
$friends_and_me = implode( ',', (array) $followers );
$friends_and_me =  '&user_id=' . $friends_and_me;
?>

<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . $friends_and_me) ) :  ?>

<?php //if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?>
   <?php while ( bp_activities() ) : bp_the_activity(); ?>

       <?php locate_template( array( 'buddypress/activity/entry.php' ), true, false ); ?>

   <?php endwhile; ?>
<?php endif; ?>

<?php

/**
* Fires after the display of the activity list.
*
* @since 1.5.0
*/
do_action( 'bp_after_directory_activity_list' ); ?>

<?php

/**
* Fires inside and displays the activity directory display content.
*/
do_action( 'bp_directory_activity_content' ); ?>

<?php

/**
* Fires after the activity directory display content.
*
* @since 1.2.0
*/
do_action( 'bp_after_directory_activity_content' ); ?>

<?php

/**
* Fires after the activity directory listing.
*
* @since 1.5.0
*/
do_action( 'bp_after_directory_activity' ); ?>


No comments:

Post a Comment