bp_nouveau_messages_localize_scripts( array $params = array() )

Localize the strings needed for the messages UI

Description

Parameters

$params

(Optional) Associative array containing the JS Strings needed by scripts

Default value: array()

Return

(array) The same array with specific strings for the messages UI if needed.

Source

File: bp-templates/bp-nouveau/includes/messages/functions.php

function bp_nouveau_messages_localize_scripts( $params = array() ) {
	if ( ! bp_is_user_messages() ) {
		return $params;
	}

	$params['messages'] = array(
		'errors' => array(
			'send_to'         => __( 'Please add at least one recipient.', 'buddyboss' ),
			'message_content' => __( 'Please add some content to your message.', 'buddyboss' ),
		),
		'nonces' => array(
			'send' => wp_create_nonce( 'messages_send_message' ),
			'load_recipient' => wp_create_nonce( 'messages_load_recipient' ),
		),
		'loading'       => __( 'Loading messages. Please wait.', 'buddyboss' ),
		'doingAction'   => array(
			'read'   => __( 'Marking messages as read. Please wait.', 'buddyboss' ),
			'unread' => __( 'Marking messages as unread. Please wait.', 'buddyboss' ),
			'delete' => __( 'Deleting messages. Please wait.', 'buddyboss' ),
			'star'   => __( 'Starring messages. Please wait.', 'buddyboss' ),
			'unstar' => __( 'Unstarring messages. Please wait.', 'buddyboss' ),
		),
		'delete_confirmation'  => __( 'Are you sure you want to delete this conversation? This will permanently delete the conversation history and cannot be undone.', 'buddyboss' ),
		'bulk_actions'  => bp_nouveau_messages_get_bulk_actions(),
		'howtoBulk'     => __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddyboss' ),
		'toOthers'      => array(
			'one'  => __( '1 other', 'buddyboss' ),
			'more' => __( '%d others', 'buddyboss' ),
		),
		'rootUrl' => parse_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ), PHP_URL_PATH ),
		'hasThreads' => bp_has_message_threads( bp_ajax_querystring( 'messages' ) )
	);

	// Star private messages.
	if ( bp_is_active( 'messages', 'star' ) ) {
		$params['messages'] = array_merge( $params['messages'], array(
			'strings' => array(
				'text_unstar'  => __( 'Unstar', 'buddyboss' ),
				'text_star'    => __( 'Star', 'buddyboss' ),
				'title_unstar' => __( 'Starred', 'buddyboss' ),
				'title_star'   => __( 'Not starred', 'buddyboss' ),
				'title_unstar_thread' => __( 'Remove all starred messages in this thread', 'buddyboss' ),
				'title_star_thread'   => __( 'Star the first message in this thread', 'buddyboss' ),
			),
			'is_single_thread' => (int) bp_is_messages_conversation(),
			'star_counter'     => 0,
			'unstar_counter'   => 0
		) );
	}

	// Friends active for force friendship to message.
	if ( bp_is_active( 'friends' ) ) {
		$params['messages']['force_friendship_to_message'] = bp_force_friendship_to_message();
	}

	return $params;
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.