Skip Navigation

[Resolved] Author archives showing incorrect information

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

Problem:
The information from the correct user's custom fields is not showing in the author archive view.

Solution:
Suggested to first register a custom shortcode that gets the ID of the user whose author archive page is shown and then use it with the types field shortcode.

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/

This support ticket is created 5 years, 10 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by hannahM 5 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1212261

I am using the Views plugin to create the author archives on Echoes and Dust.

It has been working fine, but following a recent update the view is pulling through information for the wrong author.

This is an example of an author page: hidden link

It is correctly pulling through Geoff's posts, however it is showing the profile image, name and twitter/website urls for Dan Salter. All of the author pages are doing this, and they are all showing Dan's information.

This is the code I am using in the author archive:

[wpv-layout-start]
 <div class="author-detail clearfix">
   [types usermeta='profile-image' size='medium' align='left' resize='proportional' user_is_author='true'][/types]
  <h2>[types usermeta='name' user_is_author='true'][/types]</h2>	 
   <h4 class="author-socials">  [wpv-conditional if="('[types usermeta='author-twitter' output='raw'][/types]' ne ' ')" ][types usermeta='author-twitter' title='twitter' target='_blank' user_is_author='true'][/types][/wpv-conditional][wpv-conditional if="('[types usermeta='author-instagram' output='raw'][/types]' ne ' ')" ][types usermeta='author-instagram' title='instagram' target='_blank' user_is_author='true'][/types][/wpv-conditional][wpv-conditional if="('[types usermeta='author-website' output='raw'][/types]' ne ' ')" ][types usermeta='author-website' title='website' target='_blank' user_is_author='true'][/types][/wpv-conditional]</h4>
   <p> [types usermeta='author-bio' user_is_author='true'][/types]</p>
 </div>
	[wpv-items-found]
<h2 class="articles-by-header">Articles by [types usermeta='name' user_is_author='true'][/types]</h2>
	<!-- wpv-loop-start -->
		<wpv-loop>
<div class="post-in-list">
<a class="post-featured-image" href="[wpv-post-url]">[wpv-post-featured-image size='thumbnail']</a>
<div class="post-title"><h4>[wpv-post-link]</h4></div>
<div class="post-meta">by [wpv-post-author format="link"] | [wpv-post-date]</div>
<div class="post-excerpt">[wpv-post-excerpt]</div>
  <div style="clear:both;"></div>
</div>
          
		</wpv-loop>
	<!-- 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]

It looks as though the author fields - which I have created as User Fields using Types - are displaying for the author of the page, rather than the author currently being displayed in the archive view. Is there anything I can do about this?

Many thanks

Hannah

#1212475

Hi Hannah,

Thank you for contacting us and I'll be happy to assist.

I couldn't find any change in recent Toolset Views plugin's release, which would affect the existing author archive views.
But to get the information from the user, whose author archive page is being viewed, you'll need a custom shortcode to get that author's ID, as suggested in this reply:
https://toolset.com/forums/topic/author-page-single/#post-618800

Please include this custom shortcode's snippet in theme's "functions.php" file and also go to Toolset > Settings > Frontend content and add "get_author_id_in_archive" in the "Third-party shortcode arguments" input field.

After that, you can update your view's [types] shortcodes as shown in this example:

Existing:


[types usermeta='profile-image' size='medium' align='left' resize='proportional' user_is_author='true'][/types]

Updated:


[types usermeta='profile-image' size='medium' align='left' resize='proportional' user_id='[get_author_id_in_archive]'][/types]

I hope this helps.

regards,
Waqar

#1212546

This worked perfectly, thanks so much for your help!