From WatuPRO version 4.1.1 and above you no longer need additional plugins to display data from user profile of the logged in user (if you want to display data for another user read the section “Passing User ID” at the bottom). WatuPRO defines own shortcodes that are super easy to use.
If you are using the light version – the free Watu plugin, the shortcode [watu-userinfo] works exactly the same way.
Here is what you need:
[watupro-userinfo profile_field] where “profile field” is the field from the user profile you want to display. For example:
[watupro-userinfo display_name] will display the user display name
[watupro-userinfo first_name] and [watupro-userinfo last_name] will display respectively the first and last name and so on. The full list of default user fields is here:
But this is not all. You can also display ANY value from the user_meta table as long as you know the key, even if it’s created by another plugin. For example [watupro-userinfo namaste_points] will display the points collected in Namaste! LMS and so on.
One great plugin for managing user_meta is Advanced Custom Fields.
Showing Defaults (and handling non-logged in users)
You can prepare a default value to be shown if the user is not logged in, or simply if the value is empty. You just need to pass the default as second argument to the shortcode. Here is example:
Hello [watupro-userinfo first_name "Friend"]!
Passing User ID
This feature requires min. WatuPRO version 220.127.116.11.
By default this shortcode displays data for the currently logged in user. However you can pass user ID by adding “user_id” attribute after the other attributes. The user_id attribute can contain fixed number (the ID of the user). In certificates it can contain “certificate” in which case the user ID will be figured out from the certificate owner (please don’t use “certificate” outside of the certificate contents, it will not work).
[watupro-userinfo first_name "Friend" user_id="5"]
[watupro-userinfo user_url user_id="certificate"]
The user_id attribute can contain “quiz-taker” in the page that lets you configure email for manually edited results (Intelligence module). Example:
[watupro-userinfo first_name "Friend" user_id="quiz-taker"]
That’s it. Use the new shortcodes in the final screen, in certificates, in the email contents, anywhere. You can use them even in areas outside of WatuPRO – for example in post or pages, in the sidebar, etc.