• Resolved throm17

    (@throm17)


    Hello,

    I have a question, with this code, i can to collect the value of “phone_number” of user connected in the web site.

    $user_id = um_user(‘ID’);
    um_fetch_user( $user_id );
    $meta_value = um_user(‘mobile_number’);
    echo $meta_value;

    But i would like to collect the value of “phone number” of the user that I’m watching

    For more details if i see the profil “francecasting.fr/user/james”, i would like to see the information of james and not user connected.

    Regards,

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 26 total)
  • Hi @throm17

    Please try this for returning the unfiltered value of the user data.

    
    $user_id = um_user('ID');
    um_fetch_user( $user_id );
    $meta_value = get_user_meta($user_id, 'mobile_number', true );
    echo $meta_value;
    

    You can try this one for a filtered version

    
    $user_id = um_user('ID');
    um_fetch_user( $user_id );
    $meta_value = um_filtered_value( 'mobile_number' );
    echo $meta_value;
    
    Thread Starter throm17

    (@throm17)

    Hi @suiteplugins

    Thanks for your answer !

    This code don’t working, they returning the value of user connected, not user selected.

    Do you any over idea ?

    And I have a second question, when i want display a picture with this code :

    $user_id = um_user(‘ID’);
    um_fetch_user( $user_id );
    $meta_value = um_filtered_value( ‘profile_picture’ );
    echo $meta_value;

    I get :
    stream_photo_b90a0f1f_5216da8f479eaf8ac81c5d848023ecb57b85c12e.jpg

    Regards,

    In what file are you placing the code and what page is it showing on?

    Is profile_picture your custom user meta? Do you know where the files are stored?

    Thread Starter throm17

    (@throm17)

    I use the Woody Snippets plugin for code in php.

    And i place the short code in user page ( Ultimate member page)

    Thread Starter throm17

    (@throm17)

    And yes it’s my meta key.

    Ok. So you would like it to get the photo of the currently logged in user OR the photo for the profile that you are looking at?

    Thread Starter throm17

    (@throm17)

    I would like to get the photo for the profile that you are looking at

    Try this

    
    $user_id = um_get_requested_user();
    um_fetch_user( $user_id );
    $meta_value = um_filtered_value( 'profile_picture' );
    echo $meta_value;
    

    um_get_requested_user() – Gets the ID of the current profile ID.

    Thread Starter throm17

    (@throm17)

    I have no result whith this code

    Hmm. Very strange. Try echo $user_id to make sure you are getting the correct profile ID in your shortcode.

    If you have access to your database, check the usermeta table and see if there is a meta_value for the meta_key profile_picture and the User ID from echo.

    Thread Starter throm17

    (@throm17)

    With i try “echo $user_id for all profil, i have number 31.

    Where i find the database in filezilla, in which file ?

    Thanks for your time !

    You would need access to database through PHPMyAdmin but if you aren’t sure about that then you can also do this.

    
    $all_user_data = get_user_meta( $user_id );
    print_r( $all_user_data );
    

    This will get all the data for this profile. You can look at the results to see if there is any thing stored for profile_picture at all.

    Thread Starter throm17

    (@throm17)

    I have many result :
    [_wp_http_referer] => Array ( [0] => /inscription_candidat/ ) [profil_picture] => Array ( [0] => stream_photo_b90a0f1f_5216da8f479eaf8ac81c5d848023ecb57b85c12e.jpg )

    And I just checked in the database, it is well stored.

    Thread Starter throm17

    (@throm17)

    In fact it sends me the name of the image, (its name in the database, but it does not display it as an image)

    Ok, so that is the same image file name is the same as before but this time we know for sure that is pulling from the profile.

    
    $user_id = um_get_requested_user();
    um_fetch_user( $user_id );
    $meta_value = get_user_meta( $user_id, 'profile_picture', true );
    if ( $meta_value ) {
     echo UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . "/" . $meta_value;
    }
    

    What this does, is check to see if the profile_pitcure exists and if it does then build an Image URL with the meta_value. I did some research and this is where that image file may exist.

Viewing 15 replies - 1 through 15 (of 26 total)

The topic ‘Collect value of user’ is closed to new replies.