Functions for User-Meta

This topic contains 5 replies, has 2 voices, and was last updated by  Stiofan O’Connor 6 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #1652

    gxwpm
    Buyer
    Post count: 8

    Hey,

    I’m having problems to get user-meta that added with UserWP. Here’s the function that I’ve tried;

    
    
    elseif ( $cmd == 'uwptest' ) {
    		  $user_id = get_current_user_id();
    		  $gender = uwp_get_usermeta( $user_id , $key = 'uwp_gender' , $default );
    		  return $gender;
    		}

    also I’ve tried it like that;

    $gender = uwp_get_usermeta( $user_id , ‘uwp_gender’ , ” );

    These functions return null or default value if I entered it directly here on code. I’ve also tried some WP default functions and other plugin functions to see I’ve an error my code, but others worked as expected.

    WP version: 4.9.4
    UsersWP version: 1.0.12

    #1653

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    Thanks for posting, can u provide wp-admin details in a private reply (only staff can see) and i will setup and example for you on your site.

    Thanks,

    Stiofan

    #1654

    gxwpm
    Buyer
    Post count: 8

    Sorry, I can’t do that. Is there any other way for you to help?

    #1655

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Try i just relaised the prefix has changed since release, its now ‘uwp_account_’, see the example below;

    
    
    add_action('wp_footer','_my_uwp_test');
    function _my_uwp_test(){
      echo uwp_get_usermeta( get_current_user_id() ,  'uwp_account_gender', 'no value set' );
    }

    Thanks,

    Stiofan

    #1662

    gxwpm
    Buyer
    Post count: 8

    Hey, It works perfectly now. Thank you.

    #1668

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You are welcome, thanks for your patience! 🙂

    Stiofan

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket