Skip Navigation

[Resolved] User Custom Field Display

This support ticket is created 3 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/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by J S 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#1972801

J S
Screen Shot 2021-03-02 at 4.14.32 PM.jpg
Screen Shot 2021-03-02 at 3.46.04 PM.png
Screen Shot 2021-03-02 at 4.05.57 PM.png
Screen Shot 2021-03-02 at 4.06.20 PM.png
Screen Shot 2021-03-02 at 4.06.50 PM.png
Screen Shot 2021-03-02 at 4.07.12 PM.png

I'm really struggling here to get what should be a simple result. I would like to build a user directory that displays a list of users on this site with some of their custom fields. There would then be a link to a user profile page where I will display custom user field values next to the author's profile photo, and then display any blog posts, or publications below that, if they have any of either. If they do not have any posts, I would still like to display the user profile information. I would like the directory page to be filterable as well by a custom field if possible but I can come back to that.

I've considered and attempted many ways to create the profile pages I describe above, including using the profile page included with bbpress, using the author archive pages, creating a custom post type archive of members and some others but so far I'm not able to get the result I want. The closest seems to be to use the author page like this: hidden link as the profile page.

I have Toolset Access, Types, Forms and Blocks installed with legacy Views enabled. Here's where I am now which is very close but not there yet.

I've started to create a Toolset View that loops through custom user fields to create user directory (View) at this page: hidden link

In the last column of the table shown in the view linked above, I would like to link to a "user profile" page where I display custom user fields and a list of that user's standard WP Blog Posts and custom post type that will be created called "publications" if they have any.

The loop used in the view above uses the following syntax: <td>View Profile</td> to link to an author page. You can see this sort of works as any users listed in the user-directory that have blog posts display their standard user fields as instructed from WordPress Author Archive I've created using Toolset. For example user Arianna from the above table links to this page: hidden link
However, users that do not have blog posts, for example, user Adela hidden link does not show any of the standard user fields even though they have data, and I think this is because she doesn't have any blog posts. If you click through the directory view above you will see what I mean.

The other hang up is I am not able to display any of the custom user fields I've added to the user in the Custom User Fields Group called ACEER Profile. These fields are recognized when I use the "Fields and Text" block in building the Author Archive page, but are not pulling in any of the values for these fields when I try to display them next to the user's photo. These fields are not recognized when using the "single field" block at all.

I am not tied to using the author archive page to accomplish the desired user profile pages, and in fact, the permalink structure of aceer.com/profiles/username may be better than authors but am really stuck on the best way to get any of this functionality fully working and achieve the goal. Please let me know what I can do to accomplish my goal.

Thanks,
Jor

#1973251

Hello,

I suggest you try to get the current author archive user ID with a custom shortcode, then pass the value to Types shortcode as "user_id" attribute value, see similar thread here:
https://toolset.com/forums/topic/how-to-display-users-custom-fields-on-author-archive/

#1973603

J S

Thank you this seems to work for displaying the user fields, yay!

The next issue though is that none of the information shows, if the 'author' has no posts. If you click the View Profile link for each user this link, hidden link you will see that the author page is only displaying information for two of the authors as they are the only two with blog posts assigned to them.

How can I make the author profile page display the same for authors without any posts?

Thank you!

#1974283

You are right, there is a bug in that custom codes, it won't display correct user's ID when there isn't any result in author archive page, please try the solution of another thread:
https://toolset.com/forums/topic/rendering-the-correct-user-profile-values/

#1974645

J S

Ok I will try this. So you are saying to use this new shortcode you recommend in the 1974283 post instead of the previous code you mention in the 1973251 post? Or are you saying to somehow use both of these?

#1974843

J S

Thank you Luo! This is working now.

What would you recommend now for being able to create different lists (directories) of users based on the value specified in a custom field? I have a select field for each user called 'wpcf-aceer-role'. This field has several values (board member, intern, conservation fellow etc.). I would like to create pages for each of these types of users, i.e. a page for board members, a page for interns etc. On these pages, I want to link to the individual profile or author archives shown above.

I have a crude version of the complete user directory at this link: hidden link and the view profile link goes to the /author/username archive page as desired. I would like to either add a filtering option to the directory page (which I don't think is possible for user archives) or create several versions of the directory page, one for each user type.

What do you recommend for that?

Thank you!!

#1975235

I assume the original question of this thread is resolved, for other new questions, please check the new thread here:
https://toolset.com/forums/topic/create-different-lists-directories-of-users-based-on-the-value-specified-in-a-custom-field/

#1976905

J S

My issue is resolved now. Thank you!