$isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE;
- //if CMS is configured for not to allow creating new CMS user,
- //don't build the form,Fixed for CRM-4036
- if ($isJoomla) {
- $userParams = JComponentHelper::getParams('com_users');
- if (!$userParams->get('allowUserRegistration')) {
- return FALSE;
- }
- }
- elseif ($isDrupal && !variable_get('user_register', TRUE)) {
- return FALSE;
- }
- elseif ($isWordPress && !get_option('users_can_register')) {
+ if (!$config->userSystem->isUserRegistrationPermitted()) {
+ // Do not build form if CMS is not configured to allow creating users.
return FALSE;
}
}
// $cms is true when there is email(primary location) is set in the profile field.
- $session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
+ $userID = CRM_Core_Session::singleton()->get('userID');
$showUserRegistration = FALSE;
if ($action) {
$showUserRegistration = TRUE;
return FALSE;
}
+ /**
+ * Check if user registration is permitted.
+ *
+ * @return bool
+ */
+ public function isUserRegistrationPermitted() {
+ return FALSE;
+ }
+
/**
* Get user login URL for hosting CMS (method declared in each CMS system class)
*
return \Drupal::currentUser()->isAuthenticated();
}
+ /**
+ * @inheritDoc
+ */
+ public function isUserRegistrationPermitted() {
+ if (\Drupal::config('user.settings')->get('register') == 'admin_only') {
+ return FALSE;
+ }
+ return TRUE;
+ }
+
/**
* @inheritDoc
*/
return defined('VERSION') ? VERSION : 'Unknown';
}
+ /**
+ * @inheritDoc
+ */
+ public function isUserRegistrationPermitted() {
+ if (!variable_get('user_register', TRUE)) {
+ return FALSE;
+ }
+ return TRUE;
+ }
+
/**
* @inheritDoc
*/
return ($user->guest) ? FALSE : TRUE;
}
+ /**
+ * @inheritDoc
+ */
+ public function isUserRegistrationPermitted() {
+ $userParams = JComponentHelper::getParams('com_users');
+ if (!$userParams->get('allowUserRegistration')) {
+ return FALSE;
+ }
+ return TRUE;
+ }
+
/**
* @inheritDoc
*/