本文整理汇总了PHP中KunenaUser::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaUser::getInstance方法的具体用法?PHP KunenaUser::getInstance怎么用?PHP KunenaUser::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaUser
的用法示例。
在下文中一共展示了KunenaUser::getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuthor
public function getAuthor()
{
if (!$this->_author) {
$this->_author = KunenaUser::getInstance((int) $this->created_by);
}
return $this->_author;
}
示例2: syncUser
/**
* @param UserTable $user
*/
public function syncUser($user)
{
global $_CB_framework;
if (!class_exists('KunenaUser')) {
return;
}
$exists = KunenaUser::getInstance((int) $user->id);
if ($exists) {
$plugin = cbforumsClass::getPlugin();
$updated = false;
$fields = array('ordering', 'viewtype', 'signature', 'personaltext', 'gender', 'birthdate', 'location', 'icq', 'aim', 'yim', 'msn', 'skype', 'twitter', 'facebook', 'gtalk', 'myspace', 'linkedin', 'delicious', 'friendfeed', 'digg', 'blogspot', 'flickr', 'bebo', 'website', 'email', 'online', 'subscribe', 'listlimit');
foreach ($fields as $field) {
$cbField = $plugin->params->get('k20_' . $field, null);
if ($cbField && isset($user->{$cbField})) {
$value = $user->get($cbField);
// Convert legacy values for B/C:
switch ($value) {
case '_UE_ORDERING_OLDEST':
case 'UE_ORDERING_OLDEST':
case 'Oldest':
$value = 0;
break;
case '_UE_ORDERING_LATEST':
case 'UE_ORDERING_LATEST':
case 'Latest':
$value = 1;
break;
case '_UE_VIEWTYPE_FLAT':
case 'UE_VIEWTYPE_FLAT':
case 'Flat':
$value = 'flat';
break;
case '_UE_VIEWTYPE_THREADED':
case 'UE_VIEWTYPE_THREADED':
case 'Threaded':
$value = 'threaded';
break;
case '_UE_VIEWTYPE_INDENTED':
case 'UE_VIEWTYPE_INDENTED':
case 'Indented':
$value = 'indented';
break;
case '_UE_MALE':
case 'UE_MALE':
case 'Male':
$value = 1;
break;
case '_UE_FEMALE':
case 'UE_FEMALE':
case 'Female':
$value = 2;
break;
case '_UE_HIDE':
case 'UE_HIDE':
case '_UE_NO':
case 'UE_NO':
case '_UE_UNKNOWN':
case 'UE_UNKNOWN':
case 'Hide':
case 'No':
case 'Unknown':
$value = 0;
break;
case '_UE_SHOW':
case 'UE_SHOW':
case '_UE_YES':
case 'UE_YES':
case 'Show':
case 'Yes':
$value = 1;
break;
}
// Convert the field name and/or value to Kunena compatible:
switch ($field) {
case 'birthdate':
if ($value && !in_array($value, array('0000-00-00', '0000-00-00 00:00:00'))) {
$value = $_CB_framework->getUTCDate('Y-m-d', $value);
} else {
$value = '0000-00-00';
}
break;
case 'viewtype':
$field = 'view';
break;
case 'email':
$field = 'hideEmail';
break;
case 'online':
$field = 'showOnline';
break;
case 'personaltext':
$field = 'personalText';
break;
case 'subscribe':
$field = 'canSubscribe';
break;
case 'listlimit':
//.........这里部分代码省略.........
示例3: getUserSettings
/**
* Puts user forum settings into object
*
* @param moscomprofilerUser $user
* @param object $forum
* @param mixed $additional
* @return object
*/
function getUserSettings($user, $forum, $additional = null)
{
global $_CB_database;
static $cache = array();
if (!isset($cache[$user->id])) {
if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
$query = 'SELECT f.*' . $additional . "\n FROM " . $_CB_database->NameQuote('#__' . $forum->prefix . '_users') . 'AS f' . ', ' . $_CB_database->NameQuote('#__users') . 'AS u' . "\n WHERE f." . $_CB_database->NameQuote('userid') . " = u." . $_CB_database->NameQuote('id') . "\n AND f." . $_CB_database->NameQuote('userid') . " = " . (int) $user->id;
$_CB_database->setQuery($query, 0, 1);
$settings = null;
$_CB_database->loadObject($settings);
} elseif (class_exists('KunenaUser')) {
$settings = KunenaUser::getInstance((int) $user->id);
} else {
$settings = null;
}
$cache[$user->id] = $settings ? $settings : null;
}
return $cache[$user->id];
}
示例4: getUser
/**
* Get Kunena user object
*
* Returns the global {@link KunenaUser} object, only creating it if it doesn't already exist.
*
* @param int $id The user to load - Can be an integer or string - If string, it is converted to Id automatically.
*
* @return object KunenaUser
*/
public static function getUser($id = null, $reload = false)
{
kimport('user');
return KunenaUser::getInstance($id, $reload);
}