Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Best method to get and set eMember member custom fields?

by

Tips and Tricks HQ Support Portal › Forums › WP eMember › Best method to get and set eMember member custom fields?

Tagged: get member data, set member data, user integration

  • This topic has 8 replies, 4 voices, and was last updated 2 months, 3 weeks ago by admin.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • January 8, 2014 at 7:09 pm #10377
    mskalla
    Member

    I am working on a project in which uses of one role ‘manage’ users of another role, and as such need to be able to view and edit other users’ data. This project is also using the eMember plugin with WP integration enabled (creating a member creates a WP user account, etc). Some user data fields are part of the WP user account, some are supplied by WP user metadata, some are part of the emember account, and some are from the emember plugin’s ability to create custom fields in the emember signup form. I can get WP user data and metadata, but how do I retrieve emember member data and metadata using a WP user ID? I need to be able to set the data as well as retrieve it. Are there any helper methods to handle any of the following tasks?

    • get an emember member ID from a WP user ID (not just the current logged in user, but any user by ID)
    • get emember data (stored in the wp_eMember_members_tbl database table)
    • set emember data (stored in the wp_eMember_members_tbl database table)
    • get emember metadata (stored in the wp_members_meta_tbl database table)
    • set emember metadata (stored in the wp_members_meta_tbl database table)

    Thanks for any help.

    January 9, 2014 at 10:49 pm #60201
    admin
    Keymaster

    Yeah, some of those should be doable via some helper functions and shortcodes. Check this post:

    How to Retrieve and Show Specific Details of the Logged-in Member

    We also have an API for creating member accounts from your own script:

    http://www.tipsandtricks-hq.com/wordpress-membership/api-creating-a-member-account-using-http-get-or-post-447

    January 10, 2014 at 11:53 am #60202
    mskalla
    Member

    I had looked through that page prior to posting (as well as here:

    WP eMember Miscellaneous Tweaks

    and here:

    How to Retrieve and Show Details of a Specific Member

    and here:

    How to Retrieve and Show Specific Details of the Logged-in Member

    None of these answer my questions.

    Again, I need to get and set member details, such as the address, city, state, zip, and phone number, (all of which are in the eMember signup form and do not seem to be changeable in any way after the user has submitted that form) using the member’s WP user ID, not their member ID. I do not only need to do this for the currently logged in user (allow the current user to view and edit their own membership data), but I need to allow users to be able to do this for other users as well, so being able to perform these operations on just the currently logged in user is not what I need. Finally, none of these above pages have anything at all about setting any of these values, even for the current user.

    Thanks again for any further assistance.

    January 11, 2014 at 2:08 am #60203
    admin
    Keymaster

    I see what you mean. We don’t have any option for what you asked.

    January 14, 2014 at 6:33 pm #60204
    mskalla
    Member

    Ok, thanks, that is what I needed to know!

    February 21, 2025 at 6:18 am #85139
    jubel
    Participant

    Retrieving Custom Fields is easy for me, with methods, which emember brings with it self. Following shortcode I use to retrieve standard and custom fields:

    add_shortcode(‘user_prop’, function() {
    $emember_auth = Emember_Auth::getInstance();
    $user_id = $emember_auth->getUserInfo(‘member_id’);
    if (!empty($user_id))
    {
    //User is logged in so add your conditional code here
    $membership_level = $emember_auth->getUserInfo(‘membership_level’);
    if($membership_level == 2)
    {
    $emember_auth = Emember_Auth::getInstance();
    $username = $emember_auth->getUserInfo(‘user_name’);
    echo (“Username of the logged in member: “.$username . “<br />\n”);
    echo (“Mitgliedslevel: Abonnent” . “<br />\n”);
    $member = emember_get_member_by_username ($username);
    echo (“Member’s First Name: ” . $member->first_name . “<br />\n”); //Output the first name
    echo (“Member’s Last Name: ” . $member->last_name . “<br />\n”); //Output the last name
    $value = $emember_auth->getUserInfo(‘Kursleiter’);
    echo (“Kursleiter: ” . $value . “<br />\n”); //Output a custom field ???
    $value = $emember_auth->getUserInfo(‘Umfragenteilnehmer’);
    echo (“Umfragenteilnehmer: ” . $value . “<br />\n”); //Output a custom field ???
    }
    else
    {
    echo “no Abonnent”;
    }
    }
    });

    But changing to Form Builder (I hope I am not off topic here whith it) lets me not retrieve the custom field Kursleiter.
    How I have to do this?

    February 21, 2025 at 10:15 pm #85140
    admin
    Keymaster

    Here is an example code showing how you can access the custom fields of Form builder addon.

    
    $member_id = "123";
    $field_key = 'kursleiter';
    $custom_value = wp_emember_get_user_details_by_id($field_key, $member_id);
    echo "Value of Kursleiter: " . $custom_value ;
    
    February 23, 2025 at 2:13 pm #85141
    jubel
    Participant

    Thank you! This was very helpful!
    Is there something like:

    wp_emember_put/set/ or write_user_details_by_id($field_key, $member_id);

    ???

    February 25, 2025 at 12:54 am #85143
    admin
    Keymaster

    No, the update should be done by using database query. We don’t advertise any feature like that so there is no method for it out of the box.

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ