Skip Navigation

[Resolved] map displaying to many markers

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

Problem:
The user was adding a map with markers using a view from the theme template, using the do_shortcode function.

Solution:
Because the user is passing an argument to the shortcode using another shortcode(nested shortcodes), we need to use the Toolset function wpv_do_shortcode instead of do_shortcode.

<?php echo wpv_do_shortcode("[wpv-view name='user-reg-sales-address' user='[wpv-post-author format='meta' meta='ID']']");?>

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv-pre-shortcode

This support ticket is created 3 years, 9 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: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by martinP-13 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#1892305

this page here hidden link map is in the top right(or will be when only one map shows)

i have setup login/register/edit profile forms for my site.
the registration form uses Custom Fields Group (user fields) i have a group registration , in that group is (Sales Address)
it is working just fine .
on an advert post i am trying to display a map (with marker) for the user who LISTED the advert ( not the user viewing the page)
i am using the view located here
hidden link
the view is inserted directly into my post.php .

the page is loading a map for all site users rather than just ONE map with one marker . i can not see anywhere how to set the query for this. thanks

#1893045

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting the Toolset support.

To better assist with this issue, I'll need to check the view closely in the admin area. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1893129

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

The view does not have any filters, so it will always return all the users. I updated the view to take the post's author in a shortcode attribute. Check this screenshot hidden link

Then the code should be updated as follow:

<?php echo do_shortcode("[wpv-view name='user-reg-sales-address' user='[wpv-post-author format='meta' meta='ID']']");?><br>

I updated this file with it, but it does not seem to be the one used by the theme hidden link

I'll let you update your theme file. Let me know which one is it if it does not work for you too.

#1893171

that is the correct file , if you remove <?php echo do_shortcode("[wpv-view name='user-reg-sales-address' user='[wpv-post-author format='meta' meta='ID']']");?><br>
the map disappears. when re enter it the map is back but there are 40 odd maps still .

thanks jamal

#1893215

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

I was able to fix this by using the Toolset wpv_do_shortcode function instead of WordPress dp_shortcode. The Toolset function is useful for cases of nested shortcodes. You can read more about it on this filter https://toolset.com/documentation/programmer-reference/views-filters/#wpv-pre-shortcode

The page renders only one map that corresponds to the data of the post's author. Check this screenshot hidden link

Let me know if that resolves the issue or if I missed something.

#1893225

My issue is resolved now. Thank you Jamal very much appreciated!

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