Title: error saving user data
Last modified: January 21, 2018

---

# error saving user data

 *  Resolved [tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/)
 * (@tonvandervalk66)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/)
 * This shortcode:
    [pods name=”user” form=”1″ fields=”vakx, vaky, vakz”] shows 
   the form I want, but it does not save. I get the following error: User data is
   required, but wrong or empty
 * The shortcode builder from the menu did not work, so I do not really trust it.
   It suggests I need to add a slug.
    [pods name=”user” slug=”tony” form=”1″ fields
   =”vakx, vaky, vakz”] This shortcode turns out nothing at all.
 * What I want to achieve is that the logged in user can edit some custom fields
   of his own profile. What shortcode do I need?

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

 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9887074)
 * Thanks for the additional information, @tonvadervalk66
 * Looks like you’ve extended the User WordPress Object. I’ll be honest with you;
   User’s aren’t really designed for front-end editing, since you’d need to protect
   the form to not be shown to someone who wasn’t logged in and you’d need to dynamically
   populate the id (user’s don’t have ‘slugs’) for the form.
 * We have [Special Magic Tags](https://pods.io/docs/build/special-magic-tags/) 
   that provide dynamic values to where clauses and other portions of the shortcode,
   but I”m not sure they can be used in the `id=` parameter in the shortcode.
 * I’m not at home at the moment so can’t test this one, but if you’ll give me until
   tomorrow, I can setup a configuration like yours and test a shortcode and see
   if works properly and report back.
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9887081)
 * You’d be looking at the `{@user.any}` Special Magic Tag, specifically `{@user.
   id}`. I’m thinking `where="ID = {@user.id}"`. I just need to confirm that will
   work to load the current user without requiring the `id=` parameter to be included.
 *  Thread Starter [tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/)
 * (@tonvandervalk66)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9887136)
 * Thank you, I tried this shortcode:
    [pods name=”user” form=”1″ where=”ID = {@user.
   id}” fields=”leeftijd”]
 * I got this result:
    Database Error; SQL: SELECT DISTINCT `t`.* FROM `wphy_users`
   AS `t` WHERE ( ( ID = {@`user`.`id`} ) AND ( `t`.`user_status` = 0 ) ) ORDER 
   BY `t`.`display_name`, `t`.`ID` LIMIT 0, 15; Response: You have an error in your
   SQL syntax; check the manual that corresponds to your MySQL server version for
   the right syntax to use near ‘@`user`.`id`} ) AND ( `t`.`user_status` = 0 ) )‘
   at line 7
 * Next I tried:
    [pods name=”user” form=”1″ where=”{@user.id}” fields=”leeftijd”]
   and got exactly the same error.
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9887211)
 * There’s a configuration step you have to do in your wp-config.php to allow the
   dynamic fields to work. It’s noted in that Special Magic Tags docs linked above.
 * That explains the first error. Your second where would not work because where
   clauses are always some kind of equality statement, like `id=5`. The `{@user.
   id}` is ideally supposed to convert to the logged in users I’d before being sent
   into the shortcode. That’s what I’ll be testing when I get home later tonight.
 *  Thread Starter [tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/)
 * (@tonvandervalk66)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9887472)
 * I updated the wp-config file with the given code and now I can save the form 
   fields succesfully. That’s another step forward!
 * However when inspecting the field in the userprofile from the backend I see they
   did not get updated. Neither for the admin nor for a subscriber.
 * Second I need the default values for the fields in the extended user fields pod
   to retrieve the current values. Could I use the same Special magic tag for that?{
   @user.id}
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9888871)
 * You can use `[pods id="{@user.ID}"]` format if you enable shortcode special tag
   evaluation in wp-config.php with `define( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS',
   true );`
 * It’s not enabled by default because the special magic tags allow other server-
   related output beyond just the current user ID.
 *  Thread Starter [tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/)
 * (@tonvandervalk66)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9889042)
 * Alright, I used this shortcode and it works now
    [pods name=”user” form=”1″ where
   =”id={@user.id}” fields=”fielda, fieldb, fieldc”]
 * In the pod settings I entered the corresponding field magic tags like {@user.
   fielda} and now these custom user fields can be loaded and saved from the frontend.
   That was my goal and you guys helped me to achieve it.
 * I am truly impressed. Thank you!
    -  This reply was modified 8 years, 4 months ago by [tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/).
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9889330)
 * [@tonvandervalk66](https://wordpress.org/support/users/tonvandervalk66/) Very
   happy that worked for you! You beat me to testing this myself, though I’m still
   going to because we do need to confirm that just the `id="{@user.id}"` works 
   as well as the `where` clause.
 * You do still want to make sure that this form can be restricted to logged in 
   users. I’d suggest looking at Members plugin by Justin Tadlock. You can easily
   restrict a WP Page with a shortcode in it to be only viewable by logged in users,
   or you can wrap our shortcode with one from his plugin to restrict to only logged
   in users.

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

The topic ‘error saving user data’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Jim True](https://wordpress.org/support/users/jimtrue/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/error-saving-user-data/#post-9889330)
 * Status: resolved