Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #352 #381

Merged
merged 2 commits into from
Apr 1, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,12 @@ public static function render_field( $field ) {
}

foreach ( $choices as $key => $role ) {
$data_values[] = array( 'id' => $key, 'text' => $role );
$args = array( 'id' => $key, 'text' => $role );
$users = get_users( array( 'role' => $key ) );
if ( count( $users ) ) {
$args['user_count'] = count( $users ) . ' ' . __( 'users' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@desaiuditd I think we should use _n() for this. Also, the text domain is missing.

 sprintf( _n( '1 user', '%s users', count( $users ), 'stream' ), count( $users ) );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I missed it.
Adding it.

}
$data_values[] = $args;
}

$selected_values = array();
Expand Down
8 changes: 6 additions & 2 deletions ui/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,12 @@ jQuery(function($){

if ('undefined' !== typeof object.icon) {
result = '<img src="' + object.icon + '" class="wp-stream-select2-icon">' + result;
// Add more info to the container
container.attr('title', object.tooltip);
}
// Add more info to the container
if ( 'undefined' !== typeof object.tooltip ) {
container.attr( 'title', object.tooltip );
} else if ( 'undefined' !== typeof object.user_count ) {
container.attr( 'title', object.user_count );
}
return result;
},
Expand Down