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 6 years, 1 month 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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
#1140953

Strange, I just reset it with the same and logged in. It worked okay.

Thank you

#1140978
login.JPG

No, it isn't valid, I get the same error, see screenshot login.JPG. please check it, and the problem doesn't exists in my localhost, it only exists in your website, so I need to check it in your website, please backup your website first, I will need to deactivate plugins and switch theme.

Thanks

#1141268

I'm sorry, no idea what's going on. I updated password again, and logged in and it worked. Site has been backed up.

Thank you

#1141928

Thanks for the details, I can login your website now, will update here if there is anything found

#1141933

I have done below modifications in your website:
1) Edit the view "Neighbor Members on Map TEMP"
hidden link

In section "Search and Pagination", change the codes from:

[wpv-filter-start hide="false"]
[wpv-filter-end]

To:

[wpv-filter-start hide="false"]
[wpv-filter-controls][/wpv-filter-controls]
[wpv-filter-end]

in section "Loop Editor": change the codes to:

[wpv-layout-start]
	[wpv-items-found]
[wpv-map-render map_id="map-1" spiderfy="on"][/wpv-map-render]
	<!-- wpv-loop-start -->
	<div class="biz-popup">
<wpv-loop>
		[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-mbr-biz-address']<div style="text-color:#3f770e">[types field='company_name'][/types]</div>[/wpv-map-marker]
     </wpv-loop>
	</div>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

- you need to put the marker shortcode into view's loop: <wpv-loop>... </wpv-loop>
- setup a unique marker ID for each marker: marker_id='marker-[wpv-post-id]'
hidden link

Edit the elementor page template:
hidden link
Replace the view widget with a text widget, with below codes:

[wpv-view name="neighbor-members-on-map-temp" mepcenter="[types field='mbr-biz-address'][/types]"]

Please test it again, check if it is fixed. thanks

#1142328
Screen Shot 2018-11-07 at 9.50.05 AM.png

Thank you Luo.

I see these are the changes you made within my site. When I view the page, I see the same map and markers for every member. The location is CA, no matter where the member is.

You said: setup a unique marker ID for each marker: marker_id='marker-[wpv-post-id]' do I need to add others, as there is only 1?

#1142848

Thanks for the details, since your live website is using different data from my localhost, I am exporting your website database dump file, will update here if there is anything found

#1142914

Here are what I found, I tried your database dump file with only Toolset plugins + a fresh wordpress installation,

There isn't similar problem.

So I have tested it in your website here:
hidden link

With below codes:

Post(ID 1960) mbr-biz-address: [types field="mbr-biz-address" item="1960"][/types]
[wpv-view name="neighbor-members-on-map-temp" cached="off" mapcenter='[types field='mbr-biz-address' item='1960'][/types]']

Test it in front-end:
hidden link
It outputs only two items, both are using address within "MD, USA"

But the same shortcodes does not work in page template controlled by "elementor" plugin, so it should be a conflict issue with "elementor" plugin.

Currently, I suggest you use Views content template to design the single "Member Profiles" posts, and display those map shortcodes directly in content template instead of "elementor" page template.

More help:
https://toolset.com/documentation/user-guides/setting-view-templates-for-single-pages/

Please let me know if you need assistance for it.

#1146097

I have recreated what you suggested, first by creating a content template, then using the layouts plugin. A tremendous amount of work to recreate, what I've already created in Elementor several times. I am still seeing the same map view.

Here's the link for the layout page. hidden link
I have disabled all the Astra theme options, and I am still seeing the featured image on occasion. No rhyme or reason.

Here's the rebuilt view: hidden link

The Elementor page is still in the library, I have just made it private and a draft so it's not being used.

I've done everything I possibly can and really need to move forward on this! Let me know if you can help any further. I'd like to keep this in Elementor if at all possible. My client was left with a hand coded mess from her last designer/developer, I'm hoping to transition this site to her in the next week.

Thank you for everything!
Laurie

#1146376

Thanks for the details, I am checking it in your website, will update here if there is anything found

#1146392

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

Please check it, also backup your website too, thanks

#1146769

Reset again, to the credentials I provided originally.

Website is backed up.

Thank you for your patience!
Laurie

#1147104

Thanks for the details, I have done below below modifications in your website:
1) Edit the view "Neighbor Members on Map TEMP",
hidden link

- in section "Ordering", change it to:
Order by field "Field - Business Address" ... "As a distance from" "fixed"
We can use custom PHP codes to order the results by distance from custom field value, see step 2)

- in section "Query Filter", remove the distance filter
As it does not work as expected in your website

- Loop Editor, change the codes from:

[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-mbr-biz-address' marker_icon='//membership.eyeprosper.com/wp-content/plugins/toolset-maps/resources/images/markers/Home.png']<div style="text-color:#3f770e">[types field='company_name'][/types]</div>[/wpv-map-marker]

To:

[wpv-conditional if="('[wpv-post-id]' eq '[wpv-post-id id="$current_page"]')"]
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-mbr-biz-address' marker_icon='//membership.eyeprosper.com/wp-content/plugins/toolset-maps/resources/images/markers/Home.png']<div style="text-color:#3f770e">[types field='company_name'][/types]</div>[/wpv-map-marker]
[/wpv-conditional]
[wpv-conditional if="('[wpv-post-id]' eq '[wpv-post-id id="$current_page"]')" evaluate="false"]
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-mbr-biz-address']<div style="text-color:#3f770e">[types field='company_name'][/types]</div>[/wpv-map-marker]
[/wpv-conditional]

So we can display the marker of current "Member Profiles" post as a different icon than other posts

2) Add below PHP codes to setup ordering by distance from custom field "mbr-biz-address" value:

add_filter( 'wpv_view_settings', 'neighbor_map_center_func', 30, 2 );
function neighbor_map_center_func ( $view_settings, $view_id ){
  
  $affected_views = array( 2994 ); // Add IDs of relevant Views
  
  if ( in_array( $view_id, $affected_views ) ) {
    $mbr_biz_address = types_render_field('mbr-biz-address');
    if(isset($view_settings['distance_order']['center'])){
    	$view_settings['distance_order']['center'] = $mbr_biz_address;
    }
  }
    
  return $view_settings;
}

Please test again, check if it is fixed, thanks

#1147235
toolset-elementor-post-relationships-1.png

YES! They show up on the map, Wahoo!

Question:

Can the pop-up with the member neighbor show their profile image, name, location and click to their profile page?
Like shown here: https://toolset.com/documentation/user-guides/using-toolset-with-elementor-page-builder/

Originally this is what I was trying to do with Elementor, but have the images to the left.

The reason behind this is if you find someone nearby on the map, you should be able to access their info easily.

#1147257

Also wanted to mention, I just tested again with the Elementor page, and it shows up there now as well. It's in private mode, but does now work. There have been no updates the the plugin recently, so it must have been something resolved with the php?

I forgot to mention this. I changed the marker for the member to be green (added to media library and swapped in the new link) Can that marker stand alone, and the other 4 are grouped together? In some cases the member you are viewing is bundled up with another, so you don't see them at first.