bp_nouveau_messages_localize_scripts( array $params = array() )

Localize the strings needed for the messages UI


Description Description


Parameters Parameters

$params

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

Default value: array()


Top ↑

Return Return

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


Top ↑

Source 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.', 'buddypress' ),
			'subject'         => __( 'Please add a subject to your message.', 'buddypress' ),
			'message_content' => __( 'Please add some content to your message.', 'buddypress' ),
		),
		'nonces' => array(
			'send' => wp_create_nonce( 'messages_send_message' ),
		),
		'loading'       => __( 'Loading messages. Please wait.', 'buddypress' ),
		'doingAction'   => array(
			'read'   => __( 'Marking messages as read. Please wait.', 'buddypress' ),
			'unread' => __( 'Marking messages as unread. Please wait.', 'buddypress' ),
			'delete' => __( 'Deleting messages. Please wait.', 'buddypress' ),
			'star'   => __( 'Starring messages. Please wait.', 'buddypress' ),
			'unstar' => __( 'Unstarring messages. Please wait.', 'buddypress' ),
		),
		'bulk_actions'  => bp_nouveau_messages_get_bulk_actions(),
		'howto'         => __( 'Click on the message title to preview it in the Active conversation box below.', 'buddypress' ),
		'howtoBulk'     => __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddypress' ),
		'toOthers'      => array(
			'one'  => __( '(and 1 other)', 'buddypress' ),
			'more' => __( '(and %d others)', 'buddypress' ),
		),
		'rootUrl' => parse_url( trailingslashit( bp_displayed_user_domain() . bp_get_messages_slug() ), PHP_URL_PATH ),
	);

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

	return $params;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.