Custom front-end text change: "a media" and "Sorry !"

Hello,

Thank you for this plugin. I would like to change a few bits of text:

  1. After uploading a music file - I would like the BP activity stream to read “uploaded a music track” instead of “a music”. I read this and changed “define ( ‘RTMEDIA_MUSIC_SLUG’, ‘music’ );” to “music track” in wp-config.php, but it is not working. Can you help?

  2. I would like to change the “Sorry !! There no playlist …” text. I read this, but do not know where to find the filter to change this particular text.

Thanks for your help.

Hi @taa,

1 . Yes, you can change text of BuddyPress activity stream as “uploaded a music track”, but it will be possible for single media upload only. For multiple media upload this trick would not work. The reason behind it is multiple media upload may include any type of media (music,photos,video… etc).

For single music upload you can put below code in your theme’s functions.php file:

function change_rtmedia_activity_action( $action, $username, $count, $user_nicename, $media_type ) {
	if(  strcmp( $media_type, "music" ) == 0 ) {		
		$media_const = 'RTMEDIA_' . strtoupper ( $media_type );
			if ( $count > 1 ) {
				$media_const .= '_PLURAL';
			}
			$media_const.='_LABEL';
		$media_str = constant ( $media_const );
		$media_type = "music track";
		$action = sprintf (
			_n(
					'%s uploaded a %s', '%s uploaded %d %s.', $count, 'rtmedia'
			), $username, $media_type, $media_str
		);
	}	
	return $action;
}
add_filter('rtmedia_buddypress_action_text_fitler', 'change_rtmedia_activity_action', 10, 5);

2 . To change message text you just need to put below code in your theme’s functions.php file:

function custom_no_media_found_message_function( $message ) {
    $message = "Custom Message";
    return $message;
}
add_filter( 'rtmedia_no_media_found_message_filter', 'custom_no_media_found_message_function' ,10, 1 );

Wonderful, thank you! The first code worked perfectly.

The second bit of code worked for the “No Music, No Video, No FavList” messages, but not for the “No Playlist” message (see screenshot). Do you know how to change this text?

Thank you!

Hi @taa,

Yes, you just need to put below code in your theme’s function.php file:

function custom_no_playlist_found_message_function( $message ) {
    $message = "Custom Message";
    return $message;
}
add_filter( 'rtmedia_no_playlist_found_message_filter', 'custom_no_playlist_found_message_function' ,10, 1 );

function custom_no_favlist_found_message_function( $message ) {
    $message = "Custom Message";
    return $message;
}
add_filter( 'rtmedia_no_favlist_found_message_filter', 'custom_no_favlist_found_message_function' ,10, 1 );</code