Difference between revisions of "User:Admin"
| Line 7: | Line 7: | ||
Add this to the bottom: | Add this to the bottom: | ||
| − | # Regulate user group permissions. | + | |
| − | $wgGroupPermissions['*']['createaccount'] = false; | + | # Regulate user group permissions. |
| − | $wgGroupPermissions['user']['createaccount'] = false; | + | $wgGroupPermissions['*']['createaccount'] = false; |
| − | $wgGroupPermissions['administrators']['createaccount'] = false; | + | $wgGroupPermissions['user']['createaccount'] = false; |
| + | $wgGroupPermissions['administrators']['createaccount'] = false; | ||
Need to edit: | Need to edit: | ||
| Line 18: | Line 19: | ||
public function userCanExecute( User $user ) { | public function userCanExecute( User $user ) { | ||
| − | + | /** | |
| − | + | * return $user->isAllowed( 'createaccount' ); | |
| − | + | */ | |
| − | + | global $wgUser; | |
| − | + | if ( $wgUser->isLoggedIn() ) { | |
| − | + | return $user->isAllowed( 'createaccount' ); | |
| − | + | } else { | |
| − | + | return false; | |
| + | } | ||
} | } | ||
| − | |||
This will block non-logged-in users from viewing the content if the user group isn't configured in the LocalSettings.php. | This will block non-logged-in users from viewing the content if the user group isn't configured in the LocalSettings.php. | ||
Revision as of 15:28, 27 July 2018
Administration Control Panel - [1]
Changes to block new user creation:
Need to edit: /home/wasteam8/public_html/mentor.wiki/LocalSettings.php
Add this to the bottom:
# Regulate user group permissions. $wgGroupPermissions['*']['createaccount'] = false; $wgGroupPermissions['user']['createaccount'] = false; $wgGroupPermissions['administrators']['createaccount'] = false;
Need to edit: /home/wasteam8/public_html/mentor.wiki/includes/specials/SpecialCreateAccount.php
Edit this function:
public function userCanExecute( User $user ) {
/**
* return $user->isAllowed( 'createaccount' );
*/
global $wgUser;
if ( $wgUser->isLoggedIn() ) {
return $user->isAllowed( 'createaccount' );
} else {
return false;
}
}
This will block non-logged-in users from viewing the content if the user group isn't configured in the LocalSettings.php. Can be used in other things as well.
Relevant Links:
https://lists.gt.net/wiki/mediawiki/126271
https://www.mediawiki.org/wiki/Manual:Special_pages#Constructor
https://www.mediawiki.org/wiki/Manual:LocalSettings.php#User_rights
https://www.mediawiki.org/wiki/Manual:User_rights#Example
https://stackoverflow.com/questions/219135/how-do-i-create-my-own-custom-group-in-mediawiki
https://www.mediawiki.org/wiki/Topic:Qji4lqoeaodggoft
https://www.mediawiki.org/wiki/Topic:Pl8qrwn9l15vc0ex
https://doc.wikimedia.org/mediawiki-core/master/php/classUser.html