Skip Navigation

[Resolved] View shortcode UserID not returning expected value

This support ticket is created 3 years, 6 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.

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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Simon Logan 3 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#2053103

Tell us what you are trying to do?
To create a page which shows a user's own profile, so I'm using a shortcode to insert a view with an extra param to filter by the current user ID.

Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-current-user

I'm using the shortcode:
[wpv-view name="my-profile-header" userid="[wpv-current-user info='id']"]

But the correct info isn't showing. When I change the shortcode to simply output the userID so that I can check it ([wpv-current-user info="id"]) it simply outputs the digit 1 instead of the correct user ID. Other variants such as [wpv-current-user info="username"] work, however.

I did notice that when I add that full shortcode I get the view output but there's an errant "] after it, like the shortcode isn't being parsed properly?

#2053169

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Thank you for getting in touch.

This should work as intended as i've tested it out on my end and it works fine. Would you mind allowing me to have admin access to the site so that I can test this out on your end to see what is happening.

I've enabled the private fields for your next response. Please also send me the page that the view is on.

Thanks,
Shane

#2053227

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

The problem is caused by the elementor shortcode block. It doesn't allow for you to nest the shortcodes. I've added the shortcode to their Text Editor block which works without breaking the shortcode.

hidden link

You can go ahead and remove the shortcode block from the template once you can confirm that the workaround is fully functional.

Thanks,
Shane

#2053235

hi Shane

The shortcode seems to be properly parsed now however [wpv-current-user info='id'] is still returning the value "1" for me rather than the correct logged in userID?

#2053239

Wait sorry I think that was a mistake on my part, looks like it's working properly now!

So I'll just avoid using the shortcode widget when using embedded shortcode in Elementor - good to know!

#2053255

My mistake, I was getting the results whilst in Elementor edit mode which didn't seem to properly get my User ID, however when viewing on the frontend it worked as expected.