Indivudual display of custom field on profile page

Support MB User Meta Indivudual display of custom field on profile pageResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40809
    JoeJoe
    Participant

    I want to display a couple of custom fields on a page. the page has the [mb_frontend_dashboard] shortcode but I want to display some additional infos

    $current_user_id = get_current_user_id();
    $user_data = get_userdata( $current_user_id );
    
    echo $user_data->display_name;
    echo $user_data->user_expertise;
    

    works without a problem, I also want to display the users hero image, which is setup as a single image field

    by using the following shortcode -> it just get "Array" display
    `$test = rwmb_meta( 'user_hero_image', ['object_type' => 'user'], $current_user_id );
    echo $test;
    '
    I did a var_dump , and yes it is an array, how do I get to the url to diplay the image ?

    #40810
    JoeJoe
    Participant

    I just found out how to do it , doohhh

    heres the solution for other people :

    
    $current_user_id = get_current_user_id();
    $user_data = get_userdata( $current_user_id ); //get all data for the current user
    
    $test1 = rwmb_meta( 'user_hero_image', ['object_type' => 'user'], $current_user_id );
    echo '<img src="' . $test1['url'] . '">';
    
    #40811
    JoeJoe
    Participant

    Too bad , got rexcited too fast, this code works but it only displays the thumbnail

    #40812
    JoeJoe
    Participant

    Yes I am such a hero 🙂

    $test1 = rwmb_meta( 'user_hero_image', ['size' => 'full', 'object_type' => 'user'], $current_user_id );
    echo '<img src="' . $test1['url'] . '">';
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.