Events Made Easy Forums Tips Display custom fields

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #64269
    Anonymous
    Inactive

    Hi, I hope you are well
    On the WordPress profile page there is an EME settings section. I would like to be able to display the data of some custom member fields here. How can I do this?
    Have a nice day

    #64270
    Franky
    Keymaster

    While this is not covered by EME, it is by WP itself: you can create a hook and add info to the profile page:

    
    add_action('edit_user_profile', 'my_eme_user_profile') ;
    add_action('show_user_profile', 'my_eme_user_profile') ;
    function my_eme_user_profile($user) {
    ...
    }

    See the function eme_user_profile in eme_people.php as an example.

    #64280
    Anonymous
    Inactive

    Thanks a lot. After some works, it’s fine.
    I had some concerns with the eme_get_members_by_wpid_membershipid function which returns an array containing the member’s array, so I had to extract this second array first when I noticed. ($member=$member[0];) The snippet is following

    add_action('edit_user_profile', 'my_eme_user_profile') ;
    add_action('show_user_profile', 'my_eme_user_profile') ;
    function my_eme_user_profile($user){
    	$membership_id=1;
    	$wp_id=get_current_user_id();
    	$member = eme_get_members_by_wpid_membershipid($wp_id, $membership_id);
    	if (!empty($member)) {
    		$member=$member[0];
    		$answers=eme_get_member_answers($member['member_id']);
    		$coupon=$answers[0];
    		$conso=$answers[1];
    	?>
    	<h3>Carte de réduction</h3>
    	<li>Nombre de coupons disponibles : <php echo $coupon['answer'] ?></li>
    	<li>Dates des navigations payées par carte : <php echo $conso['answer'] ?></li>
    	<?php
    	}
    }
    

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Tips’ is closed to new topics and replies.
Scroll to Top