if (!$surname) { $bits = explode(' ', $name); $surname = array_pop($bits); if (count($bits) >= 1) { $givenName = array_shift($bits); } if (count($bits) >= 1) { $middleName = implode(' ', $bits); } } $incomplete = false; $authenticator = 'hub'; if (substr($this->profile->get('email'), -8) == '@invalid') { $authenticator = Lang::txt('COM_MEMBERS_UNKNOWN'); if ($lnk = Hubzero\Auth\Link::find_by_id(abs($this->profile->get('username')))) { $domain = Hubzero\Auth\Domain::find_by_id($lnk->auth_domain_id); $authenticator = $domain->authenticator; } $incomplete = true; } ?> <div class="grid"> <div class="col span7"> <fieldset class="adminform"> <legend><span><?php echo Lang::txt('Account Details'); ?> </span></legend> <div class="input-wrap" data-hint="<?php echo Lang::txt('COM_MEMBERS_FIELD_USERNAME_HINT');
/** * This method will return a user object * * If options['autoregister'] is true, if the user doesn't exist yet he will be created * * @param array $user Holds the user data. * @param array $options Array holding options (remember, autoregister, group). * @return object A User object */ protected function _getUser($user, $options = array()) { $instance = Hubzero\User\User::oneByUsername($user['username']); if ($id = intval($instance->get('id'))) { return $instance; } //TODO : move this out of the plugin $config = Component::params('com_members'); // Default to Registered. $defaultUserGroup = $config->get('new_usertype', 2); $instance->set('id', 0); $instance->set('name', $user['fullname']); $instance->set('username', $user['username']); //$instance->set('password_clear', ((isset($user['password_clear'])) ? $user['password_clear'] : '')); $instance->set('email', $user['email']); // Result should contain an email (check) $instance->set('usertype', 'deprecated'); $instance->set('accessgroups', array($defaultUserGroup)); $instance->set('activation', 1); $instance->set('loginShell', '/bin/bash'); $instance->set('ftpShell', '/usr/lib/sftp-server'); // Check joomla user activation setting // 0 = automatically confirmed // 1 = require email confirmation (the norm) // 2 = require admin confirmation $useractivation = $config->get('useractivation', 1); // If requiring admin approval, set user to not approved if ($useractivation == 2) { $instance->set('approved', 0); } else { $instance->set('approved', 2); } // Now, also check to see if user came in via an auth plugin, as that may affect their approval status if (isset($user['auth_link'])) { $domain = Hubzero\Auth\Domain::find_by_id($user['auth_link']->auth_domain_id); if ($domain && is_object($domain)) { $params = Plugin::params('authentication', $domain->authenticator); if ($params && is_object($params) && $params->get('auto_approve', false)) { $instance->set('approved', 2); } } } // If autoregister is set let's register the user $autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1); if ($autoregister) { if (!$instance->save()) { return new Exception($instance->getError()); } } else { // No existing user and autoregister off, this is a temporary user. $instance->set('tmp_user', true); } $instance->set('password_clear', isset($user['password_clear']) ? $user['password_clear'] : ''); return $instance; }