Skip Navigation

[Resolved] Why can’t I see the data?

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

Problem:

Get user's ID in the author archive page using PHP codes.

Solution:

It is a custom PHP codes problem, see example here:

https://toolset.com/forums/topic/why-cant-i-see-the-data/#post-1807855

Relevant Documentation:

https://developer.wordpress.org/reference/functions/get_user_by/

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.

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)

This topic contains 4 replies, has 3 voices.

Last updated by 直子 村上 3 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1804235

Please look at this URL.
I can't see data.
(domain) /author/100685/

On the other hand,I can see data of these pages.
(domain) /author/105945/
(domain) /author/105382/

Why can't I see the data on the first page listed?

Please use this access details
https://toolset.com/forums/topic/template-not-applied/#post-1798281

#1805389

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2020-10-09 at 09.46.06.png
Screenshot 2020-10-09 at 09.42.59.png

If in the dashboard I go to Users > All Users, from the list of users I can locate the user with username/nickname 100685 (user ID 405), which shows that they have published one post (see the screenshot).

If I click the link to that one post, it takes me to the list of posts authored by that user, a single post with ID = 31716.

But when I edit that post it says the author is "glee". Why's that? That's not the author I was expecting.

I suspect that may be related to the problem of the post not showing up in the author archive on the front end.

#1807805

Thank you!

I have resolved the issue of different authors of the posts. But the data did not show up.

Could you please investigate again?

#1807855

Hello,

Thanks for the details, I can login your website and see the problem.

The problem is in your custom shortcode [get_author_id_in_archive], I have done below modifications in your website:
Edit the Snippet "Toolset":
hidden link
replace those two lines from:
$author = get_queried_object();
$author_id = $author->ID;

With:
$author = get_user_by( 'slug', get_query_var( 'author_name' ) );
$author_id = $author->ID;

Please test again, check if it is fixed, thanks

More help:
https://developer.wordpress.org/reference/functions/get_user_by/

#1807919

My issue is resolved now.
Thank you from the bottom of my heart.!!!

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