Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password? (Having an issue with the forum login?)

Search the Forum

Tips and Tricks HQ Forum » WP eMember » WP eMember Tweaks

Pulling member info

(17 posts) (7 voices)
  • Started 9 months ago by Missy
  • Latest reply from admin
  • Possible Solutions (Related Topics):
    1. Pulling member login info for other application
    2. How to Retrieve and Show Specific Details of the Logged-in Member
    3. eMember - Login widget displaying random member info
    4. eMember - Can information be dripped to members?
    5. Additional info on members: Title

Tags:

  • current
  • Custom
  • data
  • fields
  • get
  • information
  • list
  • member
  • PHP
  • pull
  • registration
  • user
« Previous12
  1. thomasbrunkard
    Member

    akeith2002 : Would you be able to share your code with me? I'm trying to create custom pages that display all data a user has (including custom fields). My problem comes in with the custom fields part - how do you decipher that serialized data?

    Cheers!

    Posted 6 months ago #
  2. admin
    Key Master

    Use the unserialize() function and it will put the serialized data in a nice array that you can use. For example:

    $custom_fields_arry = unserialize("serialized-custom-data");
    print_r($custom_fields_arry);
    Posted 6 months ago #
  3. sol
    Member

    Hi,

    just to say that this post was great to figure out what I needed. Here is how I used and adapted it - watch out that you change the membership level to be displayed if you want to have a different one then 2. If you put it into a page, you also need to have a wordpress php plugin like php exec installed.

    <div align="center">
    <div>
    <table>
    <thead>
    <tr>
    <td align="center">
    <div>Surname</div></td>
    <td align="center">
    <div>First name</div></td>
    <td align="center">
    <div>Company</div></td>
    <td align="center">
    <div>Country</div></td>
    </tr>
    </thead>
    <tbody>
    <?php
    global $wpdb;
    $order = 'company_name';
    $members_table_name = $wpdb->prefix . "wp_eMember_members_tbl";
    $resultsets = $wpdb->get_results("SELECT * FROM $members_table_name ORDER BY $order", OBJECT);

    foreach ($resultsets as $member):

    ?>

    <?php if($member->membership_level == 2) { ?>
    <tr>
    <td align="left"><?php echo $member->last_name; ?></td>
    <td align="left"><?php echo $member->first_name; ?></td>
    <td align="left"><?php echo $member->company_name; ?></td>
    <td align="left"><?php echo $member->country; ?></td>
    </tr>
    <?php
    }
    endforeach; //
    ?>
    </tbody>
    </table>
    </div>
    </div>

    Posted 4 months ago #
  4. pachoolee

    I followed the posts above, but I am still having problems displaying/utilizing the custom fields.

    Here is the code:
    if (!empty($user_id)) {
    global $wpdb;
    $members_meta_table_name = $wpdb->prefix . "wp_members_meta_tbl";
    $metadata = $wpdb->get_results("SELECT meta_value FROM $members_meta_table_name WHERE user_id = $user_id", OBJECT);
    // print_r($metadata);
    $unsermetadata = unserialize($metadata);
    }

    I get this warning:
    Warning: unserialize() expects parameter 1 to be string, array given

    The print_r returns:
    Array ( [0] => stdClass Object ( [meta_value] => a:4:{s:15:"I_need_one";s:7:"checked";s:10:"Cell_Phone";s:9:"219999999";s:10:"Sponsor_ID";s:1:"2";s:10:"Sponsee_ID";s:0:"";} ) )

    Posted 4 months ago #
  5. admin
    Key Master

    If you are not a PHP developer then take advantage of the shortcodes that lets you display any details of the logged in user. For example, the following shortcode will display the email address of the logged in member:

    [wp_eMember_user_details user_info="email"]

    You can use the above shortcode to display the custom fields too.

    Check the shortcodes page for more details:
    http://www.tipsandtricks-hq.com/wordpress-membership/wp-emember-shortcodes-and-functions-reference-124

    Posted 4 months ago #
  6. pachoolee

    This is an insulting answer. I'm not that great at PHP but I've been coding for 20 years. I need to do more than display fields. I need to retrieve them and go after the database. Why include this option if you can't give the option to do more than display them?

    Posted 4 months ago #
  7. admin
    Key Master

    Both the code and the shortcodes work but you have mistakes in your code. You understand that it is not our job to fix someone else's code right? When we see someone struggling with the code we recommend them to use the shortcode as you can't really make mistakes with them (not sure how this recommendation is insulting).

    Posted 4 months ago #

RSS feed for this topic

« Previous12

Reply

You must log in to post.

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin