本文整理汇总了PHP中Hubzero\User\Profile类的典型用法代码示例。如果您正苦于以下问题:PHP Profile类的具体用法?PHP Profile怎么用?PHP Profile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* 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();
}
示例2: __construct
/**
* 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'));
}
示例3: display
/**
* 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();
}
示例4: plgSupportCaptcha
/**
* 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;
}
}
}
示例5: __construct
/**
* 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']);
}
示例6: onAfterRoute
/**
* 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();
}
}
}
示例7: creator
/**
* 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;
}
示例8: run
/**
* 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();
}
}
示例9: creator
/**
* 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;
}
示例10: displaySite
/**
* 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');
}
示例11: creator
/**
* 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;
}
示例12: _authorCheck
/**
* 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));
}
}
}
示例13: profileExpander
/**
* Function to return profile object
*
* @param integer $uidNumber User identifier
* @return object Profile object
*/
private function profileExpander($uidNumber)
{
return Profile::getInstance($uidNumber);
}
示例14: owner
/**
* 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;
}
示例15: creator
/**
* 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;
}