Display a user custom field or data anywhere using PHP

You can use the userpro_profile_data() function to return any bit about a certain user using php

<?php
echo userpro_profile_data($field_to_retrieve, $user_id);
?>

Example : If we want to show a user’s first name

<?php
$user_id=66; // or the user ID you want to retrieve
echo userpro_profile_data('first_name', $user_id);
?>

This also can grab custom fields that you create:

<?php
echo userpro_profile_data('profession', $user_id);
?>

It can retrieve role, profile picture URL, anything:

<?php
echo userpro_profile_data('role', $user_id);
?>

Was this article helpful?

Related Articles

Leave A Comment?