• Resolved malyjan

    (@malyjan)


    Hi,

    first of all thanks for such a great plugin!

    I heavily utilise CMB2 in my developments and now came across an issue that I am unsure how to resolve. I need to show a user edit form on the frontend where users can update their profile including their email address and some custom fields created with CMB2.

    Is it possible to include and update standard wordpress fields (eg. user_email) within a metabox on the frontend?

    I can of course include an email field and update the user_email if that is submitted or changed but want to avoid denormalisation if possible at all.

    Your help is much appreciated.

    Kind Regards
    Jan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I know it can be used for extra user meta, but that would be content going to the wp_usermeta table. The user_email field example is an item listed in the wp_users table.

    That said, I’m certain that you can set up fields for the items in question, and then intercept the saving of the meta. This would allow you to do whatever you want with the submitted data. You could use that detail plus https://codex.wordpress.org/Function_Reference/wp_update_user for example.

    Just for the sake of a concrete example, I know I’ve done a setup with CMB2 a metabox on a post editor was actually tied to the value saved in the options table. Also updating/changing the value on the post screen would actually save as that same option. There isn’t meta saved to the actual post, it’s all tied to said option 🙂

    Thread Starter malyjan

    (@malyjan)

    Hi Michael,

    excellent suggestion, tried, tested and implemented!

    Thanks a lot!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome. 😀

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

The topic ‘Non custom fields within CMB2’ is closed to new replies.