Skip Navigation

[Resolved] Member profile page: display members near me view, Select & URL Custom Fields

This thread is resolved. Here is a description of the problem and solution.

Problem:

Order the post by address distance on a custom field of current post

Solution:

It needs custom codes, see the solution here:
https://toolset.com/forums/topic/member-profile-page-display-members-near-me-view-select-url-custom-fields/page/2/#post-1147104

Relevant Documentation:

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1132267
Screen Shot 2018-10-22 at 6.14.50 PM.png
Screen Shot 2018-10-22 at 6.20.56 PM.jpg

Tell us what you are trying to do?

1) Display 4 member profile images (Custom post type) that have a location near the member's profile page being viewed. I have custom post fields for display address as well as city/state. Some members have private addresses for their business and only display the City/State, not the actual address. Best way to create this?

2) How do I best display "Select" custom fields? I have created Business Categories, as a taxonomy which I have placed under the company name, however I need to also show Select Results: Young Entrepreneur (if selected yes), Trainer/Speaker (if selected yes), and Non-Profit (if selected yes). ONLY if selected YES.

3) How do I best display a URL Custom Field? My resolution after viewing support archives was to use a button, but I'm not happy with it. Is there another option?

Is there any documentation that you are following? https://toolset.com/documentation/user-guides/using-toolset-with-elementor-page-builder/connect-different-post-types-using-relationships/, have also searched support & youtube.

Is there a similar example that we can see? hidden link I am replicating the structure of this layout.

What is the link to your site? hidden link (this is where I'm working). I have created the single post type template in Elementor.

#1132537

Hi,

Q1) You can use Toolset map plugin to display the member's location in a map, see our document:
https://toolset.com/documentation/user-guides/display-on-google-maps/

For those private addresses post, you can use [wpv-conditional] shortcode to check if the it is private address field
hidden link
then display the public City/State as "address" value of marker shortcode, see our document:
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-marker
address. Optional. Defaults to empty. Another optional source of the marker address, allows to display a marker given a fixed, known address

Q2) Similar as above, you can use [wpv-conditional] shortcode to check the "Select" custom field value, then display what you want, see our document
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-types-fields-and-custom-fields/

Q3) You can output the raw URL field value, and use HTML/CSS codes to style the output as button. see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#url
output:
'raw' | 'normal'(default)
‘raw’=Display raw data stored in DB. No other formatting attributes (e.g. custom separator) will be respected.

#1134475

Hello Luo,

Thank you for your help.

I'm working through the process. Currently, I'm running into an issue with the maps API connection. I'm working on a subdomain to build my client's new website. I read somewhere it's best not to activate Toolset until the site is moved. My client has signed up for an API key, and it's verified by the website address as well as the IP address on SiteGround. However when added to Toolset, I receive this error: REQUEST_DENIED - This API project is not authorized to use this API. Both the main website and subdomain have been added as restrictions. Help please!

On Q2, I have successfully implemented this step. Thank you. working on the others

#1134806

For the google map API error, please follow our document to setup the map API:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/#creating-an-api-key-for-google-maps

You need to enable Places, Geocoding, and Geolocation APIs, see screenshot:
hidden link

#1136020
Screen Shot 2018-10-29 at 8.22.21 AM.png
screencapture-membership-eyeprosper-new-member-profile-amalie-media-llc-2018-10-28-20_36_20.png

Hello Luo,

Thank you for your help. Still stuck on a few things.

I have connected the Maps API successfully, and imported a map & markers into my Elementor Member Profile template.
1) Map displays a random business on the marker, but NOT from the existing post as indicated. (see image) All other info brought into this template is tied to the current member.
2) Additional Markers: I was only able to create a separate map view that displays 4 business profile images, but not able to set a distance filter (example 50 mile radius) of the existing post. I ONLY want to display the 4 closest members. I have used this as reference: https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/

Conditional fields: I was able to show "select" fields based on "if" value, but how do I display content instead of the value?
EX: If Young Entrepreneur I want it to display *YE instead of YES, if NO, I don't want to display anything.
EX: If are you a Trainer/Public Speaker I want to display *T/PS instead of YES, if NO, I don't want to display anything.

#1136572

For the new questions:
1) Map displays a random business on the marker, but NOT from the existing post as indicated. (see image) All other info brought into this template is tied to the current member.
This is abnormal, please check these:
a) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again
b) If the problem still persists, please provide a copy of your website, also point out the problem page URL and what marker addres should be displayed in the map

2) I ONLY want to display the 4 closest members.
There isn't such kind of feature within Toolset map plugin, as you can see, in the document you mentioned above:
https://toolset.com/documentation/user-guides/display-on-google-maps/displaying-markers-on-google-maps/#ordering-views-by-distance
section "Ordering Views by Distance", there are only two options:
- Fixed
- Visitor Location
There isn't option for custom field, if you agree, we can take it as a feature request, our developers will evaluate it.

2) Conditional fields: I was able to show "select" fields based on "if" value, but how do I display content instead of the value?
Please follow our document to setup the [wpv-conditional] shortcode:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-types-fields-and-custom-fields/

If you need more assistance to setup this shortcode, you can also provide provide a test site with the same problem, point out the problem page URL, I can setup a demo for you.

#1137411

Thanks for the details, the "WordPress access details" you provided above is not valid, I get this error when try to login your website:
ERROR: Invalid username.

I am downloading the duplicator package, will update here if there is anything found

#1137518

I can see the problem with your duplicator package, the problem is strange, I am trying to debug it in my localhost, will update here tomorrow morning.

#1137536

oops, can provide new credentials if necessary.

#1138122
distance-filter.JPG
googl-map.JPG

Here are what I found, please try these:
1) Upgrade Toolset maps plugin to the latest version 1.5.4, you can download it here:
https://toolset.com/account/downloads/

2) Edit the post view "Member Location Map", in section "Limit and Offset", you are display only one item, please switch to option "display no limit items"

2) Setup the second google map API key according to our document:
https://toolset.com/documentation/user-guides/display-on-google-maps/creating-a-google-maps-api-key/#creating-an-api-key-for-google-maps
fill the new key here:
Dashboard-> Toolset-> Settings-> Maps
option "For added protection of your API keys, you may want to setup a 2nd key for server-side requests:"

Then test it again in front-end, it works fine, see screenshot google-map.JPG
I can get 4 makers in the map.

For the question "I would like to show other members nearby as markers", I assume we are talking about in a single "Member Profile" post, you are going to display other nearby member posts.

If it is, yes, it is possible, for example, you can get current member post's address field value as text:
[types field='mbr-biz-address'][/types]

Pass it to below post view as filter parameter:

create a post view, query "Member Profile" posts, in section "Query Filter", add a distance filter:
Show posts within 50km radius of address/coordinates provided using mapcenter shortcode attribute.

See screenshot distance-filter.JPG

And display the view's shortcode as below:
[wpv-view name="VIEW-SLUG" mapcenter="[types field='mbr-biz-address'][/types]"]

And you can also display the marker as different icon, see our document:
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-marker
marker_icon. Optional, defaults to empty, which means using the default Google Maps icons for markers, or the one set for the whole map. Can be a complete URL pointing to an image to use as marker image.

#1138426
this is the view of the map on the page.png
this member post what is viewed.png
50 radius.png

Thank you/..We're getting there!

Maps updated and second API key added. However my view shows every member, and the RED Target Marker is NOT the member from the POST.
example: this member post what is viewed.png
example: this is the view of the map on the page.png

Maybe this will help you understand what I'm trying to do? This is the clients OLD website, and an example of a member profile page and what I'm trying to replicate: hidden link

I'm okay with an alternative solution. If I could get the 4 closest just on the map with a marker, I may be able to convince my client otherwise about the images.

******
This was confusing on how to actually set up and what the result would be, since you already mentioned I couldn't display 4 profile images of nearby members. Did I mis-understand, and I can?

Your notes:
For the question "I would like to show other members nearby as markers", I assume we are talking about in a single "Member Profile" post, you are going to display other nearby member posts.

This is what I was trying to do: hidden link

If it is, yes, it is possible, for example, you can get current member post's address field value as text:
[types field='mbr-biz-address'][/types]

Pass it to below post view as filter parameter:

create a post view, query "Member Profile" posts, in section "Query Filter", add a distance filter:
Show posts within 50km radius of address/coordinates provided using mapcenter shortcode attribute.

See screenshot distance-filter.JPG

And display the view's shortcode as below:
[wpv-view name="VIEW-SLUG" mapcenter="[types field='mbr-biz-address'][/types]"]

And you can also display the marker as different icon, see our document:
https://toolset.com/documentation/user-guides/maps-shortcodes/#wpv-map-marker
marker_icon. Optional, defaults to empty, which means using the default Google Maps icons for markers, or the one set for the whole map. Can be a complete URL pointing to an image to use as marker image.

******
I don't understand what you mean here:
for example, you can get current member post's address field value as text:
[types field='mbr-biz-address'][/types]

Pass it to below post view as filter parameter: see

create a post view, query "Member Profile" posts, in section "Query Filter", add a distance filter:
Show posts within 50km radius of address/coordinates provided using mapcenter shortcode attribute.

See screenshot distance-filter.JPG

And display the view's shortcode as below:
[wpv-view name="VIEW-SLUG" mapcenter="[types field='mbr-biz-address'][/types]"]

I was able to create the query on the member profile and add a distance filter as indicated. My attempt at the shortcode showed nothing

Example of set-up: 50 radius.png

On this one:
2) Conditional fields: I was able to show "select" fields based on "if" value, but how do I display content instead of the value?
Please follow our document to setup the [wpv-conditional] shortcode:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-types-fields-and-custom-fields/

If you need more assistance to setup this shortcode, you can also provide provide a test site with the same problem, point out the problem page URL, I can setup a demo for you.

This shows the issues I'm having: hidden link

I really appreciate your help. I have learned so much, and this site is so close to being finished. I can provide login details again, if it would help.

Thank you!
Laurie

#1138838
address-radius.JPG

Dear Laurie,

Q1) since you already mentioned I couldn't display 4 profile images of nearby members. Did I mis-understand, and I can?
That is a misunderstand, I mean no feature to order the result by distance by a custom address field value in current version of Toolset map plugin, but in your case, you can filter the results by distance by a custom address field.

Q2) I was able to create the query on the member profile and add a distance filter as indicated. My attempt at the shortcode showed nothing
That is only an example, in your database dump file, there is only one post in that radius range, and it is the current post "Member Profile" post, so you will need to edit that view "VIEW-SLUG", disable the option "Don't include current page in query result", see screenshot address-radius
It works fine, you can add some "Member Profile" posts in that 50 miles radius, and test

Q3) I was able to show "select" fields based on "if" value, but how do I display content instead of the value?

You can use a text widget with content, for example:

[wpv-conditional if="( $(wpcf-young-entrep) eq '1' )"]
This is a young entrepreneur, display some thing
[/wpv-conditional]

As you can see the "young-entrep" is the custom field slug, and value 1 is the "Custom field content", you can get them by editing your custom field "Are you a young entrepreneur? (up to 30 years old) ":
hidden link

Hope it is clear.

#1139422
Screen Shot 2018-11-02 at 10.34.34 PM.png
Screen Shot 2018-11-02 at 10.32.15 PM.png
Screen Shot 2018-11-02 at 10.28.01 PM.png
Screen Shot 2018-11-02 at 10.29.58 PM.png
Screen Shot 2018-11-02 at 10.24.22 PM.png

OMG, I can't believe how close I am on this!

Finally got the map to show the member post marker. Then was just able to successfully show 4 neighbors as well. However the distance is way off. When the member profile is in MD and its showing closest is CA, when there are MANY members in NY. Something is not quite right there. Any thoughts?

#3 was also successfully implemented!

Thank you so much for your patience. Uploading a few examples so you can see settings and examples.
Laurie

#1140106

For the new problem:
When the member profile is in MD and its showing closest is CA, when there are MANY members in NY. Something is not quite right there. Any thoughts?

There isn't the similar problem in my localhost with your duplicator package file, I can see only one item in the map, which is current post, if you still need assistance for it, please provide valid website credentials, also point out the problem page URL and view URL, I need a live website to test and debug.

#1140944

I have tried your the website credentials you provided above, but get this error:
ERROR: The password you entered for the username techsuppt is incorrect

Please check it, make sure it is valid.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.