Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter shaundrania

    (@shaundrania)

    I don’t have the plus package. Is this a free add on? If not, can I pay for the addon only?

    Thread Starter shaundrania

    (@shaundrania)

    @carsten-lund and @dontdream, question- did the members page on your site stop showing profiles after adding both or either of the codes discussed here for gender filter? Reason I ask is on the front end of my site the members aren’t showing on the members page, I’m wondering if it’s the code or something I did.

    Thank you!!

    Thread Starter shaundrania

    (@shaundrania)

    @dontdream, I just discovered this code but I have a question-
    If I added this members-loop.php for creating an advanced search for members, will it interfere with the gender filter php code I just entered in my site?

    <?php if ( bp_has_members( bp_ajax_querystring( ‘members’ ) ) ) : ?>

    <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(); ?>

    • <div class=”item-avatar”>
      “><?php bp_member_avatar(); ?>
      </div>

      <div class=”item”>
      <div class=”item-title”>
      “><?php bp_member_name(); ?>

      <?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>

    • <?php endwhile; ?>

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

    Thread Starter shaundrania

    (@shaundrania)

    Thank you @dontdream!

    The code worked but can you share if there is a code to insert to create an advanced search form on the members page of the members profile? Or maybe add an additional sub-tab called search or advance search that hosts the advance search form (next to members and home tabs) on the profile page?

    I hope that makes sense… ??

    Thread Starter shaundrania

    (@shaundrania)

    Oh, this is great! Beautiful! Will insert this code today. I noticed one other question you had in the forum regarding adding tabs. Did that code workout for you? I think I’m going to add it to mine.

    As for the question that was unclear “making complimentary matching”, I believe that’s specific to my theme-sweetdate. So it probably doesn’t apply to your theme.

    Thank you so much for your help Carsten!

    Thread Starter shaundrania

    (@shaundrania)

    @carsten-lund, Ok great! Will do. So, basically with this code we don’t need to use the “I am a” or “looking for” question in the profile search.. only when they initially signup? That’s great! I was hoping I didn’t.

    • This reply was modified 6 years, 11 months ago by shaundrania.
    Thread Starter shaundrania

    (@shaundrania)

    @carsten-lund, the other code for removing “all members tab” is li#members-all {display: none;}

    Question- As you your code, are you able to use the matching with these additional conditions added to the site? If so, did you turn off mandatory complimentary matching and complimentary matching? Also, do you use the “I am a” in the profile search without using the “looking for a” question? If doing something different, please share?

    Thanks for your help Carsten. I hope the codes work for you.

    • This reply was modified 6 years, 11 months ago by shaundrania.
    Thread Starter shaundrania

    (@shaundrania)

    @carsen-lund, here is the code but now I’m not ABSOLUTELY sure that it prevented the recently active, who’s online widgets. I had the guy remove the “all members” from the profile section. I may have a code for that too but give me a sec to look for it.

    // Show only male or female to opposite sex

    class BP_Custom_User_Ids {

    private $custom_ids = array();

    public function __construct() {

    $this->custom_ids = $this->get_custom_ids();

    add_action( ‘bp_pre_user_query_construct’, array( $this, ‘custom_members_query’ ), 1, 1 );
    add_filter( ‘bp_get_total_member_count’, array( $this, ‘custom_members_count’ ), 1, 1 );

    }

    private function get_custom_ids() {
    global $wpdb;

    //figure out if the logged-in user is male or female
    $sex = xprofile_get_field_data( 303, bp_loggedin_user_id() );

    if ( $sex == ‘Man’ )
    $query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 303 AND value = ‘Woman'”;
    else
    $query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 303 AND value = ‘Man'”;

    $custom_ids = $wpdb->get_col( $query );

    return $custom_ids;
    }

    function custom_members_query( $query_array ) {

    $query_array->query_vars[‘include’] = $this->custom_ids;

    }

    function custom_members_count ( $count ) {

    $new_count = count( $this->custom_ids );
    return $new_count;

    }
    }

    function custom_user_ids( ) {

    new BP_Custom_User_Ids ();

    }

    add_action( ‘bp_before_directory_members’, ‘custom_user_ids’ );

    He also did this to test it out – created four users for testing, they were: FemaleOne, FemaleTwo, MaleOne and MaleTwo and assigned their gender via the back-end. He added a plugin called User Switching which allowed him to switch to these users so they’re marked as previously being logged in (this allows them to be shown on the front-end). Then he disabled the plugin but left it installed for me to use.

    I hope this helps- I’m wondering if it’s the code you used previously.

    Did you have to add it your code to a bp-custom.php file?

    Thread Starter shaundrania

    (@shaundrania)

    Hey @carsen-lund,
    Yes I have bpmembers, recently active members drop down on the members page from their profile. I had someone insert the code in the loop of the members page and it worked but it doesn’t work with the BP Profile search. Do you have any suggestions?

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