/** * Up **/ public function up() { $query = "describe jos_citations uid"; $this->db->setQuery($query); $uidField = $this->db->loadObject(); // if we have an INT already, were good to go if (strtolower($uidField->Type) == 'int(11)') { return; } // load all citations $query = "SELECT id, uid FROM `jos_citations`"; $this->db->setQuery($query); $citations = $this->db->loadObjectList(); foreach ($citations as $citation) { if (!is_numeric($citation->uid)) { $newId = 62; $profile = \Hubzero\User\Profile::getInstance($citation->uid); if (is_object($profile)) { $newId = $profile->get('uidNumber'); } $query = "UPDATE `jos_citations` SET uid=" . $this->db->quote($newId) . " WHERE id=" . $this->db->quote($citation->id); $this->db->setQuery($query); $this->db->query(); } } // change column name $query = "ALTER TABLE `jos_citations` CHANGE uid uid INT(11);"; $this->db->setQuery($query); $this->db->query(); }
/** * Constructor * * @param integer $scope_id Scope ID (group, course, etc.) * @return void */ public function __construct($referenceid = 0) { $this->set('referenceid', $referenceid)->set('category', 'user')->set('option', $this->_segments['option']); $this->_segments['id'] = $referenceid; $this->_segments['active'] = 'wishlist'; $this->_item = \Hubzero\User\Profile::getInstance($this->get('scope_id')); }
/** * Display module content * * @return void */ public function display() { $this->verified = 0; if (!User::isGuest()) { $profile = Profile::getInstance(User::get('id')); if ($profile->get('emailConfirmed') == 1 || $profile->get('emailConfirmed') == 3) { $this->verified = 1; } } // Figure out whether this is a guess or temporary account created during the auth_link registration process if (User::isGuest() || is_numeric(User::get('username')) && User::get('username') < 0) { $this->guestOrTmpAccount = true; } else { $this->guestOrTmpAccount = false; } $this->referrer = Request::getVar('REQUEST_URI', '', 'server'); $this->referrer = str_replace('&', '&', $this->referrer); $this->referrer = base64_encode($this->referrer); $browser = new Detector(); $this->os = $browser->platform(); $this->os_version = $browser->platformVersion(); $this->browser = $browser->name(); $this->browser_ver = $browser->version(); $this->css()->js()->js('jQuery(document).ready(function(jq) { HUB.Modules.ReportProblems.initialize("' . $this->params->get('trigger', '#tab') . '"); });'); $this->supportParams = Component::params('com_support'); require $this->getLayoutPath(); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function plgSupportCaptcha(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); if (!User::isGuest()) { $profile = \Hubzero\User\Profile::getInstance(User::get('id')); if ($profile->get('emailConfirmed') == 1 || $profile->get('emailConfirmed') == 3) { $this->_verified = true; } } }
/** * Constructor * * @param integer $scope_id Scope ID (group, course, etc.) * @return void */ public function __construct($scope_id = 0) { $this->set('scope_id', $scope_id); $this->_segments['id'] = $scope_id; $this->_segments['active'] = 'blog'; $this->_item = Profile::getInstance($scope_id); $config = Plugin::params('members', 'blog'); $id = String::pad($this->get('scope_id')); $this->set('path', str_replace('{{uid}}', $id, $config->get('uploadpath', '/site/members/{{uid}}/blog'))); $this->set('scope', $this->get('scope_id') . '/blog'); $this->set('option', $this->_segments['option']); }
/** * Display module content * * @return void */ public function display() { $database = \App::get('db'); $this->moduleclass = $this->params->get('moduleclass'); $limit = intval($this->params->get('limit', 10)); // Find the user's most recent support tickets $database->setQuery("(\n\t\t\t\tSELECT id, summary, category, open, status, severity, owner, created, login, name,\n\t\t\t\t\t(SELECT COUNT(*) FROM #__support_comments as sc WHERE sc.ticket=st.id AND sc.access=0) as comments\n\t\t\t\tFROM #__support_tickets as st\n\t\t\t\tWHERE st.login='******'username') . "' AND st.open=1 AND type=0\n\t\t\t\tORDER BY created DESC\n\t\t\t\tLIMIT {$limit}\n\t\t\t)\n\t\t\tUNION\n\t\t\t(\n\t\t\t\tSELECT id, summary, category, open, status, severity, owner, created, login, name,\n\t\t\t\t\t(SELECT COUNT(*) FROM #__support_comments as sc WHERE sc.ticket=st.id AND sc.access=0) as comments\n\t\t\t\tFROM #__support_tickets as st\n\t\t\t\tWHERE st.owner='" . User::get('id') . "' AND st.open=1 AND type=0\n\t\t\t\tORDER BY created DESC\n\t\t\t\tLIMIT {$limit}\n\t\t\t)"); $this->rows = $database->loadObjectList(); if ($database->getErrorNum()) { $this->setError($database->stderr()); $this->rows = array(); } $rows1 = array(); $rows2 = array(); if ($this->rows) { foreach ($this->rows as $row) { if ($row->owner == User::get('id')) { $rows2[] = $row; } else { $rows1[] = $row; } } } $this->rows1 = $rows1; $this->rows2 = $rows2; $profile = Profile::getInstance(User::get('id')); $xgroups = $profile->getGroups('members'); $groups = ''; if ($xgroups) { $g = array(); foreach ($xgroups as $xgroup) { $g[] = $xgroup->cn; } $groups = implode("','", $g); } $this->rows3 = null; if ($groups) { // Find support tickets on the user's contributions $database->setQuery("SELECT id, summary, category, open, status, severity, owner, created, login, name,\n\t\t\t\t\t(SELECT COUNT(*) FROM `#__support_comments` as sc WHERE sc.ticket=st.id AND sc.access=0) as comments\n\t\t\t\tFROM `#__support_tickets` as st\n\t\t\t\tWHERE st.open=1 AND type=0 AND st.group IN ('{$groups}')\n\t\t\t\tORDER BY created DESC\n\t\t\t\tLIMIT {$limit}"); $this->rows3 = $database->loadObjectList(); if ($database->getErrorNum()) { $this->setError($database->stderr()); $this->rows3 = null; } } require $this->getLayoutPath(); }
/** * Hook for after parsing route * * @return void */ public function onAfterRoute() { if (App::isSite() && !User::isGuest()) { $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles', 'com_members.register.unconfirmed.profiles', 'com_members.register.change.profiles', 'com_members.register.resend.profiles', 'com_members.register.confirm.profiles']; $current = Request::getWord('option', ''); $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : ''; $current .= ($task = Request::getWord('task', false)) ? '.' . $task : ''; $current .= ($view = Request::getWord('view', false)) ? '.' . $view : ''; $xprofile = \Hubzero\User\Profile::getInstance(User::get('id')); if (is_object($xprofile) && $xprofile->get('emailConfirmed') != 1 && $xprofile->get('emailConfirmed') != 3 && !in_array($current, $exceptions)) { Request::setVar('option', 'com_members'); Request::setVar('controller', 'register'); Request::setVar('task', 'unconfirmed'); $this->event->stop(); } } }
/** * Get the creator of this entry * * Accepts an optional property name. If provided * it will return that property value. Otherwise, * it returns the entire user object * * @return mixed */ public function creator($property = null) { if (!$this->_creator instanceof Profile) { $this->_creator = Profile::getInstance($this->get('addedBy')); if (!$this->_creator) { $this->_creator = new Profile(); } } if ($property) { $property = $property == 'id' ? 'uidNumber' : $property; if ($property == 'picture') { return $this->_creator->getPicture(); } return $this->_creator->get($property); } return $this->_creator; }
/** * Generate module contents * * @return void */ public function run() { include_once Component::path('com_members') . DS . 'tables' . DS . 'profile.php'; include_once Component::path('com_members') . DS . 'tables' . DS . 'association.php'; $database = \App::get('db'); $this->row = null; $this->profile = null; // Randomly choose one $filters = array('limit' => 1, 'show' => trim($this->params->get('show')), 'start' => 0, 'sortby' => "RAND()", 'search' => '', 'authorized' => false, 'show' => trim($this->params->get('show'))); if ($min = $this->params->get('min_contributions')) { $filters['contributions'] = $min; } $mp = new \Components\Members\Tables\Profile($database); $rows = $mp->getRecords($filters, false); if (count($rows) > 0) { $this->row = $rows[0]; } // Load their bio $this->profile = Profile::getInstance($this->row->uidNumber); if (trim(strip_tags($this->profile->get('bio'))) == '') { return ''; } // Did we have a result to display? if ($this->row) { $this->cls = trim($this->params->get('moduleclass_sfx')); $this->txt_length = trim($this->params->get('txt_length')); $config = Component::params('com_members'); $rparams = new Registry($this->profile->get('params')); $this->params = $config; $this->params->merge($rparams); if ($this->params->get('access_bio') == 0 || $this->params->get('access_bio') == 1 && !User::isGuest()) { $this->txt = $this->profile->getBio('parsed'); } else { $this->txt = ''; } // Member profile $this->title = $this->row->name; if (!trim($this->title)) { $this->title = $this->row->givenName . ' ' . $this->row->surname; } $this->id = $this->row->uidNumber; $this->thumb = $this->profile->getPicture(); $this->filters = $filters; require $this->getLayoutPath(); } }
/** * Get the creator of this entry * * Accepts an optional property name. If provided * it will return that property value. Otherwise, * it returns the entire object * * @param string $property Property to retrieve * @param mixed $default Default value if property not set * @return mixed */ public function creator($property = null, $default = null) { if (!$this->_creator instanceof Profile) { $this->_creator = Profile::getInstance($this->get('created_by')); if (!$this->_creator) { $this->_creator = new Profile(); } if ($this->_creator->get('uidNumber') && !trim($this->_creator->get('name'))) { $user = User::getInstance($this->_creator->get('uidNumber')); $this->_creator->set('name', $user->get('name', Lang::txt('(unknown)'))); } } if ($property) { $property = $property == 'id' ? 'uidNumber' : $property; return $this->_creator->get($property, $default); } return $this->_creator; }
/** * Display module contents * * @return void */ public function displaySite() { // Get all sessions $sessions = SessionHelper::getAllSessions(array('distinct' => 1, 'client' => 0)); // Vars to hold guests & logged in members $this->guestCount = 0; $this->loggedInCount = 0; $this->loggedInList = array(); // Get guest and logged in counts/list foreach ($sessions as $session) { if ($session->guest == 1) { $this->guestCount++; } else { $this->loggedInCount++; $profile = Profile::getInstance($session->userid); if ($profile) { $this->loggedInList[] = $profile; } } } // Render view require $this->getLayoutPath('default'); }
/** * Get the creator of this entry * * Accepts an optional property name. If provided * it will return that property value. Otherwise, * it returns the entire JUser object * * @return mixed */ public function creator($property = null) { if (!$this->_creator instanceof \Hubzero\User\Profile) { $this->_creator = \Hubzero\User\Profile::getInstance($this->get('user_id')); if (!$this->_creator) { $this->_creator = new \Hubzero\User\Profile(); } } if ($property) { $property = $property == 'id' ? 'uidNumber' : $property; if ($property == 'picture') { return $this->_creator->getPicture($this->get('anonymous')); } return $this->_creator->get($property); } return $this->_creator; }
/** * Split a user's name into its parts if not already done * * @param integer $id User ID * @return void */ private function _authorCheck($id) { $xprofile = Profile::getInstance($id); if ($xprofile->get('givenName') == '' && $xprofile->get('middleName') == '' && $xprofile->get('surname') == '') { $bits = explode(' ', $xprofile->get('name')); $xprofile->set('surname', array_pop($bits)); if (count($bits) >= 1) { $xprofile->set('givenName', array_shift($bits)); } if (count($bits) >= 1) { $xprofile->set('middleName', implode(' ', $bits)); } } }
/** * Function to return profile object * * @param integer $uidNumber User identifier * @return object Profile object */ private function profileExpander($uidNumber) { return Profile::getInstance($uidNumber); }
/** * Get the owner of this entry * * Accepts an optional property name. If provided * it will return that property value. Otherwise, * it returns the entire object * * @param string $property What data to return * @param mixed $default Default value * @return mixed */ public function owner($property = null, $default = null) { if (!$this->_owner instanceof Profile) { $this->_owner = Profile::getInstance($this->get('assigned')); if (!$this->_owner) { $this->_owner = new Profile(); } } if ($property) { $property = $property == 'id' ? 'uidNumber' : $property; if ($property == 'picture') { return $this->_owner->getPicture(); } return $this->_owner->get($property, $default); } return $this->_owner; }
/** * Get the creator of this entry * * Accepts an optional property name. If provided * it will return that property value. Otherwise, * it returns the entire object * * @param string $property Property to retrieve * @param mixed $default Default value if property not set * @return mixed */ public function creator($property = null, $default = null) { if (!$this->_creator instanceof Profile) { $this->_creator = Profile::getInstance($this->get('taggerid')); if (!$this->_creator) { $this->_creator = new Profile(); } } if ($property) { $property = $property == 'id' ? 'uidNumber' : $property; return $this->_creator->get($property, $default); } return $this->_creator; }
?> </a> </td> </tr> </table> <?php if (count($this->latest) > 0) { ?> <?php foreach ($this->latest as $post) { ?> <table id="course-discussions" width="650" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;"> <tr> <td width="75" style="padding: 10px 0;"> <img width="50" src="<?php echo Request::root() . \Hubzero\User\Profile::getInstance($post->created_by)->getPicture(); ?> " /> </td> <td style="padding: 10px 0;"> <div style="position: relative; border: 1px solid #CCCCCC; padding: 12px; -webkit-border-radius: 7px; -moz-border-radius: 7px; border-radius: 7px;"> <div style="background: #FFFFFF; border: 1px solid #CCCCCC; width: 15px; height: 15px; position: absolute; top: 50%; left: -10px; margin-top: -7px; transform:rotate(45deg); -ms-transform:rotate(45deg); -webkit-transform:rotate(45deg);"></div> <div style="background: #FFFFFF; width: 11px; height: 23px; position: absolute; top: 50%; left: -1px; margin-top: -10px;"></div> <div style="color: #AAAAAA; font-size: 11px; text-align:center;"> <?php echo User::getInstance($post->created_by)->get('name'); ?> | created: <?php echo Date::of($post->created)->toLocal('M j, Y g:i:s a');
/** * Collect author data * * @access public * @return string */ public function collectAuthorData($author, $ordering, $uid, &$item) { $firstName = NULL; $lastName = NULL; $org = NULL; $error = NULL; // Check that user ID exists if (trim($uid)) { if (!intval($uid)) { $error = Lang::txt('COM_PUBLICATIONS_BATCH_ITEM_ERROR_INVALID_USER_ID') . ': ' . trim($uid); $item['errors'][] = $error; } else { $profile = \Hubzero\User\Profile::getInstance($uid); if (!$profile || !$profile->get('uidNumber')) { $error = Lang::txt('COM_PUBLICATIONS_BATCH_ITEM_ERROR_USER_NOT_FOUND') . ': ' . trim($uid); $item['errors'][] = $error; } else { $firstName = $profile->get('givenName'); $lastName = $profile->get('lastName'); $org = $profile->get('organization'); } } } $pAuthor = new Tables\Author($this->database); $pAuthor->user_id = trim($uid); $pAuthor->ordering = $ordering; $pAuthor->credit = ''; $pAuthor->role = ''; $pAuthor->status = 1; $pAuthor->organization = isset($author->organization) && $author->organization ? trim($author->organization) : $org; $pAuthor->firstName = isset($author->firstname) && $author->firstname ? trim($author->firstname) : $firstName; $pAuthor->lastName = isset($author->lastname) && $author->lastname ? trim($author->lastname) : $lastName; $pAuthor->name = trim($pAuthor->firstName . ' ' . $pAuthor->lastName); // Check if project member $objO = $this->project->table('Owner'); $owner = $objO->getOwnerId($this->project->get('id'), $uid, $pAuthor->name); $pAuthor->project_owner_id = $owner; if (!$pAuthor->name) { $item['errors'][] = Lang::txt('COM_PUBLICATIONS_BATCH_ITEM_ERROR_AUTHOR_NAME_REQUIRED'); } // Add author record $authorRecord = array('author' => $pAuthor, 'owner' => $owner, 'error' => $error); $item['authors'][] = $authorRecord; }
/** * Constructor * * @param integer $id Member ID * @return void */ public function __construct($oid = null) { $this->_obj = \Hubzero\User\Profile::getInstance($oid); $this->_baselink = 'index.php?option=com_members&id=' . $this->_obj->get('uidNumber') . '&active=collections'; }
/** * Mark an entry as deleted * * @return string HTML */ private function _delete() { //verify were authorized if ($this->authorized != 'manager') { $this->setError(Lang::txt('PLG_GROUPS_ANNOUNCEMENTS_ONLY_MANAGERS_CAN_DELETE')); return $this->_list(); } // Incoming $id = Request::getInt('id', 0); //announcement model $announcement = new \Hubzero\Item\Announcement($this->database); $announcement->load($id); //load created by user profile $profile = \Hubzero\User\Profile::getInstance($announcement->created_by); //make sure we are the one who created it if ($announcement->created_by != User::get('id')) { $this->setError(Lang::txt('PLG_GROUPS_ANNOUNCEMENTS_ONLY_MANAGER_CAN_DELETE', $profile->get('name'))); return $this->_list(); } //set to deleted state $announcement->archive(); //attempt to delete announcement if (!$announcement->save($announcement)) { $this->setError(Lang::txt('PLG_GROUPS_ANNOUNCEMENTS_UNABLE_TO_DELETE')); return $this->_list(); } App::redirect(Route::url('index.php?option=' . $this->option . '&cn=' . $this->group->get('cn') . '&active=announcements'), Lang::txt('PLG_GROUPS_ANNOUNCEMENTS_SUCCESSFULLY_DELETED'), 'success'); return; }
<li> <a class="group-edit" href="<?php echo Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&task=edit'); ?> "> <?php echo Lang::txt('COM_GROUPS_TOOLBAR_EDIT'); ?> </a> </li> <?php } ?> <?php if (!$isManager && \Hubzero\User\Profile::userHasPermissionForGroupAction($this->group, 'group.pages')) { ?> <li> <a class="group-pages" href="<?php echo Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&task=pages'); ?> "> <?php echo Lang::txt('COM_GROUPS_TOOLBAR_PAGES'); ?> </a> </li> <?php } ?>
* HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Shawn Rice <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; $this->css()->js(); //remove $this $config = $this->config; $database = $this->database; $citation = $this->citation; //load user profile $profile = \Hubzero\User\Profile::getInstance($citation->uid); //get citation type $ct = new \Components\Citations\Tables\Type($database); $type = $ct->getType($citation->type); //get citation sponsors $cs = new \Components\Citations\Tables\Sponsor($database); $sponsors = $cs->getSponsorsForCitationWithId($citation->id); //determine the separator $urlSeparator = PHP_EOL; if (strstr($citation->url, " ") !== false) { $urlSeparator = " "; } else { if (strstr($citation->url, "\t") !== false) { $urlSeparator = "\t"; } }
/** * Map user * * User ID * Publication authors list * Mapping field * * @return void */ public function mapUser($uid = NULL, $authors = array(), $type = 'creator') { if (!empty($authors) && count($authors) > 0) { $name = $authors[0]->name; $orcid = isset($authors[0]->orcid) ? $authors[0]->orcid : ''; } elseif ($uid) { $user = \Hubzero\User\Profile::getInstance($uid); if ($user) { $name = $user->get('name'); $orcid = $user->get('orcid'); } } // Use acting user info if (empty($name)) { $name = User::get('name'); } // Format name $nameParts = explode(" ", $name); $name = end($nameParts); $name .= count($nameParts) > 1 ? ', ' . $nameParts[0] : ''; $this->set($type, htmlspecialchars($name)); if (!empty($orcid)) { $this->set($type . 'Orcid', $orcid); } }
<tbody> <?php if ($this->groupusers) { // Loop through the results $html = ''; if ($this->limit == 0) { $this->limit = 500; } for ($i = 0, $n = $this->limit; $i < $n; $i++) { $cls = ''; $inviteemail = false; if ($i + $this->start >= count($this->groupusers)) { break; } $guser = $this->groupusers[$i + $this->start]; $u = \Hubzero\User\Profile::getInstance($guser); if (!$u) { $u = new \Hubzero\User\Profile(); } if (preg_match("/^[_\\.\\%0-9a-zA-Z-]+@([0-9a-zA-Z-]+\\.)+[a-zA-Z]{2,6}\$/i", $guser)) { $inviteemail = true; $pic = rtrim(Request::base(true), '/') . '/core/components/com_groups/site/assets/img/emailthumb.png'; } else { if (!is_object($u)) { continue; } else { $pic = \Hubzero\User\Profile\Helper::getMemberPhoto($u, 0); } } switch ($this->filter) { case 'invitees':
echo $dir == 'ASC' ? '↑' : '↓'; } ?> <?php echo Lang::txt('COM_WIKI_COL_EDIT_SUMMARY'); ?> </a> </th> </tr> </thead> <tbody> <?php if ($rows) { foreach ($rows as $row) { $name = Lang::txt('COM_WIKI_UNKNOWN'); $xprofile = \Hubzero\User\Profile::getInstance($row->created_by); if (is_object($xprofile)) { $name = $this->escape(stripslashes($xprofile->get('name'))); $name = $xprofile->get('public') ? '<a href="' . Route::url($xprofile->getLink()) . '">' . $name . '</a>' : $name; } ?> <tr> <td> <time datetime="<?php echo $row->created; ?> "><?php echo $row->created; ?> </time> </td>
$name = stripslashes($contributor->givenName) . ' '; if ($contributor->middleName != NULL) { $name .= stripslashes($contributor->middleName) . ' '; } $name .= stripslashes($contributor->surname); } else { $name = $contributor->xname; } } if (!$contributor->org) { $contributor->org = $contributor->xorg; } $name = $this->escape(stripslashes($name)); $link = $name; if ($contributor->id) { $profile = \Hubzero\User\Profile::getInstance($contributor->id); if ($profile && $profile->get('public')) { $link = '<a href="' . Route::url($profile->getLink()) . '" rel="contributor" title="' . Lang::txt('COM_RESOURCES_VIEW_MEMBER_PROFILE', $name) . '">' . $name . '</a>'; } } //if ($newstyle) //{ if ($this->badges) { $xuser = User::getInstance($contributor->id); if (is_object($xuser) && $xuser->get('name')) { // get users groups // in reverse to get the highest levels first $groupIds = JAccess::getGroupsByUser($xuser->id, false); $database->setQuery("SELECT title FROM `#__usergroups` WHERE `id` IN (" . implode(',', $groupIds) . ") ORDER BY lft ASC"); $groups = array_reverse($database->loadColumn()); // use the users first group
/** * Up **/ public function up() { // load all members without given name or surname filled in $query = "SELECT `uidNumber`\n\t\t\t\t FROM `#__xprofiles`\n\t\t\t\t WHERE (`givenName` = '' OR `givenName` IS NULL)\n\t\t\t\t AND (`surname` = '' OR `surname` IS NULL);"; $this->db->setQuery($query); $result = $this->db->loadColumn(); // fix each name foreach ($result as $uidNumber) { $profile = \Hubzero\User\Profile::getInstance($uidNumber); if (!$profile) { continue; } $firstname = $profile->get('givenName'); $middlename = $profile->get('middleName'); $lastname = $profile->get('surname'); $name = $profile->get('name'); $username = $profile->get('username'); // all good if ($firstname && $surname) { continue; } if (empty($firstname) && empty($middlename) && empty($surname) && empty($name)) { $name = $username; $firstname = $username; } else { if (empty($firstname) && empty($middlename) && empty($surname)) { $words = array_map('trim', explode(' ', $name)); $count = count($words); if ($count == 1) { $firstname = $words[0]; } else { if ($count == 2) { $firstname = $words[0]; $lastname = $words[1]; } else { if ($count == 3) { $firstname = $words[0]; $middlename = $words[1]; $lastname = $words[2]; } else { $firstname = $words[0]; $lastname = $words[$count - 1]; $middlename = $words[1]; for ($i = 2; $i < $count - 1; $i++) { $middlename .= ' ' . $words[$i]; } } } } // TODO: // if firstname all caps, and lastname isn't, switch them // reparse names with " de , del , in them } } // update name $profile->set('name', $name); $firstname = trim($firstname); if ($firstname) { $profile->set('givenName', $firstname); } $middlename = trim($middlename); if ($middlename) { $profile->set('middleName', $middlename); } $lastname = trim($lastname); if ($lastname) { $profile->set('surname', $lastname); } $profile->update(); } }
<tbody> <?php if (count($this->shares) <= 1) { ?> <tr> <td> <?php echo Lang::txt('COM_TOOLS_SHARE_SESSION_NONE'); ?> </td> </tr> <?php } else { foreach ($this->shares as $row) { if ($row->viewuser != User::get('username')) { $user = \Hubzero\User\Profile::getInstance($row->viewuser); $id = $user->get('uidNumber') < 0 ? 'n' . -$user->get('uidNumber') : $user->get('uidNumber'); // User picture $p = $user->getPicture(); ?> <tr> <th class="entry-img"> <img width="40" height="40" src="<?php echo $p; ?> " alt="<?php echo $this->escape(stripslashes($user->get('name'))); ?> " /> </th> <td>
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ // No direct access defined('_HZEXEC_') or die; if (count($this->team) > 0) { ?> <ul class="team-selector" id="team-selector"> <?php foreach ($this->team as $owner) { // Get profile thumb image $profile = \Hubzero\User\Profile::getInstance($owner->userid); $actor = \Hubzero\User\Profile::getInstance(User::get('id')); $thumb = $profile ? $profile->getPicture() : $actor->getPicture(true); $org = $owner->a_organization ? $owner->a_organization : $owner->organization; $name = $owner->a_name ? $owner->a_name : $owner->fullname; $name = trim($name) ? $name : $owner->invited_email; $username = $owner->username ? $owner->username : Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_AUTHOR_UNCONFIRMED'); // Already an author? $selected = !empty($this->selected) && in_array($owner->id, $this->selected) ? 1 : 0; $class = $selected ? '' : 'allowed'; ?> <li id="author-<?php echo $owner->id; ?> " class="type-author <?php echo $class; ?>
/** * Method is called after user data is deleted from the database * * @param array $user holds the user data * @param boolean $success true if user was succesfully stored in the database * @param string $msg message * @return boolean True on success */ public function onAfterDeleteUser($user, $succes, $msg) { $xprofile = \Hubzero\User\Profile::getInstance($user['id']); // remove user from groups \Hubzero\User\Helper::removeUserFromGroups($user['id']); if (is_object($xprofile)) { $xprofile->delete(); } \Hubzero\Auth\Link::delete_by_user_id($user['id']); // Check if quota exists for the user require_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'users_quotas.php'; $quota = new \Components\Members\Tables\UsersQuotas($this->database); $quota->load(array('user_id' => $user['id'])); if ($quota->id) { $quota->delete(); } return true; }