How can I capture Memberpress user info after signup
I'm currently working on a website where users can purchase subscriptions using memberpress, I want to capture the user data after the signup process is completed and the payment transaction is also completed as well. If I add the member through dashboard manually I'm able to catch the user info as there is no payment gateway is involved, with this code
function mepr_capture_new_member_added($event) {
$user = $event-get_data();
//mail('myemail', 'mp user added', 'new user added successfully');
}
add_action('mepr-event-member-added', 'mepr_capture_new_member_added');
As I'm new to WordPress development I don't know how I can access this data on my other page templates, that's why I'm sending an email to test if it works or not I was able to figure out the action hook for the transaction-completed event, but it doesn't seem to work properly. Here is the code
function mepr_capture_new_one_time_sub($event) {
$transaction = $event-get_data();
$user = $transaction-user();
//mail('myemail', 'user purchased subscription', 'user-transaction-completed event captured '); }
add_action('mepr-event-non-recurring-transaction-completed', 'mepr_capture_new_one_time_sub');
I've read the complete memberpress documentation but the resources related to development are not what I'm looking for, they gave an option for webhooks and I can capture the data on zapier after user signup and payment transaction is completed but I need the data on my website so Zapier is not an option, they also provide the rest API but I want to capture the user information on 'signup and transaction complete' event and I don't think so that's possible with rest API, Please let me know how I can overcome this issue, any kind of help will be appreciated.
Topic development-strategy rest-api membership customization plugins Wordpress
Category Web