Skip Navigation

[Resolved] When I updated Types to version 3.0, the User Fields feature disappeared.

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: Asia/Hong_Kong (GMT+08:00)

This topic contains 11 replies, has 3 voices.

Last updated by Luo Yang 3 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1675357

*Tell us what you are trying to do?
I have updated version 2.3.5 of Types.
Then, the User Fields feature will disappear from the Toolset.
I will no longer be able to call up my registered User Fields data from the author archive.

*Is there a similar example that we can see?
yourwebsite.com/author/100891
Please hide this URL.

This is the version of the plugin we are using on this test site.
Types 3.0
Views 3.2.0

#1675881

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

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

Is there any reason you're not using the latest Types version 3.3.11 on the website?

To troubleshoot this, I'll suggest the following steps:

1. Please make sure that WordPress, active theme, and plugins are all updated to the latest versions.

2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty.

If it's fixed, you can start adding the disabled items, one-by-one, to narrow down to a possible conflicting one.

3. In case the issue still persists, I'll need to see how this author archive and the user fields are set up in the admin area and you can share temporary admin login details in reply to this message.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

I hope this helps and please let me know how it goes.

regards,
Waqar

#1680323

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

user-fields-example.png

Thank you for sharing the admin access, but when I tried to access the admin area, it showed me access denied message from the Xserver.

As for the user custom fields, there is no separate menu item for that and you can access them from WP Admin -> Toolset -> Custom Fields, as shown in the attached screenshot.

Note: In case the issue still persists, please temporarily disable any security settings from the server, which can block the access to the admin area, so that I can log in and troubleshoot, accordingly.

#1682179

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing the admin access.

I noticed that the shortcodes for the user custom fields have been placed in the "Search and Pagination" section of the author archive ("WordPress Archive for Author2"), which is outside the loop of the author archive page.

There have been some changes introduced to the newer Views version in how the user's ID is processed in archives, which is why it is possible that these fields worked in the previous versions, but not with the latest one.

To fix, I'll suggest the following steps:

1. Please make sure all Toolset plugins are updated to the latest versions.

2. You'll need a custom shortcode that can return the ID of the user whose author archive page is being viewed:


function get_author_id_in_archive_func($atts) {
  $author_id = 0;
  if (is_author()){
    $author = get_queried_object();
    $author_id = $author->ID;
  }
  return $author_id;
}
add_shortcode("get_author_id_in_archive", "get_author_id_in_archive_func");

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.

3. Next, please add "get_author_id_in_archive" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

4. After that, you can update all "types" shortcodes to show user custom fields in the "Search and Pagination" section of the author archive to include this user ID in the "user_id" attribute:

For example, the old shortcodes:


[types usermeta='sp_icon'][/types]

[types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_is_author='true'][/types]

[types usermeta='sp_postalcode' format='〒: FIELD_VALUE' user_is_author='true'][/types]

Will become:


[types usermeta='sp_icon' user_id='[get_author_id_in_archive]'][/types]

[types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_id='[get_author_id_in_archive]'][/types]

[types usermeta='sp_postalcode' format='〒: FIELD_VALUE' user_id='[get_author_id_in_archive]'][/types]

I hope this helps and please let me know if you need any further assistance around this.

#1682697

Thank you! Thank you! Thank you, Waqar!!

But, I'm sorry. I can't find the next.
・"Front-end Content" of step3
・"Search and Pagination" of step4

So I can't change my user custom fields settings.
Please tell me settings URL.

regards,
Naoko

#1683537

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and glad that my message helped.

I've noticed that the Toolset Views plugin is no longer active on the website, which is why you're not able to reach the options mentioned in steps 3 & 4.

Please activate Toolset Views first and then you'll see the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
( screenshot: hidden link )

After that, go to WP Admin -> Toolset -> WordPress Archives and look for the archive assigned to the "Author archives". On its edit screen, you'll see the "Search and Pagination" section with the user field shortcodes.

#1684055
スクリーンショット 2020-07-02 0.07.48.png

I really appreciate your help.
I was able to solve most of them.
But I can't solve one thing.

Conditional statement in usermeta='sp_icon' is not judged well.
If an image is registered, I want to display it, but if it is not registered, I want to display "No Image".
Now, it always shows "No Image".

             <!-- データがない場合NoImage -->
          [wpv-conditional if="( '[types usermeta='sp_icon' user_id='[get_author_id_in_archive]'][/types]' eq '' )"]<img border="1" src="/wp-content/uploads/2017/10/tette-noimage.png">[/wpv-conditional]        
              [types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_id='[get_author_id_in_archive]'][/types]
#1684065
スクリーンショット 2020-07-02 0.07.48.png

I'm sorry. I think I accidentally made the same post twice.

**********

I really appreciate your help.
I was able to solve most of them.
But I can't solve one thing.

Conditional statement in usermeta='sp_icon' is not judged well.
If an image is registered, I want to display it, but if it is not registered, I want to display "No Image".
Now, it always shows "No Image".

             <!-- データがない場合NoImage -->
          [wpv-conditional if="( '[types usermeta='sp_icon' user_id='[get_author_id_in_archive]'][/types]' eq '' )"]<img border="1" src="/wp-content/uploads/2017/10/tette-noimage.png">[/wpv-conditional]        
              [types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_id='[get_author_id_in_archive]'][/types]
#1685199

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Glad that you've been making progress.

To correctly show a fallback image when no image is available from the field, you'll need to use two separate conditional blocks.
( one for the case when user field image not available and the other for when it is available )

Example:


<!-- case when no image is available from the field -->
[wpv-conditional if="( '[types usermeta='sp_icon' user_id='[get_author_id_in_archive]'][/types]' eq '' )"]
	<img border="1" src="/wp-content/uploads/2017/10/tette-noimage.png">
[/wpv-conditional]

<!-- case when an image is available from the field -->
[wpv-conditional if="( '[types usermeta='sp_icon' user_id='[get_author_id_in_archive]'][/types]' ne '' )"]
	[types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_id='[get_author_id_in_archive]'][/types]
[/wpv-conditional]

This should do the trick.

#1692471

I am very sorry for the very late reply. Thank you so much for the other day!

I've tried your code. But in all cases
<! -- case when no image is available from the field -->
is executed.

#1692649

Hello,

Waqar is on vacation, I will take care this thread.

I am checking it in your website, will update here if find anything.

#1692667

I have done below modifications in your website:
1) Add below codes in Snippet "Toolset":
hidden link

function get_author_image_in_archive_func($atts) {
  $author_id = get_author_id_in_archive_func($atts);
  $sp_icon = '';
  if($author_id){
	  $sp_icon = get_user_meta($author_id, 'wpcf-sp_icon', true);
  }
  return $sp_icon;
}
add_shortcode("get_author_image_in_archive", "get_author_image_in_archive_func");

Above codes will create a new shortcode [get_author_image_in_archive] to retrieve author's image field "sp_icon" value

2) Dashboard-> Toolset-> Settings-> Front-end content, in section "Third-party shortcode arguments", add above shortcode name: get_author_image_in_archive

3) Edit WordPress archive "WordPress Archive for Author2":
hidden link
in section "Search and Pagination", change the codes as below:

          [wpv-conditional if=" ( '[get_author_image_in_archive]' eq '' )"]
          	<img border="1" src="<em><u>hidden link</u></em>">
          [/wpv-conditional]
          	[types usermeta='sp_icon' alt='%%ALT%%' title='%%TITLE%%'  align='center' resize='proportional' user_id='[get_author_id_in_archive]'][/types]

Please test again, check if it is fixed. thanks

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