Skip to content

Commit

Permalink
Prefer 'member' for front-end, and 'user' in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
thebrandonallen committed Feb 16, 2017
1 parent 522fee3 commit 917d7ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/class-bpbu-component.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function setup_settings_sub_nav() {

// Set up the sub nav args array.
$nav = array(
'name' => __( 'Block User', 'bp-block-users' ),
'name' => __( 'Block Member', 'bp-block-users' ),
'slug' => 'block-user',
'parent_url' => $settings_link,
'parent_slug' => $slug,
Expand Down
23 changes: 20 additions & 3 deletions includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,25 @@ function tba_bp_get_block_user_settings_message( $user_id = 0 ) {
$user_id = bp_displayed_user_id();
}

// Set up our messages array, separated by location.
$messages = array(
'admin' => array(
'not-blocked' => __( 'This user is not currently blocked.', 'bp-block-users' ),
'indefinite' => __( 'This user is blocked indefinitely.', 'bp-block-users' ),
'timed' => __( 'This user is blocked until %1$s at %2$s.', 'bp-block-users' ),
),
'front' => array(
'not-blocked' => __( 'This member is not currently blocked.', 'bp-block-users' ),
'indefinite' => __( 'This member is blocked indefinitely.', 'bp-block-users' ),
'timed' => __( 'This member is blocked until %1$s at %2$s.', 'bp-block-users' ),
),
);

// Set the message location.
$location = is_admin() ? 'admin' : 'front';

// Set the default message.
$message = __( 'This user is not currently blocked.', 'bp-block-users' );
$message = $messages[ $location ]['not-blocked'];

// If the user is not blocked, bail.
if ( ! tba_bp_is_user_blocked( $user_id ) ) {
Expand All @@ -46,7 +63,7 @@ function tba_bp_get_block_user_settings_message( $user_id = 0 ) {

// If the expiration is not a timestamp, the user is blocked indefinitely.
if ( empty( $expiration ) ) {
$message = __( 'This user is blocked indefinitely.', 'bp-block-users' );
$message = $messages[ $location ]['indefinite'];

// Display when the user's block will expire.
} elseif ( $expiration_int > time() ) {
Expand All @@ -56,7 +73,7 @@ function tba_bp_get_block_user_settings_message( $user_id = 0 ) {
$time = get_date_from_gmt( $expiration, bp_get_option( 'time_format' ) );

// Set the message with expiration time.
$message = sprintf( __( 'This user is blocked until %1$s at %2$s.', 'bp-block-users' ), $date, $time );
$message = sprintf( $messages[ $location ]['timed'], $date, $time );
}

/**
Expand Down

0 comments on commit 917d7ca

Please sign in to comment.