本文整理汇总了PHP中user_load函数的典型用法代码示例。如果您正苦于以下问题:PHP user_load函数的具体用法?PHP user_load怎么用?PHP user_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter_init
function filter_init()
{
global $conf, $user;
// Inject values into the $conf array - will apply to all sites.
// This can be a useful place to apply generic development settings.
$conf_inject = unserialize(urldecode(runserver_env('RUNSERVER_CONF')));
// Merge in the injected conf, overriding existing items.
$conf = array_merge($conf, $conf_inject);
// Log in user if needed.
if (isset($_GET['login'])) {
$uid = runserver_env('RUNSERVER_USER');
if (!empty($uid) && $user->uid !== $uid) {
// If a user was provided, log in as this user.
$user = user_load($uid);
if (function_exists('drupal_session_regenerate')) {
// Drupal 7
drupal_session_regenerate();
} else {
// Drupal 6
sess_regenerate();
}
}
// Refresh the page (in case access denied has been called already).
drupal_goto($_GET['q']);
}
}
开发者ID:AndBicScadMedia,项目名称:drush-ops.github.com,代码行数:26,代码来源:runserver-prepend.php
示例2: mortgagespeak_menu_link
function mortgagespeak_menu_link(array $variables)
{
global $user;
$show_purple_tooltip = 0;
$user_info = user_load($user->uid);
if (isset($user_info->field_show_got_it_box) && !empty($user_info->field_show_got_it_box)) {
$show_purple_tooltip = $user_info->field_show_got_it_box['und'][0]['value'];
}
$sub_menu = '';
$element = $variables['element'];
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$variables['element']['#attributes']['class'][] = 'active';
$variables['element']['#localized_options']['attributes']['class'][] = 'active';
$output = l($element['#title'], $element['#href'], $options = $element['#localized_options']);
if ($show_purple_tooltip == 1) {
if ($element['#original_link']['menu_name'] == 'main-menu' && $element['#href'] == 'my-page/tracked-news') {
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . "<div id='purple-tooltip' class='purple-main-container'><div class='purple-inner'><div class='purple-text'>Access your Custom News Page here.</div><div class='purple-button'>ok, Got it</div></div></div></li>\n";
} else {
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
} else {
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
}
开发者ID:snehal-addweb,项目名称:Mortgagespeak,代码行数:26,代码来源:template.php
示例3: hook_nodewords_tags_permission_alter
/**
* Changes the permission a user has on the meta tags being edited.
*
* @param &$permission
* TRUE, if the user can edit the current meta tag.
* @param $object
* An array describing the object to which the meta tag are associated.
* @param $tag_name
* The name of the meta tag.
* @param $tag_info
* An array describing the meta tag.
*/
function hook_nodewords_tags_permission_alter(&$permission, $object, $tag_name, $tag_info)
{
global $user;
if (user_access('administer meta tags')) {
$permission = TRUE;
return;
}
if ($object['type'] == 'node' && ($node = node_load($options['id']))) {
if ($user->uid == $node->uid && user_access("edit one's own node meta tags")) {
$permission = TRUE;
return;
}
if (user_access('edit any node meta tags')) {
$permission = TRUE;
} else {
$permission = FALSE;
}
} elseif ($object['type'] == 'user' && ($account = user_load($object['id']))) {
if ($user->uid == $account->uid && user_access("edit one's own user profile meta tags")) {
$permission = TRUE;
return;
}
if (user_access('edit any user profile meta tags')) {
$permission = TRUE;
} else {
$permission = FALSE;
}
}
}
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d6,代码行数:41,代码来源:nodewords.api.php
示例4: getLuid
public function getLuid($account = NULL, $site = 0)
{
// Load user if needed...
if (is_int($account)) {
$account = user_load(array('uid' => $account));
} else {
if (!$account) {
global $user;
$account = $user;
}
}
// Set default value for site if necessary.
if (!$site) {
$site = variable_get('dissue_local_site', 1);
}
// Fetch the local user id for the account
$luid = db_result(db_query("SELECT luid\n FROM {dissue_user}\n WHERE sid = %d\n AND uid = %d", array(':sid' => $site, ':uid' => $account->uid)));
// Create a dissue entry for the user if it didn't have one
if (!$luid) {
$values = array('name' => $account->name, 'sid' => $site, 'uid' => $account->uid);
drupal_write_record('dissue_user', $values);
$luid = $values['luid'];
}
return $luid;
}
开发者ID:hugowetterberg,项目名称:dissue,代码行数:25,代码来源:DIssue.php
示例5: actionHome
public function actionHome($sid, $uid)
{
if (user_load($uid)) {
$voteself = taxonomy_term_load($sid);
if ($voteself) {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')->fieldCondition('field_zhuanti', 'tid', $sid)->entityCondition('bundle', '_xuanxiang')->propertyCondition('status', 1)->propertyOrderBy('nid', 'DESC');
$result = $query->execute();
if (isset($result['node'])) {
$vnids = array_keys($result['node']);
$nodes = node_load_multiple($vnids);
}
//var_dump($voteself);
$criteria = new CDbCriteria();
$criteria->condition = 'uid=:uid AND sid=:sid';
$criteria->params = array(':uid' => $uid, ':sid' => $sid);
$vote = Vote::model()->findAll($criteria);
if ($vote) {
$this->renderPartial('result', array('model' => $voteself, 'voteitems' => $nodes));
} else {
$this->renderPartial('vote', array('model' => $voteself, 'uid' => $uid, 'voteitems' => $nodes));
}
}
} else {
$this->renderPartial('error', array('error_code' => '2', 'sid' => $sid));
}
}
开发者ID:dingruoting,项目名称:tydaily,代码行数:27,代码来源:VoteController.php
示例6: load_data
public function load_data($ar_data = null)
{
$result = array();
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'sito_parcheggio')->propertyCondition('status', 1)->addMetaData('account', user_load(1));
$qryres = $query->execute();
if (isset($qryres['node'])) {
$items_nids = array_keys($qryres['node']);
$items = entity_load('node', $items_nids);
$first = true;
foreach ($items as $nodo => $elem) {
if ($first) {
$result[0]['codice'] = 0;
$result[0]['descrizione'] = 'Selezionare un parcheggio';
$first = false;
}
$result[$nodo]['codice'] = $elem->field_sp_codice[LANGUAGE_NONE][0]['value'];
$result[$nodo]['descrizione'] = $elem->title;
$result[$nodo]['indirizzo']['indirizzo'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['thoroughfare'];
$result[$nodo]['indirizzo']['cap'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['postal_code'];
$result[$nodo]['indirizzo']['localita'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['locality'];
$result[$nodo]['indirizzo']['provincia'] = $elem->field_sp_indirizzo[LANGUAGE_NONE][0]['administrative_area'];
}
}
$this->ar_lista = $result;
}
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:26,代码来源:sito_parcheggio.php
示例7: deliver
/**
* Override parent deliver() function.
*/
public function deliver(array $output = array())
{
$plugin = $this->plugin;
$message = $this->message;
$options = $plugin['options'];
$account = user_load($message->uid);
$mail = !empty($options['mail']) ? $options['mail'] : $account->mail;
$languages = language_list();
if (!$options['language override']) {
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
} else {
$lang = $languages[$message->language];
}
// The subject in an email can't be with HTML, so strip it.
$output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
// Allow for overriding the 'from' of the message.
$from = isset($options['from']) ? $options['from'] : NULL;
$from_account = !empty($message->user->uid) ? user_load($message->user->uid) : $account;
$mimemail_name = variable_get('mimemail_name', t('Atrium'));
$from = array('name' => oa_core_realname($from_account) . ' (' . $mimemail_name . ')', 'mail' => is_array($from) ? $from['mail'] : $from);
// Pass the message entity along to hook_drupal_mail().
$output['message_entity'] = $message;
if (!empty($message->email_attachments)) {
$output['attachments'] = isset($output['attachments']) ? $output['attachments'] : array();
$output['attachments'] = array_merge($message->email_attachments, $output['attachments']);
}
return drupal_mail('message_notify', $message->type, $mail, $lang, $output, $from);
}
开发者ID:redponey,项目名称:openatrium-7.x-2.51,代码行数:31,代码来源:OaEmail.class.php
示例8: _bbcom_subscribe_to_thread
function _bbcom_subscribe_to_thread($uid, $nid)
{
$account = user_load($uid);
$subscription = array('type' => 'thread', 'uid' => $uid, 'fields' => array('nid' => $nid), 'send_method' => notifications_user_setting('send_method', $account), 'send_interval' => notifications_user_setting('send_interval', $account), 'event_type' => 'node');
$subscription = notifications_build_subscription($subscription);
$ret = notifications_save_subscription($subscription);
}
开发者ID:rollinsb1010,项目名称:bbcom,代码行数:7,代码来源:notifications-migration.php
示例9: _scratchpadify_install_configure_form_submit
function _scratchpadify_install_configure_form_submit($form, &$form_state)
{
global $user;
variable_set('site_name', $form_state['values']['site_name']);
variable_set('site_mail', $form_state['values']['site_mail']);
variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
// Enable update.module if this option was selected.
if ($form_state['values']['update_status_module'][1]) {
// Stop enabling the update module, it's a right royal pain in the arse.
//drupal_install_modules(array('update'));
}
// Turn this off temporarily so that we can pass a password through.
variable_set('user_email_verification', FALSE);
$form_state['old_values'] = $form_state['values'];
$form_state['values'] = $form_state['values']['account'];
// We precreated user 1 with placeholder values. Let's save the real values.
$account = user_load(1);
$merge_data = array('init' => $form_state['values']['mail'], 'roles' => array(), 'status' => 0);
user_save($account, array_merge($form_state['values'], $merge_data));
// Log in the first user.
user_authenticate($form_state['values']);
$form_state['values'] = $form_state['old_values'];
unset($form_state['old_values']);
variable_set('user_email_verification', TRUE);
if (isset($form_state['values']['clean_url'])) {
variable_set('clean_url', $form_state['values']['clean_url']);
}
// The user is now logged in, but has no session ID yet, which
// would be required later in the request, so remember it.
$user->sid = session_id();
// Record when this install ran.
variable_set('install_time', time());
}
开发者ID:edchacon,项目名称:scratchpads,代码行数:33,代码来源:scratchpadify.profile-help.php
示例10: authenticate
/**
* Implements RestfulAuthenticationInterface::authenticate().
*/
public function authenticate(array $request = array(), $method = \RestfulInterface::GET) {
if (!drupal_session_started() && !$this->isCli()) {
return;
}
global $user;
$account = user_load($user->uid);
if (!\RestfulBase::isWriteMethod($method) || empty($request['__application']['rest_call'])) {
// Request is done via API not CURL, or not a write operation, so we don't
// need to check for a CSRF token.
return $account;
}
if (empty($request['__application']['csrf_token'])) {
throw new \RestfulBadRequestException('No CSRF token passed in the HTTP header.');
}
if (!drupal_valid_token($request['__application']['csrf_token'], \RestfulBase::TOKEN_VALUE)) {
throw new \RestfulForbiddenException('CSRF token validation failed.');
}
// CSRF validation passed.
return $account;
}
开发者ID:humanitarianresponse,项目名称:site,代码行数:28,代码来源:RestfulAuthenticationCookie.class.php
示例11: guifi_api_auth_login
/**
* Try to authenticate the user using any method
* At the moment there is only one method available: 'password'
*
* @param GuifiAPI $gapi GuifiAPI object
* @param $parameters Parameters to login
* @return boolean Whether the user authenticated or not
*/
function guifi_api_auth_login($gapi, $parameters)
{
global $user;
// if (!guifi_api_check_fields($gapi, array('method' ), $parameters)) {
// return FALSE;
// }
if (!empty($parameters['method'])) {
$method = $parameters['method'];
} else {
$method = 'password';
}
switch ($method) {
case 'password':
if (!guifi_api_check_fields($gapi, array('username', 'password'), $parameters)) {
return FALSE;
}
$account = user_load(array('name' => $parameters['username'], 'pass' => trim($parameters['password']), 'status' => 1));
if ($account->uid) {
$user = $account;
$time = time();
$rand_key = rand(100000, 999999);
$token = base64_encode($user->uid . ':' . md5($user->mail . $user->pass . $user->created . $user->uid . $time . $rand_key) . ':' . $time);
db_query("DELETE FROM {guifi_api_tokens} WHERE uid = %d", $user->uid);
db_query("INSERT INTO {guifi_api_tokens} (uid, token, created, rand_key) VALUES (%d, '%s', FROM_UNIXTIME(%d), %d)", $user->uid, $token, $time, $rand_key);
$gapi->addResponseField('authToken', $token);
return TRUE;
} else {
$gapi->addError(403, "Either the supplied username or password are not correct");
return FALSE;
}
break;
}
return FALSE;
}
开发者ID:itorres,项目名称:drupal-guifi,代码行数:42,代码来源:guifi_api.inc.php
示例12: createOrUpdateWorkSession
/**
* Create a new session or update an open session.
*/
public function createOrUpdateWorkSession()
{
$request = $this->getRequest();
$account = $this->getAccount();
if (!user_access('timewatch punch')) {
throw new RestfulForbiddenException('No punch access.');
}
if (empty($request['pincode'])) {
throw new \RestfulBadRequestException('Pincode is required');
}
$uid = timewatch_session_get_uid_by_pincode($request['pincode']);
if (!$uid) {
throw new \RestfulBadRequestException('Wrong pincode');
}
$employee_account = user_load($uid);
// Find an existing session with no end date.
$query = new EntityFieldQuery();
$result = $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'work_session')->propertyCondition('status', NODE_PUBLISHED)->fieldCondition('field_employee', 'target_id', $uid)->fieldCondition('field_session_date', 'value2', NULL)->range(0, 1)->execute();
if (empty($result['node'])) {
// When there's no open session, create a new one.
$values = array('type' => 'work_session', 'uid' => $account->uid, 'status' => NODE_PUBLISHED, 'title' => format_string('@date - @user', array('@date' => date('d/m/y'), '@user' => $employee_account->name)));
$node = entity_create('node', $values);
$wrapper = entity_metadata_wrapper('node', $node);
$wrapper->field_employee->set($uid);
$wrapper->field_session_date->value->set(REQUEST_TIME);
} else {
// Otherwise set the end date of the open session.
$wrapper = entity_metadata_wrapper('node', key($result['node']));
$wrapper->field_session_date->value2->set(REQUEST_TIME);
}
$wrapper->save();
return $this->viewEntity($wrapper->getIdentifier());
}
开发者ID:Gizra,项目名称:timewatch-server,代码行数:36,代码来源:TimewatchPunchResource.class.php
示例13: loadConvenzioneFromTarga
private function loadConvenzioneFromTarga($ar_data)
{
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'parkauto')->propertyCondition('status', 1)->fieldCondition('field_p_targa_auto_cliente', 'value', trim($ar_data['rc_targa_auto_cliente']), '=')->fieldCondition('field_p_sito_parking', 'nid', trim($ar_data['sito']))->range(0, 1)->addMetaData('account', user_load(1));
$qryres = $query->execute();
return $qryres;
}
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:7,代码来源:movimenti_cliente.php
示例14: custom_export_download_answers_form_submit
function custom_export_download_answers_form_submit()
{
$select = db_select('quiz_short_answer_user_answers', 'qsa');
$select->addJoin('inner', 'node', 'node', 'node.nid = qsa.question_nid and node.vid = qsa.question_vid');
$select->addJoin('inner', 'quiz_node_results_answers', 'qnr', 'qnr.result_id = qsa.result_id and qnr.question_nid = qsa.question_nid and qnr.question_vid = qsa.question_vid');
$select->addJoin('inner', 'users', 'users', 'qnr.uid = users.uid');
$select->addField('qsa', 'answer');
$select->addField('node', 'title');
$select->addField('users', 'name');
$select->addField('users', 'uid');
$select->orderBy('qnr.result_id', 'desc');
$res = $select->execute();
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header("Content-type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=quiz_answers.csv");
header("Expires: 0");
header("Pragma: public");
$fh = @fopen('php://output', 'w');
//write the header row.
//name password email phone ean code
fputcsv($fh, array('answer', 'question', 'name', 'uid', 'eancode', 'store name'));
while ($row = $res->fetchObject()) {
if ($eancode = _custom_get_eancode_from_account(user_load($row->uid))) {
if ($pos_node = _custom_get_node_by_eancode($eancode)) {
$pos_name = $pos_node->title;
fputcsv($fh, array($row->answer, $row->title, $row->name, $row->uid, $eancode, $pos_name));
}
}
}
// Close the file
fclose($fh);
// Make sure nothing else is sent, our file is done
exit;
}
开发者ID:ty-apps,项目名称:snippets,代码行数:35,代码来源:drupal.php
示例15: authenticate
/**
* {@inheritdoc}
*/
public function authenticate(RequestInterface $request)
{
// Access token may be on the request, or in the headers.
if (!($token = $this->extractToken($request))) {
return NULL;
}
// Check if there is a token that has not expired yet.
$query = new \EntityFieldQuery();
$result = $query->entityCondition('entity_type', 'restful_token_auth')->entityCondition('bundle', 'access_token')->propertyCondition('token', $token)->range(0, 1)->execute();
if (empty($result['restful_token_auth'])) {
// No token exists.
return NULL;
}
$id = key($result['restful_token_auth']);
$auth_token = entity_load_single('restful_token_auth', $id);
if (!empty($auth_token->expire) && $auth_token->expire < REQUEST_TIME) {
// Token is expired.
if (variable_get('restful_token_auth_delete_expired_tokens', TRUE)) {
// Token has expired, so we can delete this token.
$auth_token->delete();
}
return NULL;
}
return user_load($auth_token->uid);
}
开发者ID:jhoffman-tm,项目名称:waldorf-deployment,代码行数:28,代码来源:TokenAuthentication.php
示例16: template_preprocess_layout__double_fixed_inner_rev
/**
* Prepare variables for the drawer layout template file.
*/
function template_preprocess_layout__double_fixed_inner_rev(&$variables)
{
if ($variables['content']['sidebar'] && $variables['content']['drawer']) {
$variables['classes'][] = 'layout-both-sidebars';
} elseif ($variables['content']['sidebar'] || $variables['content']['drawer']) {
$variables['classes'][] = 'layout-one-sidebar';
if ($variables['content']['sidebar']) {
$variables['classes'][] = 'layout-has-sidebar';
} else {
$variables['classes'][] = 'layout-has-drawer';
}
} else {
$variables['classes'][] = 'layout-no-sidebars';
}
// Special handling for header image.
$variables['main_attributes'] = array('class' => array('l-content'));
if (arg(0) == 'user' && is_numeric(arg(1)) && !arg(2)) {
// We are on the user profile page.
$variables['main_attributes']['class'][] = 'account-page';
// Check to see if there is a profile image.
$account = user_load(arg(1));
// Entity cache should save us here?
if (isset($account->field_header_photo[LANGUAGE_NONE][0]['uri'])) {
// Generate an image at the correct size.
$image = image_style_url('header', $account->field_header_photo[LANGUAGE_NONE][0]['uri']);
$variables['main_attributes']['style'] = 'background-image: url(' . $image . ')';
// Add an addidional class.
$variables['main_attributes']['class'][] = 'has-background';
}
}
}
开发者ID:serundeputy,项目名称:backdropcms.org,代码行数:34,代码来源:double_fixed_inner_rev.php
示例17: _constructDependencies
/**
* (non-PHPdoc)
* @see Entity::_constructDependencies()
*/
protected function _constructDependencies($node)
{
// Dependency on content type.
$this->addDependency('content', $node->type);
// Dependency on user, only if exists.
if ($node->uid && ($user = user_load($node->uid))) {
$user_uuid = $this->addDependency('user', $user->uid);
$this->setData('user', $user_uuid);
}
// Dependency on terms.
$terms = array();
foreach ($node->taxonomy as $term) {
$term_uuid = $this->addDependency('term', $term->tid);
$terms[] = $term_uuid;
}
$this->setData('terms', $terms);
// Handle node reference fields.
$nodes = array();
foreach ($node as $field_name => &$value) {
if (substr($field_name, 0, 6) == 'field_' && isset($value[0]['nid'])) {
$nodes[$field_name] = array();
foreach ($value as $index => $referenced) {
if (!empty($referenced['nid'])) {
$node_uuid = $this->addDependency('node', $referenced['nid']);
$nodes[$field_name][$index] = $node_uuid;
}
}
}
}
$this->setData('nodes', $nodes);
// TODO handle file and media fields, for this, we need abstract file
// fetching through our entity parser.
}
开发者ID:pounard,项目名称:yamm,代码行数:37,代码来源:Node.php
示例18: getNodeGrants
/**
* {@inheritdoc}
*/
public static function getNodeGrants($account = NULL, $op = 'view')
{
if (empty($account)) {
global $user;
$account = user_load($user->uid);
}
if (!$account->uid) {
// Anonymous user.
return array();
}
if ($op != 'view') {
// Not a view operation.
return array();
}
$realms = array();
$domain = explode('@', $account->mail);
$query = db_select('node', 'n');
$query->join('field_data_c4m_domain', 'd', 'd.entity_id = n.nid');
$query->condition('n.status', 1, '=')->condition('n.type', 'organisation', '=')->condition('d.c4m_domain_domain', $domain[1]);
$query->fields('n', array('title', 'nid'));
$organisations = $query->execute()->fetchAll();
foreach ($organisations as $organisation) {
// The "realm" name is the plugin name.
// The "gid" is always 1, as it just indicates the user has the email
// domain.
$realm = 'organisation::' . $organisation->nid;
$realms[$realm] = array(1);
}
return $realms;
}
开发者ID:justinlevi,项目名称:capacity4more,代码行数:33,代码来源:PluggableNodeAccessOrganisation.class.php
示例19: simpleclean_preprocess_node
/**
* Format submitted by in articles
*/
function simpleclean_preprocess_node(&$vars)
{
$node = $vars['node'];
$vars['date'] = format_date($node->created, 'custom', 'd M Y');
if (variable_get('node_submitted_' . $node->type, TRUE)) {
$vars['display_submitted'] = TRUE;
$vars['submitted'] = t('By @username on !datetime', array('@username' => strip_tags(theme('username', array('account' => $node))), '!datetime' => $vars['date']));
$vars['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : '';
// Add a footer for post
$account = user_load($vars['node']->uid);
$vars['simpleclean_postfooter'] = '';
if (!empty($account->signature)) {
$postfooter = "<div class='post-footer'>" . $vars['user_picture'] . "<h3>" . check_plain(format_username($account)) . "</h3>";
$cleansignature = strip_tags($account->signature);
$postfooter .= "<p>" . check_plain($cleansignature) . "</p>";
$postfooter .= "</div>";
$vars['simpleclean_postfooter'] = $postfooter;
}
} else {
$vars['display_submitted'] = FALSE;
$vars['submitted'] = '';
$vars['user_picture'] = '';
}
// Remove Add new comment from teasers on frontpage
if ($vars['is_front']) {
unset($vars['content']['links']['comment']['#links']['comment-add']);
unset($vars['content']['links']['comment']['#links']['comment_forbidden']);
}
}
开发者ID:casivaagustin,项目名称:drupal-services,代码行数:32,代码来源:template.php
示例20: banner_status
function banner_status($uid = 0, $profile = NULL)
{
// User account banner status
if (!$profile && !$uid) {
global $user;
}
if ($uid) {
$user = user_load($uid);
}
if ($profile) {
$user = user_load($profile->uid);
}
$max = array('BA49' => 49, 'BA75' => 75, 'BA100' => 100, 'BAINF' => 10000);
$umax = 0;
foreach ($max as $key => $val) {
if (in_array($key, array_values($user->roles))) {
$umax = $val;
}
}
$r = db_query("select distinct `nid`, `status` from node where uid = :uid and `type` = 'banner_ad'", array(":uid" => $user->uid));
$pub = 0;
$unPub = 0;
while ($obj = $r->fetchObject()) {
if ($obj->status == 1) {
$pub++;
} else {
$unPub++;
}
}
return array('max' => $umax, 'published' => $pub, 'unpublished' => $unPub, 'balance' => $umax - $pub);
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:31,代码来源:banner.php
注:本文中的user_load函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论