Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Trying to put a users Youtube video in the profile sidebar

  • I want the user’s Youtube or Vimeo video to show at the top of the profile sidebar using the widget. When I use this shortcode [um_user meta_key=”youtubevideo” ] it just pulls in the actual url of the video (the text) and does not embed the video itself. Any help on how to do this or what other meta data I need to add?
    I am creating a membership website with Ultimate Member and I’m trying to customize the profile page itself a little.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @jonoman1

    Thank you for contacting our support.

    You can try following codes:

    add_shortcode('um_youtube_video',function(){
        $content = '';
        if(um_is_core_page('user')){
            $profile_id = um_profile_id();
            $video_url = get_user_meta( $profile_id,'youtubevideo',true );
            if($video_url){
                parse_str( parse_url( $video_url, PHP_URL_QUERY ), $youtube_id_v );
                $video_id = $youtube_id_v['v'];
                $content = '<iframe width="1397" height="484" src="https://www.youtube.com/embed/'.$video_id.'"  frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
    
            }
        }
    
        return $content;
    });

    After adding above codes, you can simple add shortcode whereever you would like to display youtube video on user profile page.
    [um_youtube_video]

    Regards

    Thread Starter jonoman1

    (@jonoman1)

    Great! Thanks so much for helping with this! And just to be clear, I would want it to display the users video on their own profile page, so I would still need to add the um_user part as well, right? Or is that already built in to the above code? Also, sorry for the simple question but where would you recommend placing the code?

    • This reply was modified 2 weeks, 2 days ago by jonoman1.
    • This reply was modified 2 weeks, 2 days ago by jonoman1.
    • This reply was modified 2 weeks, 2 days ago by jonoman1.
    Plugin Support Aswin Giri

    (@aswingiri)

    @jonoman1 Above provided code is to display user’s video on their own profile. You don’t need to do anything with um_user

    I suggest you install a plugin called “Code snippets” to add any custom codes on your site. Or you can also add it to your theme’s functions.php file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to put a users Youtube video in the profile sidebar’ is closed to new replies.