WordPress.org

Ready to get started?Download WordPress

Forums

BP Multi Network
BP Multi Network & Members Directory (2 posts)

  1. valuser
    Member
    Posted 2 years ago #

    With bp-multi-network it appears members are shared across all networks.

    Example - networks based on location.

    newyork.mydomain.com, losangeles.mydomain.com, vancouver.mydomain.com

    At present a member of any network is listed in any other network's members directory if they are active in the other network.

    So each Members Directory lists all members of the entire installation who have accessed that network.

    So if a "New York" member becomes active on the "Los Angeles" network they are listed in the Los Angeles Members Directory and vice-versa

    Now what if I also wanted a members list of just those members who joined in New York and
    a members list of just those members who joined in Los Angeles and
    a members list of just those members who joined in Vancouver
    etc etc.

    A viable solution is perhaps if I had

    1) a required registration field (Your Location) drop down with the locations and then

    2) a page on each network listing the members who have listed this location in the required field registration form

    I understand this involves interacting with WP_Query about which I have not got the faintest clue.

    If there is anyone out there who can attempt this or even point me in the right direction I'd be thrilled.

    http://wordpress.org/extend/plugins/bp-multi-network/

  2. valuser
    Member
    Posted 2 years ago #

    Came across this at http://buddypress.org/community/groups/creating-extending/forum/topic/solved-limit-members-loop-by-profile-fields/s

    /* Include only members that have a specific profile value in a specific profile field in a loop.
    * $theMetaValue = Value of field to search for
    * $theMetaFielt = Field name to search for Meta Value
    *	EXAMPLE OF CODE IN ACTION:
    *	<?php if (bp_has_members( array( 'include' => include_by_meta('Profile Field Value', 'Profile Field Name'), 'type' => 'newest') )) : ?>
    *	<?php while (bp_members()) : bp_the_member() ; ?>
    *		<!-- INSERT YOUR LOOP TAGS HERE -->
    *	<?php endwhile; ?>
    *	<?php endif; ?>
    * Credit: http://www.duable.com
    */
    
    function include_by_meta($theMetaValue, $theMetaField) {
    
    	$memberArray = array();
    
    		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;
    }
    ?>

    please bear with the ignorance !

    <!-- INSERT YOUR LOOP TAGS HERE --> What do I replace this with ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic