-
Hi there !
I love the conditionnal shortcode [profile_by_url], it’s a really great tool ! But I think we could make it more incredible by adding ability to display custom fields into it !
Currently we just can put [username], [role] etc…, but what about shortcodes for custom fields ? For example [field=”mycustomfield”], like this we can show the value of a custom field of the profile we are viewing !
I hope I’m understandable, sorry for my bad english !
Regards
This is already possible, unless I’m missing something.
[userpro template=view]
<–default profile by url view…
[userpro template=view yourcustomkey="customvalue"]
<–still using default by URL with your added key/value…Ooops.. I forgot to login to my account. Well atleast the test account has been tested..
Thanks Ronnie but it’s not what I’m looking for !
For example if I make this : [profile_by_url]Your are on the profile of [username], his role is [role][/profile_by_url] under the profile view. If I come on your profile I’ll obtain the sentence “You are on the profile of Ronnie, his role is subscriber”.
Now I want to put some custom fields into this. For example if I have a custom field “Town”, I want to make something like [profile_by_url]Your are on the profile of [username], his role is [role] and he live in [town][/profile_by_url]
Ahh, I see now..
You could always put something like this in your functions.php file.
NOTE:This is untested and will require a little more tweaking to get the output desired.
function custom_userpro_sc( $atts ) {
extract( shortcode_atts(
array(
‘user_id’ => ”,
), $atts )
);if ( isset( $user_id ) ) {
echo userpro_profile_data(‘custom_field_1’, $user_id);
}
add_shortcode( ‘cf_1’, ‘custom_userpro_sc’ );Then you could use the [cf_1 user_id=””] shortcode once you pass the $user_id as an attribute, possibly using a global var.
@Nexnivis – Check this – http://userproplugin.com/userpro/forums/topic/show-personalized-profile-data/
Is it the same thing you are looking for?
Hi Ahmed.
Yes I’m talking about these conditionnals shortcode, but I already use it since few months. I want to use custom fields with these shortcodes.
Currently we just can put some pre-defined fields into it (like [username], [role], etc…) but it would be amazing if we could show custom fields too.
You must be logged in to reply to this topic.