Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kojin

    You can try this code snippet to display the mp3 embed in the Member Directory Cards.

    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( 'mp3sound' ) ){
            $mp3_url = UM()->uploader()->get_upload_base_url() . um_user( 'ID' ) . DIRECTORY_SEPARATOR . um_profile( 'mp3sound' );
            $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\}\}\}";
    }

    Regards,

    • This reply was modified 2 years, 9 months ago by Champ Camba.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    The code above doesn’t save correctly. Please try copying the code from this link:
    https://gist.github.com/champsupertramp/395bfab01f80cdd87618c6b9702ae3bc

    Regards,

    Thread Starter kojin

    (@kojin)

    Than you,
    but I can’t select file label from custom field list.
    Discord, FAcebook, Google+, Instagram, …
    There is no mp3(lavel name) in the options.

    Please tell me what to do.

    • This reply was modified 2 years, 9 months ago by kojin.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kojin

    It’s not clear. What did you mean by not being able to select the file label? Could you please provide a screenshot? You can upload the screenshot via imgur.com and then share the image URL here so we can review it.

    Regards,

    Thread Starter kojin

    (@kojin)

    Screenshot is

    um member directory

    Please check it.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kojin

    You don’t need to add the mp3 field in the tagline. The above code should display the mp3 player. Does the code work on your site?

    Regards,

    Thread Starter kojin

    (@kojin)

    Thank you so much.

    I’m sorry tha I didn’t tell you the label name.
    I changed label ‘mp3’ to ‘mp3sound’ in the code.

    The code is working.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @kojin

    Thanks for letting us know.

    Regards,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to add a mp3 file to profilecard?’ is closed to new replies.