Created
January 21, 2022 11:16
-
-
Save champsupertramp/395bfab01f80cdd87618c6b9702ae3bc to your computer and use it in GitHub Desktop.
Ultimate Member - Display Mp3 player in Member Directory Profile Cards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter("um_ajax_get_members_data","um_012122_display_audio_member_directory_data", 10, 3 ); | |
function um_012122_display_audio_member_directory_data( $data_array, $user_id, $directory_data ){ | |
if( um_profile( 'mp3' ) ){ | |
$mp3_url = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . um_profile( 'mp3' ); | |
$data_array['audio_embed'] = " | |
<audio controls style='width: 90%;margin:auto;'> | |
<source src='{$mp3_url}' type='audio/mpeg'> | |
Your browser does not support the audio element. | |
</audio>"; | |
} | |
return $data_array; | |
} | |
add_action("um_members_just_after_name_tmpl","um_012122_display_audio_member_directory"); | |
function um_012122_display_audio_member_directory( ){ | |
echo "{{{user.audio_embed}}}"; | |
} |
Try a solution in this gist for video: https://gist.github.com/yuriinalivaiko/8cd1cf313bba5f8d9bfabeda8d25647e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's possible for video file?