<?php 
if (bp_has_activities(bp_ajax_querystring('activity'))) {
    ?>

	<?php 
    /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */
    ?>
	<noscript>
		<div class="pagination">
			<div class="pag-count"><?php 
    bp_activity_pagination_count();
    ?>
</div>
			<div class="pagination-links"><?php 
    bp_activity_pagination_links();
    ?>
</div>
		</div>
	</noscript>

	<?php 
    if (empty($_POST['page'])) {
        ?>

		<ul id="activity-stream" class="activity-list item-list">

	<?php 
    }
    ?>
function bp_swa_list_activities($per_page = 10, $page = 1, $scope = '', $max = 200, $show_avatar = "yes", $show_filters = "yes", $included = false, $excluded = false, $is_personal = "no", $is_blog_admin_activity = "no", $show_post_form = "no")
{
    //check for the scope of activity
    //is it the activity of logged in user/blog admin
    //logged in user over rides blog admin
    global $bp;
    $primary_id = '';
    if (bp_is_group()) {
        $primary_id = null;
    }
    $user_id = "";
    //for limiting to users
    if ($is_personal == "yes") {
        $user_id = $bp->loggedin_user->id;
    } else {
        if ($is_blog_admin_activity == "yes") {
            $user_id = swa_get_blog_admin_id();
        } else {
            if (bp_is_user()) {
                $user_id = null;
            }
        }
    }
    $components_scope = swa_get_base_component_scope($included, $excluded);
    $components_base_scope = "";
    if (!empty($components_scope)) {
        $components_base_scope = join(",", $components_scope);
    }
    ?>
      <div class='swa-wrap block1'>
          <?php 
    if (is_user_logged_in() && $show_post_form == "yes") {
        swa_show_post_form();
    }
    ?>
          <?php 
    if ($show_filters == "yes") {
        ?>
			<ul id="activity-filter-links">
				<?php 
        swa_activity_filter_links("scope=" . $scope . "&include=" . $included . "&exclude=" . $excluded);
        ?>
			</ul>
          <div class="clear"></div>
                    <?php 
    }
    ?>
        <?php 
    if (bp_has_activities('type=sitewide&max=' . $max . '&page=' . $page . '&per_page=' . $per_page . '&object=' . $scope . "&user_id=" . $user_id . "&primary_id=" . $primary_id)) {
        ?>

            <div class="swa-pagination ">
                    <div class="pag-count" id="activity-count">
                            <?php 
        bp_activity_pagination_count();
        ?>
                    </div>

                    <div class="pagination-links" id="activity-pag">
                            &nbsp; <?php 
        bp_activity_pagination_links();
        ?>
                    </div>
                <div class="clear" ></div>
            </div>


            <div class="clear" ></div>
                <ul  class="site-wide-stream swa-activity-list">
                    <?php 
        while (bp_activities()) {
            bp_the_activity();
            ?>
                        <?php 
            swa_activity_entry($show_avatar);
            ?>
                    <?php 
        }
        ?>
               </ul>

	<?php 
    } else {
        ?>

        <div class="widget-error">
            <?php 
        if ($is_personal == "yes") {
            $error = sprintf(__("You have no recent %s activity.", "swa"), $scope);
        } else {
            $error = __('There has been no recent site activity.', 'swa');
        }
        ?>
                <?php 
        echo $error;
        ?>
        </div>
	<?php 
    }
    ?>
     </div>
     
<?php 
}
Esempio n. 3
0
<?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_activity_loop() */ ?>

<?php do_action( 'bp_before_activity_loop' ) ?>

<?php global $bp;
if ( bp_is_active("activity")&&bp_has_activities( "action=gallery_new_comment&show_hidden=1&secondary_id=".$bp->gallery->current_gallery->id ) ) : ?>


	<?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?>
	<noscript>
		<div class="pagination">
			<div class="pag-count"><?php bp_activity_pagination_count() ?></div>
			<div class="pagination-links"><?php bp_activity_pagination_links() ?></div>
		</div>
	</noscript>
<?php if ( is_user_logged_in() ) : ?>
				<?php locate_template( array( 'gallery/single/media/post-form.php'), true ) ?>
			<?php endif; ?>
	<?php if ( empty( $_POST['page'] ) ) : ?>
		<ul id="activity-stream" class="activity-list item-list">
	<?php endif; ?>

	<?php while ( bp_activities() ) : bp_the_activity(); ?>

		<?php include( locate_template( array( 'activity/entry.php' ), false ) ) ?>

	<?php endwhile; ?>

	<?php if ( bp_get_activity_count() == bp_get_activity_per_page() ) : ?>
		<li class="load-more">
			<a href="#more"><?php _e( 'Load More', 'buddypress' ) ?></a> &nbsp; <span class="ajax-loader"></span>
    public function generate_activity_stream($atts, $content = null)
    {
        //allow to use all those args awesome!
        $atts = shortcode_atts(array('title' => 'Latest Activity', 'pagination' => 'true', 'display_comments' => 'threaded', 'include' => false, 'exclude' => false, 'in' => false, 'sort' => 'DESC', 'page' => 1, 'per_page' => 5, 'max' => false, 'scope' => false, 'user_id' => false, 'object' => false, 'action' => false, 'primary_id' => false, 'secondary_id' => false, 'search_terms' => false, 'use_compat' => bp_use_theme_compat_with_current_theme(), 'allow_posting' => false), $atts);
        extract($atts);
        //hide on user activity, activity directory and group activity
        if (is_user_logged_in() && (function_exists('bp_is_activity_component') && bp_is_activity_component() || function_exists('bp_is_group_home') && bp_is_group_home())) {
            return '';
        }
        ob_start();
        ?>
	
    <?php 
        if ($use_compat) {
            ?>
        <div id="buddypress">
    <?php 
        }
        ?>
		
	<?php 
        if ($title) {
            ?>
            <h3 class="activity-shortcode-title"><?php 
            echo $title;
            ?>
</h3>
        <?php 
        }
        ?>
    
		
        <?php 
        do_action('bp_before_activity_loop');
        ?>
			
		<?php 
        if ($allow_posting && is_user_logged_in()) {
            ?>

			<?php 
            bp_locate_template(array('activity/post-form.php'), true);
            ?>

		<?php 
        }
        ?>
			
        <?php 
        if (bp_has_activities($atts)) {
            ?>
            <div class="activity <?php 
            if (!$display_comments) {
                ?>
 hide-activity-comments<?php 
            }
            ?>
 shortcode-activity-stream">

                 <?php 
            if (empty($_POST['page'])) {
                ?>

                    <ul id="activity-stream" class="activity-list item-list">

                 <?php 
            }
            ?>

                 <?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

                    <?php 
                bp_get_template_part('activity/entry');
                ?>

                 <?php 
            }
            ?>

                 <?php 
            if (empty($_POST['page'])) {
                ?>
                    </ul>
                 <?php 
            }
            ?>
                
                <?php 
            if ($pagination) {
                ?>
                    <div class="pagination">
                        <div class="pag-count"><?php 
                bp_activity_pagination_count();
                ?>
</div>
                        <div class="pagination-links"><?php 
                bp_activity_pagination_links();
                ?>
</div>
                    </div>
                <?php 
            }
            ?>
            </div>

	
	<?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 
        }
        ?>
            
    <?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>
     <?php 
        if ($use_compat) {
            ?>
       
        </div>
     <?php 
        }
        ?>
    <?php 
        $output = ob_get_clean();
        return $output;
    }