Hi Brajesh, I look forward to that, thanks.
I discovered an issue with the code above.
If you have an option in the registration page for choosing not only your own gender, but also a field for choosing which gender you are looking for, the member list shows both genders.
Is there a workaround for this?
I am not sure what are the gender option on your registration page or how you have implemented genders.
The above code works by following assumption:-
1. Your site have some genders
2. A gender is defined as a member type
3. It assumes that you are able to assign user a gender member type. If no gender member type is assigned, no filtering will be done.
Now, if you are somehow assigning multiple gender to a user or no gender to a user(member type), The above code may not work as expected.
PS:- The code only deals with user listing with member type and has no understanding of how you add the gender member type to user. It does not/can not affect registration process.
I am sorry but the screenshots does not help.
Making the profile fields and call them gender is not going to have any effect on our code.
If you want to utilize the above code you will need to create Genders as member type and then assign gender to users on registration(or in any other way). These genders must be ‘member type’.
In your case, It seems gender is normal field which has no effect on listing.
Here is what you are doing. You are using 2 xprofile fields for gender. This method is inefficient for filtering the member list.
here is an example on how to do that
I suggested the member type code and route as that is more efficient way.
Now, coming back to your other question. Profile fields and member types are different things and are associated differently. you can not exchange them in fetching list. You can put conditions for individual user’s display though.
You must be logged in to reply to this topic.