Title: Shortcodes as Default Values
Last modified: February 9, 2018

---

# Shortcodes as Default Values

 *  Resolved [gxwpm](https://wordpress.org/support/users/gxwpm/)
 * (@gxwpm)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/)
 * Hey,
 * I have some shortcodes that just returns simple values like numbers or words 
   which is suitable to use as field values. Is it possible to implement them to
   UsersWP fields? I’ve tried to add a shortcode as default value but field took
   it as a simple text.
 * Thanks,

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9956251)
 * Hi [@gxwpm](https://wordpress.org/support/users/gxwpm/),
 * I am not exactly sure what you mean, can you explain a bit more or give examples?
 * Thanks,
 * Stiofan
 *  Thread Starter [gxwpm](https://wordpress.org/support/users/gxwpm/)
 * (@gxwpm)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9956328)
 * Sure,
 * I have a shortcode for myCRED that shows a point balance of my currently logged
   in user.
    Shortcode is [mycred_my_balance] and it returns a value like “24 Pts”
   when it is used. What I want is to create a field named “Points” that will show
   this shortcode returned value on my UsersWP profile (Points: 24 Pts). It shouldn’t
   be modified by user via Account page and must be ready-only.
 * I’ve tried to put it as a default value of a field but what I saw was “Points:[
   mycred_my_balance]”.
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9957671)
 * We don’t have a shortcode that does that, but we could give you a PHP snippet?
 * We have a myCRED [https://userswp.io/downloads/mycred/](https://userswp.io/downloads/mycred/)
   addon that will show users points and also allow them to get points for things
   and even transfer points to each other.
 * Thanks,
 * Stiofan
 *  Thread Starter [gxwpm](https://wordpress.org/support/users/gxwpm/)
 * (@gxwpm)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9959297)
 * Yeah, I’ve noticed that addon thinking to buy it after I completed implement 
   a profile management to my website. Still trying to configure and modify UsersWP.
 * And about snippet, any way that would help me to show some out of form data on
   UsersWP fields, would be ok for me. Sorry if I can’t describe well.
 * There are some shortcodes as I mentioned, not myCRED specific, any shortcode 
   from any plugin. One for example, returns user’s ID with something like [user-
   id]. All I try to do is, use this shortcodes inside my UsersWP fields.
 * I’ll create a field that named User ID and it’ll be admin managed field. I want
   to use it’s default value with a shortcode so that user may see it on his More
   Info tab as User ID: 23 etc.
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9959450)
 * (Off topic but, there is a 30 day guarantee if that addon does not work for your
   project)
 * You can get any UWP meta info with this function
    `uwp_get_option($key);` Where
   the $key is the fields “htmlvar_name” prefixed with uwp_ so if you have a field
   with “htmlvar name” of “gender” it would be `$gender = uwp_get_option("uwp_gender");`
 * If you simply want to show a field on the more info tab, just add the field and
   in the “show in what locations” option, select “more info tab”
 * Thanks,
 * Stiofan
 *  Thread Starter [gxwpm](https://wordpress.org/support/users/gxwpm/)
 * (@gxwpm)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9980211)
 * This function always return null for me. I’ve tried it with different fields 
   but result is same. I’ve tested my code for default WP functions to get some 
   user info and it worked.
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9981147)
 * Sorry, i gave you the wrong function, you want to get the user meta right?
 * If so it would be this function
    `$gender = uwp_get_usermeta( $user_id , $key
   = 'uwp_gender', $default );` If functions just like the WP version.
 * If i can help further just let me know.
 * Thanks,
 * Stiofan
 *  Thread Starter [gxwpm](https://wordpress.org/support/users/gxwpm/)
 * (@gxwpm)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9985776)
 * It still doesn’t return anything. Also tried this format but no luck;
    $gender
   = uwp_get_usermeta( $user_id , ‘uwp_gender’ , ” );
 * That’s a condition on one of my custom shortcodes that should return user’s gender
   on UWP.
 *     ```
       elseif ( $cmd == 'uwptest' ) {
       		  $user_id = get_current_user_id();
       		  $gender = uwp_get_usermeta( $user_id , $key = 'uwp_gender' , $default );
       		  return $gender;
       		}
       ```
   
 *  Plugin Author [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * (@stiofansisland)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9991148)
 * If you can post in out own forums we can assist you further : [https://userswp.io/support/forum/userswp-core-plugin/userswp-core-plugin-support/](https://userswp.io/support/forum/userswp-core-plugin/userswp-core-plugin-support/)
 * Thanks,
 * Stiofan

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Shortcodes as Default Values’ is closed to new replies.

 * ![](https://ps.w.org/userswp/assets/icon-256x256.png?rev=2784318)
 * [UsersWP - Front-end login form, User Registration, User Profile & Members Directory plugin for WP](https://wordpress.org/plugins/userswp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/userswp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/userswp/)
 * [Active Topics](https://wordpress.org/support/plugin/userswp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/userswp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/userswp/reviews/)

## Tags

 * [field](https://wordpress.org/support/topic-tag/field/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 9 replies
 * 2 participants
 * Last reply from: [Stiofan](https://wordpress.org/support/users/stiofansisland/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-as-default-values/#post-9991148)
 * Status: resolved