Skip to:
Content
Pages
Categories
Search
Top
Bottom

The problem is, that it doesn’t work with the widgets, who’s online, etc..


  • Carsten
    Participant

    @privatedanish

    Theme – Gwangi dating Version: 2.0.0, Author URL: https://www.themosaurus.com
    BuddyPress: by The BuddyPress Community – 5.0.0
    WP Version: 5.2.3, WordPress address (URL): https://filipinowomen.online

    Hi there, I have this snippert, that figures out if the logged-in user is man or woman!

    —————————————————————————-
    add_filter (‘bp_ajax_querystring’, ‘modify_members_loop’, 20, 2);
    function modify_members_loop ($qs=false, $object=false)
    {
    global $wpdb;
    if ($object != ‘members’) return $qs;

    // figure out if the logged-in user is man or woman
    $gender = xprofile_get_field_data (3, bp_loggedin_user_id ());

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

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

    $args = wp_parse_args ($qs);
    $args[‘include’] = implode (‘,’, $custom_ids);
    $qs = build_query ($args);

    return $qs;
    }
    ——————————————————————————–
    The problem is, that it doesn’t work with the widgets, who’s online…etc.
    So does anyone know, how to fix that?

    Note: A loggede in man, should only be able to see women’s profiles and women should be able to see men’s, even if a woman/man, try to search for their own gender!

    Best regards

  • You must be logged in to reply to this topic.
Skip to toolbar