This topic has 11 replies, 2 voices, and was last updated 6 years by Radu.

  • Author
  • #191831
     shaundrania
    Participant

    Question – where do I go to insert this code to prevent same sex search in my dating site?  Meaning men can only see women in the search and women can only see men in the dating site search.  I got this code from a previous inquiry but I’m not sure where to insert it.  Do I go to settings >buddypress>rtmedia>custom css and insert the code below?  Also what do I do after inserting the code?  Thank you for your help!!!

     

     

    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( 852, bp_loggedin_user_id() ); if ( $sex == ‘Muslim’ ) $query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 852 AND value = ‘Muslima'”; else $query = “SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 852 AND value = ‘Muslim'”; $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’ );

    #191893
     Radu
    Moderator

    Hi,

    Not sure if the snippet still works, it’s outdated i think,

    Always the php codes will be added only in php files so more exactly here : ( wp-content/themes/sweetdate-child/functions.php )

    Note: Child theme needs to be installed and activated.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #191895
     shaundrania
    Participant

    Radu, the link in your message doesn’t working. I’m not sure where you’re trying to send me? Please try again!!

    #191897
     shaundrania
    Participant

    Or Radu, could you provide the coding and How to insert code here?

    #191900
     shaundrania
    Participant

    By the way Radu, the code I posted I ad the one you sent me to insert into my website in February….

    #191901
     shaundrania
    Participant

    And where and how do I insert a php code?

    #191902
     Radu
    Moderator

    Hi,

    Please write a single ticket contains all of you questions it’s easy to read and in this way i not miss nothing.

    In first place you should remove it from css area where you had said that you had placed in the first ticket.

    You should edit the file on your server located there : wp-content/themes/sweetdate-child/functions.php and paste ad the end told ya already in my first reply : https://archived.seventhqueen.com/forums/topic/prevent-same-sex-search/#post-191893

    Note: Child theme needs to be installed and activated.

    I’m not sure if the code still works.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #191903
     shaundrania
    Participant

    okay we are obviously speaking two different languages. First, I posted a few times because the comments won’t allow me to edit a previous entry to add additional information or requests – that’s the reason for multiple tickets.

    2nd – I have NO IDEA what you mean when you say “You should edit the file on your server located there : wp-content/themes/sweetdate-child/functions.php and paste ad the end”. Are you saying go into themes? Go into a plugin? go into what – please speak plainly to me about how to make the change – I’m not a coder or web designer! sweetdate-child theme is added. Where do I go 1st from the main dashboard and then tell me the steps afterwards PLEASE! I appreciate your help. Thank you Radu.

    #191904
     shaundrania
    Participant

    Radu, apologize for this 2nd message but this is all I saw-

    I went to themes, then I went to sweetdate-child but I do not see anything that says functions.php.

    #191905
     Radu
    Moderator

    Hi again

    In first place you should know how to handle and edit a php file.If you don’t you will have to get a help from a developer.

    The code paste will not be made from wp-admin ! But using FTP client like https://filezilla-project.org/ to connect to your server then navigating to wp-content/themes/sweetdate-child/functions.php

    I’m not sure if the code still works.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #191909
     shaundrania
    Participant

    Ok. So do you have the php code for me to add or no? Laura was kind enough to provide that before, will you also do the same- since you say “the code is outdated”

    #191912
     Radu
    Moderator

    Hi,

    I don’t have any similar code, you can try to ask on the buddypress support forums.
    So give a try to that code.
    There is not our code it’s a code from buddypress support forums and we don’t have other similar code to achieve that functionality.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?