}
/**
- * Explains what groups the user can add and remove, and why.
+ * Prepare a list of groups the user is able to add and remove
*
- * @return string Explanatory sanitized HTML message
+ * @return string
*/
private function explainRights() {
- global $wgUser;
+ global $wgUser, $wgLang;
+
+ $out = array();
+ list( $add, $remove ) = array_values( $this->changeableGroups() );
+
+ if( count( $add ) > 0 )
+ $out[] = wfMsgExt( 'userrights-available-add', 'parseinline', $wgLang->listToText( $add ) );
+ if( count( $remove ) > 0 )
+ $out[] = wfMsgExt( 'userrights-available-remove', 'parseinline', $wgLang->listToText( $remove ) );
+
+ return count( $out ) > 0
+ ? implode( ' ', $out )
+ : wfMsgExt( 'userrights-available-none', 'parseinline' );
+
+
$groups = $wgUser->getEffectiveGroups();
foreach( $groups as $group ) {
if( $this->changeableByGroup( $group ) == array(
$grouplists = array( $groups );
list( $grouplists[1], $grouplists[2] ) = array_values( $this->changeableGroups() );
+
+
// Now format them nicely for display (yay mutable variables? I'm sick
// of thinking up new names)
foreach( $grouplists as &$list ) {
'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to.
Unselected groups will not be changed. You can deselect a group with CTRL + Left Click',
'userrights-reason' => 'Reason for change:',
-'userrights-list' => 'Because you are a member of $1, you can add $2 and remove $3.',
-'userrights-list-nogroups' => 'no groups',
-'userrights-list-groups' => 'the {{PLURAL:$1|group|groups}} $2',
-'userrights-list-separator' => ', ', # only translate this message to other languages if you have to change it
+'userrights-available-none' => 'You may not alter group membership.',
+'userrights-available-add' => 'You can add users to $1.',
+'userrights-available-remove' => 'You can remove users from $1.',
# Groups
'group' => 'Group:',
'userrights-groupsavailable',
'userrights-groupshelp',
'userrights-reason',
- 'userrights-list',
- 'userrights-list-nogroups',
- 'userrights-list-groups',
- 'userrights-list-separator',
+ 'userrights-available-none',
+ 'userrights-available-add',
+ 'userrights-available-remove',
),
'group' => array(
'group',