Shortcodes for custom fields – UserPro Forums https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/feed/ Sun, 05 May 2024 05:31:14 +0000 https://bbpress.org/?v=2.6.2 en-US https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41404 <![CDATA[Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41404 Wed, 16 Jul 2014 23:35:42 +0000 Nexnivis 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

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41407 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41407 Thu, 17 Jul 2014 04:58:49 +0000 test 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…

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41409 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41409 Thu, 17 Jul 2014 05:08:03 +0000 Ronnie Trainham Ooops.. I forgot to login to my account. Well atleast the test account has been tested..

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41411 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41411 Thu, 17 Jul 2014 09:46:32 +0000 Nexnivis 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]

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41412 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41412 Thu, 17 Jul 2014 13:45:07 +0000 Ronnie Trainham 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.

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41428 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41428 Fri, 18 Jul 2014 10:48:19 +0000 admin @Nexnivis – Check this – http://userproplugin.com/userpro/forums/topic/show-personalized-profile-data/

Is it the same thing you are looking for?

]]>
https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41434 <![CDATA[Reply To: Shortcodes for custom fields]]> https://forum.userproplugin.com/forums/topic/shortcodes-for-custom-fields/#post-41434 Fri, 18 Jul 2014 15:43:27 +0000 Nexnivis 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.

]]>