本文整理汇总了PHP中bb_get_user函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_get_user函数的具体用法?PHP bb_get_user怎么用?PHP bb_get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notification_is_activated
function notification_is_activated($user_id)
{
$user = bb_get_user($user_id);
if ($user->favorite_notification) {
return true;
} else {
return false;
}
}
示例2: mod_notification_is_activated
function mod_notification_is_activated($user_id)
{
$user = bb_get_user($user_id);
if (!empty($user->mod_notification)) {
return true;
} else {
return false;
}
}
示例3: icon
function icon($comment)
{
if (bb_get_option('avatars_show')) {
echo '<div class="gravatar">';
$user = bb_get_user($comment->poster_id);
if ($user->user_url) {
echo '<a href="' . $user->user_url . '">';
}
echo bb_get_avatar($user->user_email, 40);
if ($user->user_url) {
echo '</a>';
}
echo '</div>';
}
}
示例4: em_do_linking
/**
* Links the users & tags in posts
*
* @see bp_activity_at_name_filter() BuddyPress Function
*
* @param $content The content to be parsed
*/
function em_do_linking($content)
{
global $em_plugopts;
if ($em_plugopts['link-tags'] == 1) {
preg_match_all('/[#]+([A-Za-z0-9-_]+)/', $content, $tags);
$tags = $tags[1];
foreach ((array) $tags as $tag) {
if (!($t = bb_get_tag($tag))) {
continue;
}
if ($link = bb_get_tag_link($t)) {
$content = str_replace("#{$tag}", "#<a href='" . $link . "'>{$tag}</a>", $content);
}
//should we add rel='nofollow'?
}
}
if ($em_plugopts['link-users'] == 1) {
preg_match_all('/[@]+([A-Za-z0-9-_]+)/', $content, $usernames);
$usernames = $usernames[1];
foreach ((array) $usernames as $username) {
if (!($user = bb_get_user($username, array('by' => 'login')))) {
//check #1, by username
if (!($user = bb_get_user($username, array('by' => 'nicename')))) {
//check #2, by nicename
continue;
}
}
/* Increase the number of new @ mentions for the user - maybe later */
/*$new_mention_count = (int)bb_get_usermeta( $user_id, 'em_mention_count' );
bb_update_usermeta( $user_id, 'em_mention_count', $new_mention_count + 1 );*/
if ('website' == $em_plugopts['link-user-to']) {
if (!($link = $user->user_url)) {
$link = get_user_profile_link($user->ID);
}
} else {
$link = get_user_profile_link($user->ID);
}
if ($link) {
$content = str_replace("@{$username}", "@<a href='" . $link . "'>{$username}</a>", $content);
}
//should we add rel='nofollow'?
}
}
return $content;
}
示例5: add_twitter_to_profile_edit
function add_twitter_to_profile_edit()
{
global $user_id, $bb_current_user, $bb_twitter;
if (bb_current_user_can('edit_profile', $user->ID) && bb_is_user_logged_in()) {
$twitter = fetch_user_twitter($user_id);
$user = bb_get_user($user_id);
$tweets_on = $user->twitter_on;
$tweets_on_post = $user->twitter_on_post;
?>
<fieldset>
<legend><?php
_e('Twitter');
?>
</legend>
<table border=0>
<tr>
<th>Twitter username : </th><td><input type="text" name="twitter" value="<?php
echo $twitter;
?>
" size="25"/></td>
</tr>
<?php
if (false) {
?>
<tr>
<td>Show your latest <em>tweet</em> in your profile?</td><td>
<input name="show_tweets" value="tweets_on" type="checkbox" checked="checked"/></td>
<input name="show_tweets" value="tweets_on" type="checkbox"/></td>
</tr>
<tr>
<td>Show your latest <em>tweet</em> under each post?</td><td>
<input name="show_tweets_post" value="tweets_on_post" type="checkbox" checked="checked"/></td>
<input name="show_tweets_post" value="tweets_on_post" type="checkbox"/></td>
<?php
}
?>
</tr>
</table>
</fieldset>
<?php
}
}
示例6: thanks_output_details
function thanks_output_details($post_id, $uid, $logged_in = true)
{
$out = "";
$meta = bb_get_post_meta("thanks", $post_id);
$report_length = 0;
if (isset($meta)) {
$vote_count = count($meta);
$msg_type = $vote_count == 0 ? "none" : ($vote_count == 1 ? "one" : "many");
$msg = thanks_get_voting_phrase("thanks_output_" . $msg_type);
$report_length = strlen($msg);
$out .= str_replace("#", "" . $vote_count, $msg);
$should_show_voters = thanks_get_voting_phrase("thanks_voters");
if ($should_show_voters == "yes") {
$out .= ' ' . thanks_get_voting_phrase("thanks_voters_prefix");
for ($i = 0; $i < count($meta); $i++) {
$link = get_user_profile_link($meta[$i]);
$voter = bb_get_user($meta[$i]);
if ($i > 0) {
$out .= ", ";
}
$out .= '<a href="' . $link . '">' . $voter->display_name . '</a>';
}
$out .= thanks_get_voting_phrase("thanks_voters_suffix");
}
}
if ($logged_in) {
if (!in_array($uid, $meta)) {
if (isset($meta) && $report_length > 0) {
$out .= " | ";
}
$msg = thanks_get_voting_phrase("thanks_voting");
$out .= "<a class=\"thanks-vote\" user=\"" . $uid . "\" id=\"" . $post_id . "\">" . $msg . "</a>";
}
}
return $out;
}
示例7: auto_add_favorit_profile
function auto_add_favorit_profile()
{
global $user_id;
if (bb_is_user_logged_in()) {
$checked = "";
$user = bb_get_user($user_id);
if (!empty($user->auto_add_favorit)) {
$checked = ' checked="checked"';
}
echo '
<fieldset>
<legend>Add my threads automatically to my favorites</legend>
<p>Check this option to add all your threads or threads where you have posted something to your favorite list.</p>
<table width="100%">
<tr>
<th width="21%" scope="row">Activate:</th>
<td width="79%">
<input name="edit_auto_add_favorit" id="edit_auto_add_favorit" type="checkbox" value="1"' . $checked . ' />
</td>
</tr>
</table>
</fieldset>';
}
}
示例8: bb_export_user
function bb_export_user($user_id)
{
global $bbdb;
if (!($_user = bb_get_user($user_id))) {
return;
}
$_user = get_object_vars($_user);
$atts = array('type' => 'user', 'id' => $_user['ID']);
// ?url means url is optional. Only include it in the export if it exists
// !title means the title should be wrapped in CDATA
// ?! is the correct order, not !?
$translate = array('user_login' => 'login', 'user_pass' => 'pass', 'user_email' => 'email', 'user_url' => '?url', 'user_registered' => 'incept', 'display_name' => '?!title', 'user_nicename' => '?nicename', 'user_status' => '?status', 'ID' => false);
$user = _bb_translate_for_export($translate, $_user);
$meta = array();
foreach ($_user as $k => $v) {
if (0 !== strpos($k, $bbdb->prefix) && isset($_user[$bbdb->prefix . $k])) {
continue;
}
$meta[$k] = maybe_serialize($v);
}
unset($_user, $k, $v);
$user['meta'] = $meta;
return _bb_export_object($atts, $user);
}
示例9: get_user
function get_user($user_id, $use_cache = true)
{
bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_user');
return bb_get_user($user_id);
}
示例10: get_favorites_rss_link
function get_favorites_rss_link($id = 0, $context = 0)
{
$user = bb_get_user(bb_get_user_id($id));
if (!$context || !is_integer($context)) {
$context = BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_FEED;
}
$rewrite = bb_get_option('mod_rewrite');
if ($rewrite) {
if ($rewrite === 'slugs') {
$column = 'user_nicename';
} else {
$column = 'ID';
}
$link = bb_get_uri('rss/profile/' . $user->{$column}, null, $context);
} else {
$link = bb_get_uri('rss.php', array('profile' => $user->ID), $context);
}
return apply_filters('get_favorites_rss_link', $link, $user->ID, $context);
}
示例11: bb_get_post
$bb_post = bb_get_post($post_id);
if (!$bb_post) {
nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
die;
}
if (!bb_current_user_can('edit_post', $post_id)) {
bb_die(__('Sorry, post is too old.'));
}
bb_check_admin_referer('edit-post_' . $post_id);
if (0 != $bb_post->post_status && 'all' == $_GET['view']) {
// We're trying to edit a deleted post
add_filter('bb_is_first_where', 'bb_no_where');
}
// Check possible anonymous user data
$post_author = $post_email = $post_url = '';
if (!bb_get_user(get_post_author_id($post_id))) {
if (!($post_author = sanitize_user(trim($_POST['author'])))) {
bb_die(__('Every post needs an author name!'));
} elseif (!($post_email = sanitize_email(trim($_POST['email'])))) {
bb_die(__('Every post needs a valid email address!'));
}
if (!empty($_POST['url'])) {
$post_url = esc_url(trim($_POST['url']));
}
}
// Loop through possible anonymous post data
foreach (array('post_author', 'post_email', 'post_url') as $field) {
if (!empty(${$field})) {
$post_data[$field] = ${$field};
}
}
示例12: esc_html
case 'topic':
if (!($topic = get_topic($feed_id))) {
die;
}
if (!($posts = get_thread($feed_id, 0, 1))) {
die;
}
$title = esc_html(sprintf(__('%1$s » Topic: %2$s'), bb_get_option('name'), get_topic_title()));
$link = get_topic_link($feed_id);
$link_self = get_topic_rss_link($feed_id);
break;
case 'profile':
if (bb_get_option('mod_rewrite') === 'slugs') {
$user = bb_get_user_by_nicename($feed_id);
} else {
$user = bb_get_user($feed_id);
}
if (!$user) {
die;
}
if (!($posts = get_user_favorites($user->ID))) {
die;
}
$title = esc_html(sprintf(__('%1$s » User Favorites: %2$s'), bb_get_option('name'), $user->user_login));
$link = bb_get_profile_link($feed_id);
$link_self = get_favorites_rss_link($feed_id);
break;
case 'tag-topics':
if (!($tag = bb_get_tag($feed_id))) {
die;
}
示例13: blocklist_check
function blocklist_check($post_id = 0, $wall = false)
{
if (bb_current_user_can('moderate') || bb_current_user_can('throttle')) {
return;
}
if ($wall) {
$bb_post = user_wall_get_post($post_id);
} else {
$bb_post = bb_get_post($post_id);
}
if (empty($post_id) || empty($bb_post) || !empty($bb_post->post_status)) {
return;
}
global $blocklist, $bbdb;
blocklist_initialize();
if (empty($blocklist['data'])) {
return;
}
(array) ($data = explode("\r\n", $blocklist['data']));
$user = bb_get_user($bb_post->poster_id);
foreach ($data as $item) {
if (empty($item) || strlen($item) < 4 || ord($item) == 35) {
continue;
}
if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $item)) {
// is IP
if (strpos($bb_post->poster_ip, $item) === 0) {
$found = "IP address";
$bad = $item;
break;
}
} else {
// is word
$qitem = preg_quote($item);
if (preg_match('/\\b' . $qitem . '/simU', $user->user_email)) {
$found = "email";
$bad = $item;
break;
}
if (preg_match('/\\b' . $qitem . '/simU', $user->user_login)) {
$found = "username";
$bad = $item;
break;
}
if (preg_match('/\\b' . $qitem . '/simU', $bb_post->post_text)) {
$found = "post text";
$bad = $item;
break;
} elseif (!$wall && $bb_post->post_position == 1) {
if (empty($topic)) {
$topic = get_topic($bb_post->topic_id);
}
if (!empty($topic->topic_title) && preg_match('/\\b' . $qitem . '/simU', $topic->topic_title)) {
$found = "topic title";
$bad = $item;
break;
}
}
}
if (!empty($bad)) {
break;
}
}
if (!empty($bad)) {
if ($wall) {
user_wall_delete_post($post_id, 2);
$uri = bb_get_option('uri') . "bb-admin/admin-base.php?post_status=2&plugin=user_wall_admin&user-wall-recent=1";
} else {
bb_delete_post($post_id, 2);
if (empty($topic)) {
$topic = get_topic($bb_post->topic_id);
}
if (empty($topic->topic_posts)) {
bb_delete_topic($topic->topic_id, 2);
}
// if no posts in topic, also set topic to spam
$uri = bb_get_option('uri') . 'bb-admin/' . (defined('BACKPRESS_PATH') ? '' : 'content-') . 'posts.php?post_status=2';
}
if (empty($blocklist['email'])) {
return;
}
(array) ($email = explode("\r\n", $blocklist['email']));
$message = "The blocklist has been triggered... \r\n\r\n";
$message .= "Matching entry " . '"' . $bad . '"' . " found in {$found}.\r\n";
$message .= "{$uri}\r\n\r\n";
$message .= sprintf(__('Username: %s'), stripslashes($user->user_login)) . "\r\n";
$message .= sprintf(__('Profile: %s'), get_user_profile_link($user->ID)) . "\r\n";
$message .= sprintf(__('Email: %s'), stripslashes($user->user_email)) . "\r\n";
$message .= sprintf(__('IP address: %s'), $_SERVER['REMOTE_ADDR']) . "\r\n";
$message .= sprintf(__('Agent: %s'), substr(stripslashes($_SERVER["HTTP_USER_AGENT"]), 0, 255)) . "\r\n\r\n";
foreach ($email as $to) {
if (empty($to) || strlen($to) < 8) {
continue;
}
@bb_mail($to, "[" . bb_get_option('name') . "] blocklist triggered", $message);
}
}
}
示例14: bb_get_user
<?php
require_once 'admin.php';
$edit_user = bb_get_user(bb_get_user_id($_GET['user_id']));
$user_fields = bb_manage_user_fields($edit_user);
// Let it rip!
// Header
$bb_admin_body_class = 'bb-admin-user-manage';
bb_get_admin_header();
?>
<div class="wrap">
<h2><?php
_e('Add a new user');
?>
</h2>
<?php
do_action('bb_admin_notices');
?>
<form class="settings" method="post" action="">
<fieldset>
<?php
foreach ($user_fields as $field => $args) {
bb_option_form_element($field, $args);
}
?>
<noscript>
<?php
_e('Disabled (requires JavaScript)');
示例15: bb_repermalink
function bb_repermalink()
{
global $page;
$location = bb_get_location();
$uri = $_SERVER['REQUEST_URI'];
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = bb_get_path();
}
$_original_id = $id;
do_action('pre_permalink', $id);
$id = apply_filters('bb_repermalink', $id);
switch ($location) {
case 'front-page':
$path = null;
$querystring = null;
if ($page > 1) {
if (bb_get_option('mod_rewrite')) {
$path = 'page/' . $page;
} else {
$querystring = array('page' => $page);
}
}
$permalink = bb_get_uri($path, $querystring, BB_URI_CONTEXT_HEADER);
$issue_404 = true;
break;
case 'forum-page':
if (empty($id)) {
$permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
break;
}
global $forum_id, $forum;
$forum = bb_get_forum($id);
$forum_id = $forum->forum_id;
$permalink = get_forum_link($forum->forum_id, $page);
break;
case 'topic-edit-page':
case 'topic-page':
if (empty($id)) {
$permalink = bb_get_uri(null, null, BB_URI_CONTEXT_HEADER);
break;
}
global $topic_id, $topic;
$topic = get_topic($id);
$topic_id = $topic->topic_id;
$permalink = get_topic_link($topic->topic_id, $page);
break;
case 'profile-page':
// This handles the admin side of the profile as well.
global $user_id, $user, $profile_hooks, $self;
if (isset($_GET['id'])) {
$id = $_GET['id'];
} elseif (isset($_GET['username'])) {
$id = $_GET['username'];
} else {
$id = bb_get_path();
}
$_original_id = $id;
if (!$id) {
$user = bb_get_current_user();
// Attempt to go to the current users profile
} else {
if (bb_get_option('mod_rewrite') === 'slugs') {
if (!($user = bb_get_user_by_nicename($id))) {
$user = bb_get_user($id);
}
} else {
if (!($user = bb_get_user($id))) {
$user = bb_get_user_by_nicename($id);
}
}
}
if (!$user || 1 == $user->user_status && !bb_current_user_can('moderate')) {
bb_die(__('User not found.'), '', 404);
}
$user_id = $user->ID;
bb_global_profile_menu_structure();
$valid = false;
if ($tab = isset($_GET['tab']) ? $_GET['tab'] : bb_get_path(2)) {
foreach ($profile_hooks as $valid_tab => $valid_file) {
if ($tab == $valid_tab) {
$valid = true;
$self = $valid_file;
}
}
}
if ($valid) {
$permalink = get_profile_tab_link($user->ID, $tab, $page);
} else {
$permalink = get_user_profile_link($user->ID, $page);
unset($self, $tab);
}
break;
case 'favorites-page':
$permalink = get_favorites_link();
break;
case 'tag-page':
// It's not an integer and tags.php pulls double duty.
$id = isset($_GET['tag']) ? $_GET['tag'] : false;
//.........这里部分代码省略.........