Events Made Easy Forums How do I … accessing member details in php

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #61200
    Anonymous
    Inactive

    Hi Franky,

    I’m trying to make a kind of ‘my_account’ page and want to use member details. To see what’s available I first tried to see what’s in the arrays as in the Payment description filters example on the hooks and filters documentation page. I used that code recently and it worked fine. Now I’m trying the below code, but it seems the arrays are empty.

    I prefer to do it in a shortcode to avoid code duplication on my page with all the eme if tags, but if another way is possible that would of course also be fine.

    (btw: I was trying the code while logged in as a member with status pending).

    
    function member_and_membership_details() {
    	$member = eme_get_member($payment['member_id']);
        $membership = eme_get_membership($member['membership_id']);
        $person = eme_get_person($member['person_id']);
    	
    	$html = '<pre>'.print_r($member, true).print_r($membership, true).print_r($person, true);
    	
    	
    	return $html;
    }
    add_shortcode('MEMBER_AND_MEMBERSHIP_DETAILS', 'member_and_membership_details');
    #61202
    Franky
    Keymaster

    Adding a shortcode also implies calling the shortcode. It all depends on how you call it, using do_shortcode you need to pass the $payment array as a variable.

    #61204
    Anonymous
    Inactive

    Oh bloody I need the $payment variable of course…

    I use the shortcode on my page inside a Divi module, so there I can’t call do_shortcode. Of course Divi processes the entire page and does call do_shortcode. However that way I can’t get the $payment variable in. Would there be a way to get to the $payment variable by a call from within the function that processes my shortcode?

    #61205
    Anonymous
    Inactive

    If the $payment variable is available at all at that time of course…else I would need something else to get access to the details of the member and membership 🙂

    #61206
    Franky
    Keymaster

    The $payment variable is only available in specific EME functions, it is not a global variable.
    What is available is the wordpress logged in user id, and then you can get the linked EME person id and all the linked memberships too. See the calls eme_get_active_membershipids_by_wpid and eme_get_memberids_by_wpid.
    However, it seems you’d need something like a [eme_mymemberships] shortcode (similar to [eme_mybookings]). That shortcode is yet to be written 🙂 I’ll see if I can cook up something. Edit: in fact that already exists (seems I forgot to document it), but it can use some improvement (no template yet).

    #61207
    Anonymous
    Inactive

    Thanks Franky!

    I’ll have a look into this tomorrow…it’s getting late again.

    Would be very great to see what you come up with, but no need to rush 😉

    #61208
    Franky
    Keymaster
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top