Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

  • Jordi Radstake
    Participant

    @jordi-radstake

    Other question, is it possible to add multiple includes to this?

    <?php if (bp_group_has_members( array( 'include' => include_by_meta($geslacht, 'Geslacht'), 'type' => 'newest') )) : ?>


    Jordi Radstake
    Participant

    @jordi-radstake

    Why can’t I just copy that function?

    function include_by_meta_group($theMetaValue, $theMetaField) {
     
            $memberArray = array();
     
                    if (bp_group_has_members()) :
                    while (bp_group_members()) :
                            bp_group_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;
    }

    Jordi Radstake
    Participant

    @jordi-radstake

    Oh wait, it has to do with the function:

    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;
    }
    

    Jordi Radstake
    Participant

    @jordi-radstake

    I did, but that’s not working.

    <?php $geslacht = bp_get_profile_field_data('field=Geslacht&user_id='.bp_loggedin_user_id()); ?>
    
    <?php  //if ( bp_group_has_members( 'exclude_admins_mods=0' ) ) : ?>
    
    <?php if (bp_group_has_members( array( 'include' => include_by_meta($geslacht, 'Geslacht'), 'type' => 'newest') )) : ?>
    
    	<?php do_action( 'bp_before_group_members_content' ); ?>
    
    	<div class="item-list-tabs" id="subnav" role="navigation">
    		<ul>

    Jordi Radstake
    Participant

    @jordi-radstake

    Now I would have the same for group-members, but that seems not to work?


    Jordi Radstake
    Participant

    @jordi-radstake

    Ok, thnx for mentioning that 🙂


    Jordi Radstake
    Participant

    @jordi-radstake

    Never mind, fixed it.

    <?php global $bp;
    $the_user_id = $bp->loggedin_user->userdata->ID;
    $the_user_login = $bp->loggedin_user->userdata->user_login; 
    $geslacht = bp_get_profile_field_data('field=Geslacht&user_id='.bp_loggedin_user_id());
    ?>
    
    <?php if (bp_has_members( array( 'include' => include_by_meta($geslacht, 'Geslacht'), 'type' => 'newest') )) : ?>

    (geslacht is dutch for gender btw.)

Viewing 7 replies - 1 through 7 (of 7 total)
Skip to toolbar