当前位置: 首页>>代码示例>>PHP>>正文


PHP bb_get_current_user_info函数代码示例

本文整理汇总了PHP中bb_get_current_user_info函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_get_current_user_info函数的具体用法?PHP bb_get_current_user_info怎么用?PHP bb_get_current_user_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bb_get_current_user_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bb_add_topic_tags

/**
 * bb_add_topic_tag() - Adds a multiple tags to a topic.
 *
 * @param int $topic_id
 * @param array|string $tags The (unsanitized) full names of the tag to be added.  CSV or array.
 * @return array|bool The TT_IDs of the new bb_topic_tags or false on failure
 */
function bb_add_topic_tags($topic_id, $tags)
{
    global $wp_taxonomy_object;
    $topic_id = (int) $topic_id;
    if (!($topic = get_topic($topic_id))) {
        return false;
    }
    if (!bb_current_user_can('add_tag_to', $topic_id)) {
        return false;
    }
    $user_id = bb_get_current_user_info('id');
    $tags = apply_filters('bb_add_topic_tags', $tags, $topic_id);
    if (!is_array($tags)) {
        $tags = explode(',', (string) $tags);
    }
    $tt_ids = $wp_taxonomy_object->set_object_terms($topic->topic_id, $tags, 'bb_topic_tag', array('append' => true, 'user_id' => $user_id));
    if (is_array($tt_ids)) {
        global $bbdb;
        $bbdb->query($bbdb->prepare("UPDATE {$bbdb->topics} SET tag_count = tag_count + %d WHERE topic_id = %d", count($tt_ids), $topic->topic_id));
        wp_cache_delete($topic->topic_id, 'bb_topic');
        foreach ($tt_ids as $tt_id) {
            do_action('bb_tag_added', $tt_id, $user_id, $topic_id);
        }
        return $tt_ids;
    }
    return false;
}
开发者ID:hscale,项目名称:webento,代码行数:34,代码来源:functions.bb-topic-tags.php

示例2: is_current_user

 function is_current_user($user)
 {
     $id = bb_get_current_user_info('id');
     if ($id == $user['id']) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:TheProjecter,项目名称:web-forums-standard,代码行数:8,代码来源:wfip-bbpress.php

示例3: bb_block_current_user

function bb_block_current_user()
{
    global $bbdb;
    if ($id = bb_get_current_user_info('id')) {
        bb_update_usermeta($id, $bbdb->prefix . 'been_blocked', 1);
    }
    // Just for logging.
    bb_die(__("You've been blocked.  If you think a mistake has been made, contact this site's administrator."));
}
开发者ID:laiello,项目名称:cartonbank,代码行数:9,代码来源:functions.bb-users.php

示例4: rdd_check_params

function rdd_check_params()
{
    $result['ok'] = true;
    $result['error_msg'] = '';
    // Comprobar que tenemos todos los parámetros
    if (isset($_GET['uid']) && is_numeric($_GET['uid'])) {
        $uid = (int) $_GET['uid'];
        $result['uid'] = $uid;
    } else {
        $result['ok'] = false;
        $result['error_msg'] = 'No se ha indicado el usuario';
        return $result;
    }
    if (isset($_GET['lat']) && is_numeric($_GET['lat'])) {
        $lat = (double) $_GET['lat'];
        $result['lat'] = $lat;
    } else {
        $result['ok'] = false;
        $result['error_msg'] = 'No se ha indicado la latitud';
        return $result;
    }
    if (isset($_GET['lon']) && is_numeric($_GET['lon'])) {
        $lon = (double) $_GET['lon'];
        $result['lon'] = $lon;
    } else {
        $result['ok'] = false;
        $result['error_msg'] = 'No se ha indicado la longitud';
        return $result;
    }
    // Comprobar que el usuario logueado en bbpress es el mismo que queremos
    // modificar
    $user_id = bb_get_current_user_info('id');
    if ($user_id != $uid) {
        $result['ok'] = false;
        $result['error_msg'] = 'Sólo se puede modificar la información del usuario actual';
        return $result;
    }
    return $result;
}
开发者ID:amrtn,项目名称:bb-rodadas,代码行数:39,代码来源:process_position.php

示例5: bb_insert_topic

function bb_insert_topic($args = null)
{
    global $bbdb;
    if (!($args = wp_parse_args($args))) {
        return false;
    }
    $fields = array_keys($args);
    if (isset($args['topic_id']) && false !== $args['topic_id']) {
        $update = true;
        if (!($topic_id = (int) get_topic_id($args['topic_id']))) {
            return false;
        }
        // Get from db, not cache.  Good idea?  Prevents trying to update meta_key names in the topic table (get_topic() returns appended topic obj)
        $topic = $bbdb->get_row($bbdb->prepare("SELECT * FROM {$bbdb->topics} WHERE topic_id = %d", $topic_id));
        $defaults = get_object_vars($topic);
        unset($defaults['topic_id']);
        // Only update the args we passed
        $fields = array_intersect($fields, array_keys($defaults));
        if (in_array('topic_poster', $fields)) {
            $fields[] = 'topic_poster_name';
        }
        if (in_array('topic_last_poster', $fields)) {
            $fields[] = 'topic_last_poster_name';
        }
    } else {
        $topic_id = false;
        $update = false;
        $now = bb_current_time('mysql');
        $current_user_id = bb_get_current_user_info('id');
        $defaults = array('topic_title' => '', 'topic_slug' => '', 'topic_poster' => $current_user_id, 'topic_poster_name' => '', 'topic_last_poster' => $current_user_id, 'topic_last_poster_name' => '', 'topic_start_time' => $now, 'topic_time' => $now, 'topic_open' => 1, 'forum_id' => 0);
        // Insert all args
        $fields = array_keys($defaults);
    }
    $defaults['tags'] = false;
    // accepts array or comma delimited string
    extract(wp_parse_args($args, $defaults));
    unset($defaults['tags']);
    if (!($forum = bb_get_forum($forum_id))) {
        return false;
    }
    $forum_id = (int) $forum->forum_id;
    if (!($user = bb_get_user($topic_poster))) {
        $user = bb_get_user($topic_poster_name, array('by' => 'login'));
    }
    if (!empty($user)) {
        $topic_poster = $user->ID;
        $topic_poster_name = $user->user_login;
    }
    if (!($last_user = bb_get_user($topic_last_poster))) {
        $last_user = bb_get_user($topic_last_poster_name, array('by' => 'login'));
    }
    if (!empty($last_user)) {
        $topic_last_poster = $last_user->ID;
        $topic_last_poster_name = $last_user->user_login;
    }
    if (in_array('topic_title', $fields)) {
        $topic_title = apply_filters('pre_topic_title', $topic_title, $topic_id);
        if (strlen($topic_title) < 1) {
            return false;
        }
    }
    if (in_array('topic_slug', $fields)) {
        $slug_sql = $update ? "SELECT topic_slug FROM {$bbdb->topics} WHERE topic_slug = %s AND topic_id != %d" : "SELECT topic_slug FROM {$bbdb->topics} WHERE topic_slug = %s";
        $topic_slug = $_topic_slug = bb_slug_sanitize($topic_slug ? $topic_slug : wp_specialchars_decode($topic_title, ENT_QUOTES));
        if (strlen($_topic_slug) < 1) {
            $topic_slug = $_topic_slug = '0';
        }
        while (is_numeric($topic_slug) || ($existing_slug = $bbdb->get_var($bbdb->prepare($slug_sql, $topic_slug, $topic_id)))) {
            $topic_slug = bb_slug_increment($_topic_slug, $existing_slug);
        }
    }
    if ($update) {
        $bbdb->update($bbdb->topics, compact($fields), compact('topic_id'));
        wp_cache_delete($topic_id, 'bb_topic');
        if (in_array('topic_slug', $fields)) {
            wp_cache_delete($topic->topic_slug, 'bb_topic_slug');
        }
        wp_cache_flush('bb_query');
        wp_cache_flush('bb_cache_posts_post_ids');
        do_action('bb_update_topic', $topic_id);
    } else {
        $bbdb->insert($bbdb->topics, compact($fields));
        $topic_id = $bbdb->insert_id;
        $bbdb->query($bbdb->prepare("UPDATE {$bbdb->forums} SET topics = topics + 1 WHERE forum_id = %d", $forum_id));
        wp_cache_delete($forum_id, 'bb_forum');
        wp_cache_flush('bb_forums');
        wp_cache_flush('bb_query');
        wp_cache_flush('bb_cache_posts_post_ids');
        do_action('bb_new_topic', $topic_id);
    }
    if (!empty($tags)) {
        bb_add_topic_tags($topic_id, $tags);
    }
    do_action('bb_insert_topic', $topic_id, $args, compact(array_keys($args)));
    // topic_id, what was passed, what was used
    return $topic_id;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:97,代码来源:functions.bb-topics.php

示例6: printf

<p class="login">
	<?php 
printf(__('Welcome, %1$s'), bb_get_profile_link(bb_get_current_user_info('name')));
?>
	<?php 
bb_admin_link('before= | ');
?>
	| <?php 
bb_logout_link();
?>
</p>
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:11,代码来源:logged-in.php

示例7: printf

<ul class="topicmeta">
	<li><?php 
    printf(__('Started %1$s ago by %2$s'), get_topic_start_time(), get_topic_author());
    ?>
</li>
<?php 
    if (1 < get_topic_posts()) {
        ?>
	<li><?php 
        printf(__('<a href="%1$s">Latest reply</a> from %2$s'), attribute_escape(get_topic_last_post_link()), get_topic_last_poster());
        ?>
</li>
<?php 
    }
    if (bb_is_user_logged_in()) {
        $class = 0 === is_user_favorite(bb_get_current_user_info('id')) ? ' class="is-not-favorite"' : '';
        ?>
	<li<?php 
        echo $class;
        ?>
 id="favorite-toggle"><?php 
        user_favorites_link();
        ?>
</li>
<?php 
    }
    do_action('topicmeta');
    ?>
</ul>
</div>
开发者ID:billerby,项目名称:Surdeg,代码行数:30,代码来源:sidebar.php

示例8: bb_can_access_tab

function bb_can_access_tab($profile_tab, $viewer_id, $owner_id)
{
    global $bb_current_user;
    $viewer_id = (int) $viewer_id;
    $owner_id = (int) $owner_id;
    if ($viewer_id == bb_get_current_user_info('id')) {
        $viewer =& $bb_current_user;
    } else {
        $viewer = new BP_User($viewer_id);
    }
    if (!$viewer) {
        return '' === $profile_tab[2];
    }
    if ($owner_id == $viewer_id) {
        if ('' === $profile_tab[1]) {
            return true;
        } else {
            return $viewer->has_cap($profile_tab[1]);
        }
    } else {
        if ('' === $profile_tab[2]) {
            return true;
        } else {
            return $viewer->has_cap($profile_tab[2]);
        }
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:27,代码来源:functions.bb-core.php

示例9: bb_just_in_time_script_localization

/**
 * Load localized script just in time for MCE.
 *
 * These localizations require information that may not be loaded even by init.
 */
function bb_just_in_time_script_localization()
{
    wp_localize_script('topic', 'bbTopicJS', array('currentUserId' => bb_get_current_user_info('id'), 'topicId' => get_topic_id(), 'favoritesLink' => get_favorites_link(), 'isFav' => (int) is_user_favorite(bb_get_current_user_info('id')), 'confirmPostDelete' => __("Are you sure you want to delete this post?"), 'confirmPostUnDelete' => __("Are you sure you want to undelete this post?"), 'favLinkYes' => __('favorites'), 'favLinkNo' => __('?'), 'favYes' => __('This topic is one of your %favLinkYes% [%favDel%]'), 'favNo' => __('%favAdd% (%favLinkNo%)'), 'favDel' => __('&times;'), 'favAdd' => __('Add this topic to your favorites')));
}
开发者ID:un1coin,项目名称:ovn-space,代码行数:9,代码来源:functions.bb-script-loader.php

示例10: bb_repermalink

}
bb_repermalink();
if (!$topic) {
    bb_die(__('Topic not found.'));
}
if ($view_deleted) {
    add_filter('get_thread_where', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
    add_filter('get_thread_post_ids', create_function('', 'return "p.topic_id = ' . $topic_id . '";'));
    add_filter('post_edit_uri', 'bb_make_link_view_all');
}
$bb_db_override = false;
do_action('bb_topic.php_pre_db', $topic_id);
if (!$bb_db_override) {
    $posts = get_thread($topic_id, $page);
    $forum = bb_get_forum($topic->forum_id);
    $tags = bb_get_topic_tags($topic_id);
    if ($tags && ($bb_current_id = bb_get_current_user_info('id'))) {
        $user_tags = bb_get_user_tags($topic_id, $bb_current_id);
        $other_tags = bb_get_other_tags($topic_id, $bb_current_id);
        $public_tags = bb_get_public_tags($topic_id);
    } elseif (is_array($tags)) {
        $user_tags = false;
        $other_tags = bb_get_public_tags($topic_id);
        $public_tags =& $other_tags;
    } else {
        $user_tags = $other_tags = $public_tags = false;
    }
    $list_start = ($page - 1) * bb_get_option('page_topics') + 1;
    bb_post_author_cache($posts);
}
bb_load_template('topic.php', array('bb_db_override', 'user_tags', 'other_tags', 'list_start'), $topic_id);
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:topic.php

示例11: bb_insert_post

function bb_insert_post($args = null)
{
    global $bbdb, $bb_current_user;
    if (!($args = wp_parse_args($args))) {
        return false;
    }
    $fields = array_keys($args);
    if (isset($args['post_id']) && false !== $args['post_id']) {
        $update = true;
        if (!($post_id = (int) get_post_id($args['post_id']))) {
            return false;
        }
        // Get from db, not cache.  Good idea?
        $post = $bbdb->get_row($bbdb->prepare("SELECT * FROM {$bbdb->posts} WHERE post_id = %d", $post_id));
        $defaults = get_object_vars($post);
        unset($defaults['post_id']);
        // Only update the args we passed
        $fields = array_intersect($fields, array_keys($defaults));
        if (in_array('topic_id', $fields)) {
            $fields[] = 'forum_id';
        }
        // No need to run filters if these aren't changing
        // bb_new_post() and bb_update_post() will always run filters
        $run_filters = (bool) array_intersect(array('post_status', 'post_text'), $fields);
    } else {
        $post_id = false;
        $update = false;
        $now = bb_current_time('mysql');
        $current_user_id = bb_get_current_user_info('id');
        $ip_address = $_SERVER['REMOTE_ADDR'];
        $defaults = array('topic_id' => 0, 'post_text' => '', 'post_time' => $now, 'poster_id' => $current_user_id, 'poster_ip' => $ip_address, 'post_status' => 0, 'post_position' => false);
        // Insert all args
        $fields = array_keys($defaults);
        $fields[] = 'forum_id';
        $run_filters = true;
    }
    $defaults['throttle'] = true;
    extract(wp_parse_args($args, $defaults));
    if (!($topic = get_topic($topic_id))) {
        return false;
    }
    if (!($user = bb_get_user($poster_id))) {
        return false;
    }
    $topic_id = (int) $topic->topic_id;
    $forum_id = (int) $topic->forum_id;
    if ($run_filters && !($post_text = apply_filters('pre_post', $post_text, $post_id, $topic_id))) {
        return false;
    }
    if ($update) {
        // Don't change post_status with this function.  Use bb_delete_post().
        $post_status = $post->post_status;
    }
    if ($run_filters) {
        $post_status = (int) apply_filters('pre_post_status', $post_status, $post_id, $topic_id);
    }
    if (false === $post_position) {
        $post_position = $topic_posts = intval(0 == $post_status ? $topic->topic_posts + 1 : $topic->topic_posts);
    }
    unset($defaults['throttle']);
    if ($update) {
        $bbdb->update($bbdb->posts, compact($fields), compact('post_id'));
        wp_cache_delete($post_id, 'bb_post');
    } else {
        $bbdb->insert($bbdb->posts, compact($fields));
        $post_id = $topic_last_post_id = (int) $bbdb->insert_id;
        if (0 == $post_status) {
            $topic_time = $post_time;
            $topic_last_poster = $poster_id;
            $topic_last_poster_name = $user->user_login;
            $bbdb->query($bbdb->prepare("UPDATE {$bbdb->forums} SET posts = posts + 1 WHERE forum_id = %d;", $topic->forum_id));
            $bbdb->update($bbdb->topics, compact('topic_time', 'topic_last_poster', 'topic_last_poster_name', 'topic_last_post_id', 'topic_posts'), compact('topic_id'));
            $query = new BB_Query('post', array('post_author_id' => $poster_id, 'topic_id' => $topic_id, 'post_id' => "-{$post_id}"));
            if (!$query->results) {
                bb_update_usermeta($poster_id, $bbdb->prefix . 'topics_replied', $user->topics_replied + 1);
            }
        } else {
            bb_update_topicmeta($topic->topic_id, 'deleted_posts', isset($topic->deleted_posts) ? $topic->deleted_posts + 1 : 1);
        }
    }
    bb_update_topic_voices($topic_id);
    if ($throttle && !bb_current_user_can('throttle')) {
        bb_update_usermeta($poster_id, 'last_posted', time());
    }
    wp_cache_delete($topic_id, 'bb_topic');
    wp_cache_delete($topic_id, 'bb_thread');
    wp_cache_delete($forum_id, 'bb_forum');
    wp_cache_flush('bb_forums');
    wp_cache_flush('bb_query');
    wp_cache_flush('bb_cache_posts_post_ids');
    if ($update) {
        // fire actions after cache is flushed
        do_action('bb_update_post', $post_id);
    } else {
        do_action('bb_new_post', $post_id);
    }
    do_action('bb_insert_post', $post_id, $args, compact(array_keys($args)));
    // post_id, what was passed, what was used
    if (bb_get_option('enable_pingback')) {
        bb_update_postmeta($post_id, 'pingback_queued', '');
//.........这里部分代码省略.........
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:101,代码来源:functions.bb-posts.php

示例12: bb_uri

<div id="header">
    <h1><a href="<?php 
bb_uri();
?>
"><?php 
bb_option('name');
?>
</a></h1>
</div>

<div id="content">

<ul id="greeting">
<?php 
if (bb_is_user_logged_in()) {
    if ($user = bb_get_current_user_info()) {
        if ($avatar = bb_get_avatar($user->ID, '48')) {
            ?>
<li id="avatar"><?php 
            echo $avatar;
            ?>
</li>
<?php 
        }
        ?>
<li id="message"><?php 
        printf(__("Hello, %s!"), $user->display_name);
        ?>
</li>
<li id="logout"><?php 
        bb_logout_link();
开发者ID:hara,项目名称:bbtouch,代码行数:31,代码来源:front-page.php

示例13: bb_option

    ?>
;
		var uriBase = '<?php 
    bb_option('uri');
    ?>
';
		var tagLinkBase = '<?php 
    bb_tag_link_base();
    ?>
';
		var favoritesLink = '<?php 
    favorites_link();
    ?>
'; 
		var isFav = <?php 
    if (false === ($is_fav = is_user_favorite(bb_get_current_user_info('id')))) {
        echo "'no'";
    } else {
        echo $is_fav;
    }
    ?>
;
	</script>
	
	<?php 
    wp_enqueue_script('topic');
}
?>

	<?php 
bb_head();
开发者ID:billerby,项目名称:Surdeg,代码行数:31,代码来源:header.php

示例14: li_add_extra_profile_field

function li_add_extra_profile_field()
{
    global $li_attr;
    if (bb_is_user_logged_in() && $_SESSION['oauth']['linkedin']['authorized'] === TRUE) {
        $me = get_li_profile();
        if (!$me) {
            bb_die("Linkedin Connect failed");
            exit;
        }
        $li_id = trim($me->{$li_attr}['id']);
        if (!$li_id) {
            bb_die("LinkedIn Connect failed, no user id found.");
            exit;
        }
        $bb_current_id = bb_get_current_user_info('id');
        if (li_get_userid_by_linkedin_id($li_id) == $bb_current_id) {
            ?>
			<div style="margin:10px;padding:10px;background-color:#E6FFFF;">
			<div>Please update your email address above so you can receive forum comments and answers.  </div>
			<div>You can revoke your LinkedIn authorisation by clicking <a href="#" onclick="javascript: li_revoke_action(); return false;">Revoke</a></div>
			<div>You can log in with LinkedIn to re-authorise this account.</div>

			</div>
		<?php 
        }
    }
}
开发者ID:nma,项目名称:linkedin-connect,代码行数:27,代码来源:connect.php

示例15: nospamuser_maybe_set_user_ip_field

function nospamuser_maybe_set_user_ip_field()
{
    if (bb_is_user_logged_in() && !bb_get_usermeta(bb_get_current_user_info('ID'), 'nospamuser_ip')) {
        nospamuser_set_user_ip_field(bb_get_current_user_info('ID'));
    }
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:6,代码来源:bb-nospamuser.php


注:本文中的bb_get_current_user_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。