Advertisement
Guest User

members-loop.php

a guest
Mar 27th, 2015
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. <?php
  2. $current_time = current_time( 'mysql', 1 );
  3.  
  4. function online_check( $current_time ) {
  5. global $members_template;
  6.  
  7. if ( isset( $members_template->member->last_activity ) ) {
  8.  
  9. $diff = strtotime( $current_time ) - strtotime( $members_template->member->last_activity );
  10.  
  11. if ( $diff < 300 ) // 5 minutes = 5 * 60
  12. echo "<div class=\"online-list\">";
  13. echo "Online: <i class=\"fa fa-wifi\"></i>";
  14. echo "</div>";
  15. }
  16. else{
  17. echo "<div class=\"offline-list\">";
  18. echo "Offline: <i class=\"fa fa-wifi\"></i>";
  19. echo "</div>";
  20.  
  21. }
  22. }
  23. /**
  24. * BuddyPress - Members Loop
  25. *
  26. * Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
  27. *
  28. * @package BuddyPress
  29. * @subpackage bp-legacy
  30. */
  31.  
  32. ?>
  33.  
  34. <?php do_action( 'bp_before_members_loop' ); ?>
  35.  
  36. <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
  37.  
  38. <div id="pag-top" class="pagination">
  39.  
  40. <div class="pag-count" id="member-dir-count-top">
  41.  
  42. <?php bp_members_pagination_count(); ?>
  43.  
  44. </div>
  45.  
  46. <div class="pagination-links" id="member-dir-pag-top">
  47.  
  48. <?php bp_members_pagination_links(); ?>
  49.  
  50. </div>
  51.  
  52. </div>
  53.  
  54. <?php do_action( 'bp_before_directory_members_list' ); ?>
  55.  
  56. <ul id="members-list" class="item-list" role="main">
  57.  
  58. <?php while ( bp_members() ) : bp_the_member(); ?>
  59.  
  60. <li>
  61. <div class="item-avatar">
  62. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
  63. <?php online_check( $current_time ); ?>
  64. </div>
  65.  
  66. <div class="item">
  67. <div class="item-title">
  68. <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
  69.  
  70. <?php if ( bp_get_member_latest_update() ) : ?>
  71.  
  72. <span class="update"> <?php bp_member_latest_update(); ?></span>
  73.  
  74. <?php endif; ?>
  75.  
  76. </div>
  77.  
  78. <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
  79.  
  80. <?php do_action( 'bp_directory_members_item' ); ?>
  81.  
  82. <?php
  83. /***
  84. * If you want to show specific profile fields here you can,
  85. * but it'll add an extra query for each member in the loop
  86. * (only one regardless of the number of fields you show):
  87. *
  88. * bp_member_profile_data( 'field=the field name' );
  89. */
  90. ?>
  91. </div>
  92.  
  93. <div class="action">
  94.  
  95. <?php do_action( 'bp_directory_members_actions' ); ?>
  96.  
  97. </div>
  98.  
  99. <div class="clear"></div>
  100. </li>
  101.  
  102. <?php endwhile; ?>
  103.  
  104. </ul>
  105.  
  106. <?php do_action( 'bp_after_directory_members_list' ); ?>
  107.  
  108. <?php bp_member_hidden_fields(); ?>
  109.  
  110. <div id="pag-bottom" class="pagination">
  111.  
  112. <div class="pag-count" id="member-dir-count-bottom">
  113.  
  114. <?php bp_members_pagination_count(); ?>
  115.  
  116. </div>
  117.  
  118. <div class="pagination-links" id="member-dir-pag-bottom">
  119.  
  120. <?php bp_members_pagination_links(); ?>
  121.  
  122. </div>
  123.  
  124. </div>
  125.  
  126. <?php else: ?>
  127.  
  128. <div id="message" class="info">
  129. <p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
  130. </div>
  131.  
  132. <?php endif; ?>
  133.  
  134. <?php do_action( 'bp_after_members_loop' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement