Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › How to get eMember member id from eStore customer record?
Tagged: emember integration
- This topic has 3 replies, 2 voices, and was last updated 11 years ago by admin.
-
AuthorPosts
-
December 10, 2013 at 3:53 pm #10210mskallaMember
I am using eMember and eStore using the 3.1 setup for integrating the two. When a user makes a purchase, their member ID is stored as part of the record, and is visible in the customer details. How can I access this value programmatically in PHP?
December 10, 2013 at 11:07 pm #59562adminKeymasterWhat are you going to use as the search key? The email address of the user?
December 11, 2013 at 3:03 pm #59563mskallaMemberI need to check if a member has purchased a specific store product to provide access to specific content on the site, so my plan is to get all customer records that include that product, and then get the member ID’s from those customers and compare it against the current user’s member ID. This is separate functionality from the membership levels, as the idea is to have the ability for users to register as free members, which will give them the ability to purchase access to specific content on the site. Paid members will get access to all content on the site, which is already in place.
My client is using PayPal as the payment processor and the e-mail address of the purchase is taken from the PayPal e-mail address, which is not necessarily the same as the member’s e-mail address used to become a member, so I cannot rely on the e-mail address of the customer record matching the e-mail address of the member record. An additional question would be how to programmatically get all customer records that have purchased a specific product, or better yet how to get all products purchased by a member in a more direct process than what I have described above.
December 12, 2013 at 1:21 am #59564adminKeymasterHere is an example code that will find all records where the customer purchased product 2.
$selected_product_id = "2";//eStore purchased product's ID
global $wpdb;
$customer_table_name = $wpdb->prefix . "wp_eStore_customer_tbl";
$resultset = $wpdb->get_results("SELECT * FROM $customer_table_name WHERE purchased_product_id IN ($selected_product_id) ORDER BY date DESC", OBJECT);
var_dump($resultset);//Just to see what it returnsI don’t know what exactly your client needs but you might have to use the following option if it is not one of our features:
-
AuthorPosts
- You must be logged in to reply to this topic.