Skip Navigation

[Résolu] Views – get user data via a user-id

This support ticket is created Il y a 9 années et 10 mois. 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
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 22 réponses, has 4 voix.

Last updated by tony Il y a 9 années.

Assigned support staff: Adriano.


You are welcome.


Hi there - I need to do something very similar but because the conclusion of this took place offline I can't see the final function - would be great if you could share the code Tony. Thanks!



The code that is in my functions.php file is:

add_shortcode( 'wpv-post-userdata', 'wpv_userdata');
function wpv_userdata($atts){
extract( shortcode_atts( array(
'field_user' => '',
'id_user' => '',
), $atts ) );

$user_info = get_userdata($id_user);

if($field_user == 'user_email'){
if($field_user == 'user_firstname'){
if($field_user == 'user_lastname'){

I hope this helps.



Much obliged Tony - could you also confirm how the shortcode should look in the post? thank you 🙂


OK I have not completed my implementation, but this was used as a test:

Details of users

1=[wpv-post-userdata field_user="user_firstname" id_user="1"] [wpv-post-userdata field_user="user_lastname" id_user="1"] [wpv-post-userdata field_user="user_email" id_user="1"]

2=[wpv-post-userdata field_user="user_firstname" id_user="2"] [wpv-post-userdata field_user="user_lastname" id_user="2"] [wpv-post-userdata field_user="user_email" id_user="2"]

3=[wpv-post-userdata field_user="user_firstname" id_user="3"] [wpv-post-userdata field_user="user_lastname" id_user="3"] [wpv-post-userdata field_user="user_email" id_user="3"]

4=[wpv-post-userdata field_user="user_firstname" id_user="4"] [wpv-post-userdata field_user="user_lastname" id_user="4"] [wpv-post-userdata field_user="user_email" id_user="4"]



Superb, many thanks


Hi, could you post the final custom function please ?



The code I used is displayed above (June 26, 2013 at 11:16 am).

I hope this helps.