• Resolved vroom66

    (@vroom66)


    Hello I’m trying to pull a couple of fields out to use in another plugin which generates a spreadsheet for the resulting information.

    I apologise because I have no idea what I’m doing, but at the moment the spreadsheet is generating the columns but returning no information.

    This is what I’ve used so far:

    um_fetch_user( get_current_user_id() );
    echo um_user(‘grade’);

    Where grade is the identifier for the custom field – can anyone help me with what I need to put in?

Viewing 4 replies - 1 through 4 (of 4 total)
  • What you are looking for is um_filtered_value

    You can use it like this.

    
    um_fetch_user( get_current_user_id() );
    echo um_filtered_value('grade');
    

    If you are looking to get the raw data without any special formatting, you can use get_user_meta

    
    echo get_user_meta(get_current_user_id(), 'grade', true);
    

    I hope this helps. If it does, don’t forget to hit Solved.

    Thread Starter vroom66

    (@vroom66)

    Hello thanks for your help but unfortunately this still doesn’t work. Following is what I have:

    public function __construct( $user_id ){
    $this->custom1 = get_user_meta(get_current_user_id(), ‘grade_19’, true);

    It’s creating the column in the spreadsheet and on the forms just fine but not pulling the data in for some reason.

    Any clues?

    Shouldn’t you be passing the $user_id instead of getting the current logged in user like the following:

    $this->custom1 = get_user_meta( $user_id, 'grade_19', true );

    Thread Starter vroom66

    (@vroom66)

    You absolute legend! That worked! If you had any idea how long I’ve spent on this – thank you so very much!

    • This reply was modified 5 years, 11 months ago by vroom66.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using custom fields in other plugins’ is closed to new replies.