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
12Next »
  1. Missy
    Member

    Hi,
    I am looking to create a custom member list using a template file (I can't use the include public list shortcode as I need company name vs. user name)

    Usually I can connect to the WP database using something like

    <?php
    global $wpdb;
    $myrows = $wpdb->get_row("SELECT * FROM $wpdb->wp_eMember_members_tbl");
    
    echo $myrows->company_name;
    ?>

    I have tried a ton of different variations of the above and can not seem to pull records, what am I missing?

    Posted 9 months ago #
  2. amin007
    Key Master

    The syntax is wrong. The table name is a string field. Also you are getting one row from many rows in the database where is your "condition" so it knows which row to pick based on that condition?

    Posted 9 months ago #
  3. Missy
    Member

    LOL...honestly that was my just my latest attempt I was just trying to pull anything by then...I tried a bunch, at this point I had knocked all of my code to a simple pull just to see if I could connect, once I am pulling the records I can code out everything else, basically I want to pull all level 3 members, ordered by company name, and echo just the company name...just need a basic list at this point

    Eventually I want to link the company name to work similar to the member list shortcode opening a lightbox with the companies info...but I can get there once I can pull from the table

    Posted 9 months ago #
  4. Missy
    Member

    I have only pulled info from the WP tables...first time pulling from a plugins table

    Initially I think I had...

    $user_ids = $wpdb->get_col("SELECT member_id FROM $wpdb->wp_eMember_members_tbl ORDER BY company_name");
    
    echo $user_ids->company_name;
    Posted 9 months ago #
  5. amin007
    Key Master

    Your table name is definitely wrong. You can't access the eMember table name using the following since it not an object of the WPDB class.

    $wpdb->wp_eMember_members_tbl

    Try the following to get a feeling for how it works then you should be able to do more specific things:

    global $wpdb;
    $members_table_name = $wpdb->prefix . "wp_eMember_members_tbl";
    $resultset = $wpdb->get_results("SELECT * FROM $members_table_name", OBJECT);
    print_r($resultset);
    Posted 9 months ago #
  6. Missy
    Member

    THANKS!!

    I was able to get my list with this:

    <?php
    global $wpdb;
    $members_table_name = $wpdb->prefix . "wp_eMember_members_tbl";
    $resultsets = $wpdb->get_results("SELECT * FROM $members_table_name", OBJECT);
    
    foreach ($resultsets as $member):
    
    ?>
    <?php if($member->membership_level == 3) { ?>
    <li><?php echo $member->company_name; ?></li>
    
    <?php
    }
    endforeach;
    ?>
    Posted 9 months ago #
  7. Missy
    Member

    Back again...and almost there, hoping you may have some advice for me...I have listed my members by company name, turned them into links that when clicked open a modal overlay in jquery...but I am a complete novice in jquery and have no idea how to pass values from php and vice versa, so currently my overlay comes up but only displays the info for the first member record...thought you might have an idea since the shortcode list uses an overlay...AGAIN THANKS!!! Love the support you provide for your users who want to go offroading!!! lol

    <h2>List of Members:</h2>
    <script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
    
    <ul>
    
    <?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 == 3) { ?>
    
    <li><a href="#" class="modalInput" rel="#profile2" ?>"><?php echo $member->company_name; ?></a>
    </li>
    
    <!-- Profile Overlay -->
    <div class="modal2" id="profile2">
    
        <h2><?php echo $member->company_name; ?></h2>
        <dl>
            <dt>Address:</dt>
    
            <dd><?php echo $member->address_street; ?>
            <?php echo $member->address_city; ?> ,Fl
            <?php echo $member->address_zipcode; ?></dd>
    
            <dt>Phone Number:</dt>
            <dd><?php echo $member->phone; ?></dd>
    
        </dl>
    
    	<!-- close button -->
    	<p>
    		<button class="close"> Close </button>
    	</p>
    </div>
    
    <script>
    
    $(document).ready(function() {
    
    var triggers = $(".modalInput").overlay({
    
    	// mask tweaks
    	mask: {
    		color: '#ebecff',
    		loadSpeed: 200,
    		opacity: 0.9
    	},
    
    	closeOnClick: false
    });
    
    });
    
    </script>
    
    <?php
    }
    endforeach; //
    ?>
    
    </ul>
    Posted 9 months ago #
  8. akeith2002
    Member

    How would you get the current logged in user's membership info INCLUDING all custom registration fields ?!?

    Posted 8 months ago #
  9. akeith2002
    Member

    I got this going:


    <?php
    global $auth;
    $user_id = $auth->getUserInfo('member_id');
    if (!empty($user_id))
    {
    global $wpdb;
    $members_meta_table_name = $wpdb->prefix . "wp_members_meta_tbl";
    $resultset = $wpdb->get_results("SELECT meta_value FROM $members_meta_table_name WHERE user_id = $user_id", OBJECT);
    print_r($resultset);
    }
    ?>

    but it is returning the data in the way wordpress stores it:

    a:3:{s:6:"Gender";s:4:"Male";s:26:"Date_of_Birth__MM/DD/YYYY_";s:2:"es";s:5:"Sport";s:6:"Hockey";}

    How do I further decipher that?

    Posted 8 months ago #
  10. akeith2002
    Member

    Sorry I figured it out.

    unserialize();

    Posted 8 months ago #

RSS feed for this topic

12Next »

Reply »

You must log in to post.

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