GEO my WP Support

Use this forum for technical support and general questions related to GEO my WP plugin and its core add-ons only. For technical support and general questions related to any of the premium extensions please open a new premium support ticket.

[Not resolved]Hide/Remove Members from Results Map

Home Forums Support Hide/Remove Members from Results Map

This topic contains 4 replies, has 2 voices, and was last updated by  Eyal Fitoussi 2 years, 12 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #55828

    Paul
    Participant

    Hi Eyal,

    In my GMW results form (results.php), I have customised it to hide members based on the data in a particular BP xprofile field.
    For example, if the xprofile field “Membership Status” !== “Active”, then they do not show up in the listed search results.

    However they remain on the map. In the attached picture, 3 members are not “Active” yet they are still represented on the map by an un-numbered marker.

    Is it possible to add an “if” statement to the map function?
    If this has to be done in javascript in one of the .js files, can you please advise where I need to implement this and what the syntax would be? I need to check the value of the xprofile field then output accordingly.
    However if it can be done in PHP, I can do this myself if you direct me to the correct file. My knowledge of javascript is pretty poor at the moment.

    I would really appreciate any help with this.
    If you have a premium add-on that can do this then I will happily purchase. I have already purchased the XProfile add-on and will certainly financially support you further if possible.

    Attachments:
    You must be logged in to view attached files.
    #55831

    Paul
    Participant

    I have just realised that a function already exists to remove members from the results/map if they have no location set.

    I could accomplish this by removing each deactivated member’s location but this is not ideal.
    I would love a more elegant solution to this if possible.

    #55854

    Eyal Fitoussi
    Keymaster

    Hello Paul,
    Are you trying to hide members that were not yet activate via BuddyPress from the search results? If so, try the script below ( add it to the functions.php file of the child theme ):

    Let me know if this helps.

    #55907

    Paul
    Participant

    Hi Eyal,

    Many thanks for the response and my apologies for the late reply.

    I have tried your code above but it seems to be wiping all members from the search results now.

    Perhaps I should elaborate:
    As far as Buddypress is concerned, all members will be “Active”. The only thing that makes a member “Inactive” is the data contained in a buddypress XProfile field, “Membership Status”.
    What I need to do is hide these members from the location map if this xprofile field contains the value “Inactive”.

    From what I can tell from your code above, it looks like the:

    is referencing the Buddypress “Active” status.
    Do you know how to pass this function the data from an xprofile field as a condition instead?

    Cheers,

    Paul.

    #55922

    Eyal Fitoussi
    Keymaster

    Hello Paul,
    What you describe is a bit more complex than the solution above. You need a custom function that will retrieve the ID of all users with the status “Inactive” and pass them as an array to the exclude argument ( $args[‘exclude’] ) of the BP_has_memebrs function.

    So you can use the function above with the exclude argument, but you need to add a function that will get all the inactive users from database first. I am sure that with a google search you can find how to get users ID based on xprofile field.

    I hope this helps.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.