Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Get local members with bp-multi-network & Networks+ first-attempt*/
- /* On each Network make a New Page - /local-members/ */
- /* On each Network Have a pre-filled required registration field (Local-Place) (1 item default - New York in New York Network, Vancouver in Vancouver Network etc etc) */
- /* Put code below on lines 21 to line 120 on New Page in each Network /local-members/. Change line 24 to suit each Network */
- /* Put code below on lines 127 to 152 in functions.php */
- /* Please report back to forum with any suggestions */
- /*I'd imagine that there is a better way!*/
- <?php do_action( 'bp_before_members_loop' ); ?>
- <hl><?php $avar = "This a list of local members"; echo $avar."<br/>"; ?></hl>
- <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
- <?php if (bp_has_members( array( 'include' => include_by_meta('New York', 'Local-Place'), 'type' => 'newest') )) : ?>
- <div id="pag-top" class="pagination">
- <div class="pag-count" id="member-dir-count-top">
- <?php bp_members_pagination_count(); ?>
- </div>
- <div class="pagination-links" id="member-dir-pag-top">
- <?php bp_members_pagination_links(); ?>
- </div>
- </div>
- <?php do_action( 'bp_before_directory_members_list' ); ?>
- <ul id="members-list" class="item-list" role="main">
- <?php while ( bp_members() ) : bp_the_member(); ?>
- <li>
- <div class="item-avatar">
- <a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar(); ?></a>
- </div>
- <div class="item">
- <div class="item-title">
- <a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
- <?php if ( bp_get_member_latest_update() ) : ?>
- <span class="update"> <?php bp_member_latest_update(); ?></span>
- <?php endif; ?>
- </div>
- <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
- <?php do_action( 'bp_directory_members_item' ); ?>
- <?php
- /***
- * If you want to show specific profile fields here you can,
- * but it'll add an extra query for each member in the loop
- * (only one regardless of the number of fields you show):
- *
- * bp_member_profile_data( 'field=the field name' );
- */
- ?>
- </div>
- <div class="action">
- <?php do_action( 'bp_directory_members_actions' ); ?>
- </div>
- <div class="clear"></div>
- </li>
- <?php endwhile; ?>
- <?php endif; ?>
- </ul>
- <?php do_action( 'bp_after_directory_members_list' ); ?>
- <?php bp_member_hidden_fields(); ?>
- <div id="pag-bottom" class="pagination">
- <div class="pag-count" id="member-dir-count-bottom">
- <?php bp_members_pagination_count(); ?>
- </div>
- <div class="pagination-links" id="member-dir-pag-bottom">
- <?php bp_members_pagination_links(); ?>
- </div>
- </div>
- <?php else: ?>
- <div id="message" class="info">
- <p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
- </div>
- <?php endif; ?>
- <?php do_action( 'bp_after_members_loop' ); ?>
- /* add these functions to get local members*/
- function include_by_meta($theMetaValue, $theMetaField) {
- $memberArray = array();
- global $members_template;
- if (bp_has_members()) :
- while (bp_members()) :
- bp_the_member();
- $theFieldValue = bp_get_member_profile_data( 'field='. $theMetaField );
- if ($theFieldValue==$theMetaValue) {
- array_push($memberArray, bp_get_member_user_id());
- }
- endwhile;
- endif;
- $theIncludeString=implode(",",$memberArray);
- return $theIncludeString;
- }
- function localplace() {
- $data = bp_get_member_profile_data( 'field=Local-Place' );
- if ( $data )
- echo "<span> Local Place: $data </span>";
- }
- add_action( 'bp_directory_members_item', 'localplace' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement