本文整理汇总了PHP中bb_get_user函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_get_user函数的具体用法?PHP bb_get_user怎么用?PHP bb_get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_get_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:9,代码来源:notification.php
示例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;
}
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:9,代码来源:moderator_notification.php
示例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>';
}
}
开发者ID:billerby,项目名称:Surdeg,代码行数:15,代码来源:functions.php
示例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;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:52,代码来源:public.php
示例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
}
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:42,代码来源:bb-twitter.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;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:36,代码来源:thanks-output.php
示例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>';
}
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:24,代码来源:auto_add_favorites.php
示例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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:24,代码来源:export.php
示例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);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:5,代码来源:functions.bb-deprecated.php
示例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);
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:19,代码来源:functions.bb-template.php
示例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};
}
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:bb-edit.php
示例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;
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:31,代码来源:rss.php
示例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);
}
}
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:98,代码来源:blocklist.php
示例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)');
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:user-add-new.php
示例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;
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass,代码行数:101,代码来源:functions.bb-core.php
示例16: generate_post_sql
function generate_post_sql($_part_of_topic_query = false)
{
global $bbdb;
$q =& $this->query_vars;
$distinct = '';
$sql_calc_found_rows = 'found_rows' === $q['count'] ? 'SQL_CALC_FOUND_ROWS' : '';
// unfiltered
$fields = 'p.*';
$index_hint = '';
$join = '';
$where = '';
$group_by = '';
$having = '';
$order_by = '';
$topic_where = '';
$topic_queries = array('topic_author_id', 'topic_author', 'topic_status', 'post_count', 'tag_count', 'started', 'updated', 'open', 'sticky', 'meta_key', 'meta_value', 'topic_title');
if (!$_part_of_topic_query && array_diff($topic_queries, $this->not_set)) {
$join .= " JOIN {$bbdb->topics} as t ON ( t.topic_id = p.topic_id )";
$topic_where = $this->generate_topic_sql(true);
}
if (!$_part_of_topic_query) {
if ($q['post_id']) {
$where .= $this->parse_value('p.post_id', $q['post_id']);
}
if ($q['topic_id']) {
$where .= $this->parse_value('p.topic_id', $q['topic_id']);
} elseif ($q['topic']) {
if (!($q['topic_id'] = bb_get_id_from_slug('topic', $q['topic']))) {
$this->error('query_var:topic', 'No topic by that name');
}
$where .= " AND p.topic_id = " . $q['topic_id'];
}
if ($q['forum_id']) {
$where .= $this->parse_value('p.forum_id', $q['forum_id']);
} elseif ($q['forum']) {
if (!($q['forum_id'] = bb_get_id_from_slug('forum', $q['forum']))) {
$this->error('query_var:forum', 'No forum by that name');
}
$where .= " AND p.forum_id = " . $q['forum_id'];
}
if ($q['tag'] && !is_int($q['tag_id'])) {
$q['tag_id'] = (int) bb_get_tag_id($q['tag']);
}
if (is_numeric($q['tag_id'])) {
$join .= " JOIN `{$bbdb->term_relationships}` AS tr ON ( p.`topic_id` = tr.`object_id` AND tr.`term_taxonomy_id` = {$q['tag_id']} )";
}
if (is_numeric($q['favorites']) && ($f_user = bb_get_user($q['favorites']))) {
$where .= $this->parse_value('p.topic_id', $f_user->favorites);
}
}
// !_part_of_topic_query
if ($q['post_text']) {
$where .= ' AND ' . $this->generate_post_text_sql($q['post_text']);
if ($this->match_query) {
$fields .= ", {$this->match_query} AS search_score";
if (!$q['order_by']) {
$q['order_by'] = 'search_score';
}
} else {
$fields .= ', 0 AS search_score';
}
}
if ($q['posted']) {
$where .= $this->date('p.post_time', $q['posted']);
}
if ($q['post_author_id']) {
$where .= $this->parse_value('p.poster_id', $q['post_author_id']);
} elseif ($q['post_author']) {
$user = bb_get_user($q['post_author'], array('by' => 'login'));
if (!($q['post_author_id'] = (int) $user->ID)) {
$this->error('query_var:user', 'No user by that name');
}
$where .= " AND p.poster_id = {$q['post_author_id']}";
}
if (!$q['post_status']) {
$where .= " AND p.post_status = '0'";
} elseif (false === strpos($q['post_status'], 'all')) {
$stati = array('normal' => 0, 'deleted' => 1);
$q['post_status'] = str_replace(array_keys($stati), array_values($stati), $q['post_status']);
$where .= $this->parse_value('p.post_status', $q['post_status']);
}
if (false !== $q['position']) {
$where .= $this->parse_value('p.post_position', $q['position']);
}
if (false !== $q['poster_ip']) {
$where .= " AND poster_ip = '" . $q['poster_ip'] . "'";
}
// Just getting post part for inclusion in topic query
if ($_part_of_topic_query) {
return $where;
}
$where .= $topic_where;
if ($where) {
// Get rid of initial " AND " (this is pre-filters)
$where = substr($where, 5);
}
if ($q['index_hint']) {
$index_hint = $q['index_hint'];
}
if ($q['order_by']) {
//.........这里部分代码省略.........
开发者ID:danielcoats,项目名称:schoolpress,代码行数:101,代码来源:class.bb-query.php
示例17: process_form_finalise_installation
//.........这里部分代码省略.........
$installation_log[] = '>>> ' . __('User database character set:') . ' ' . $data2['user_bbdb_charset']['value'];
}
if (!empty($data2['user_bbdb_collate']['value'])) {
bb_update_option('user_bbdb_collate', $data2['user_bbdb_collate']['value']);
$installation_log[] = '>>> ' . __('User database collation:') . ' ' . $data2['user_bbdb_collate']['value'];
}
if (!empty($data2['custom_user_table']['value'])) {
bb_update_option('custom_user_table', $data2['custom_user_table']['value']);
$installation_log[] = '>>> ' . __('User database "user" table:') . ' ' . $data2['custom_user_table']['value'];
}
if (!empty($data2['custom_user_meta_table']['value'])) {
bb_update_option('custom_user_meta_table', $data2['custom_user_meta_table']['value']);
$installation_log[] = '>>> ' . __('User database "user meta" table:') . ' ' . $data2['custom_user_meta_table']['value'];
}
}
}
} else {
$installation_log[] = '>>> ' . __('Integration not enabled');
}
// Site settings passed from step 3
// These are already validated provided that the referer checks out
$installation_log[] = "\n" . __('Step 3 - Site settings');
bb_update_option('name', $data3['name']['value']);
$installation_log[] = '>>> ' . __('Site name:') . ' ' . $data3['name']['value'];
bb_update_option('uri', $data3['uri']['value']);
$installation_log[] = '>>> ' . __('Site address (URL):') . ' ' . $data3['uri']['value'];
bb_update_option('from_email', $data3['keymaster_user_email']['value']);
$installation_log[] = '>>> ' . __('From email address:') . ' ' . $data3['keymaster_user_email']['value'];
// Create the key master
$keymaster_created = false;
switch ($data3['keymaster_user_type']['value']) {
case 'new':
// Check to see if the user login already exists
if ($keymaster_user = bb_get_user($data3['keymaster_user_login']['value'], array('by' => 'login'))) {
// The keymaster is an existing bbPress user
$installation_log[] = '>>> ' . __('Key master could not be created!');
$installation_log[] = '>>>>>> ' . __('That login is already taken!');
$error_log[] = __('Key master could not be created!');
if ($keymaster_user->bb_capabilities['keymaster']) {
// The existing user is a key master - continue
$bb_current_user = bb_set_current_user($keymaster_user->ID);
$installation_log[] = '>>>>>> ' . __('Existing key master entered!');
$data4['keymaster_user_password']['value'] = __('Your bbPress password');
$data3['keymaster_user_email']['value'] = $keymaster_user->user_email;
bb_update_option('from_email', $keymaster_user->user_email);
$installation_log[] = '>>>>>> ' . __('Re-setting admin email address.');
$keymaster_created = true;
} else {
// The existing user is a non-key master user - halt installation
$installation_log[] = '>>>>>> ' . __('Existing user without key master role entered!');
$installation_log[] = '>>>>>>>>> ' . __('Halting installation!');
$this->step_status[4] = 'incomplete';
$this->strings[4]['h2'] = __('Installation failed!');
$this->strings[4]['messages']['error'][] = __('The key master could not be created. An existing user was found with that user login.');
$data4['installation_log']['value'] = join("\n", $installation_log);
$data4['error_log']['value'] = join("\n", $error_log);
return 'incomplete';
}
break;
}
// Helper function to let us know the password that was created
global $keymaster_password;
function bb_get_keymaster_password($user_id, $pass)
{
global $keymaster_password;
$keymaster_password = $pass;
开发者ID:laiello,项目名称:cartonbank,代码行数:67,代码来源:class.bb-install.php
示例18: bb_remove_user_favorite
function bb_remove_user_favorite($user_id, $topic_id)
{
global $bbdb;
$user_id = (int) $user_id;
$topic_id = (int) $topic_id;
$user = bb_get_user($user_id);
if (!$user) {
return false;
}
$favorites_key = $bbdb->prefix . 'favorites';
$fav = explode(',', $user->{$favorites_key});
if (is_int($pos = array_search($topic_id, $fav))) {
array_splice($fav, $pos, 1);
$fav = implode(',', $fav);
bb_update_usermeta($user->ID, $favorites_key, $fav);
}
do_action('bb_remove_user_favorite', $user_id, $topic_id);
return true;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:19,代码来源:functions.bb-users.php
示例19: sprintf
}
if (!($posts = get_thread($feed_id, 0, 1))) {
die;
}
/* Should die here, as the topic posts aren't there, so the topic is most probably deleted/empty */
$title = 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') {
if (!($user = bb_get_user_by_nicename($feed_id))) {
$user = bb_get_user($feed_id);
}
} else {
if (!($user = bb_get_user($feed_id))) {
$user = bb_get_user_by_nicename($feed_id);
}
}
if (!$user) {
die;
}
$posts = get_user_favorites($user->ID);
$title = sprintf(__('%1$s » User Favorites: %2$s'), bb_get_option('name'), $user->user_nicename);
$link = get_user_profile_link($feed_id);
$link_self = get_favorites_rss_link($feed_id);
break;
case 'tag-topics':
if (!($tag = bb_get_tag($feed_id))) {
die;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:rss.php
示例20: WP_Error
exit;
} else {
$bb_login_error =& $user;
}
// No login so prepare the error
} else {
$bb_login_error = new WP_Error();
}
/** Handle errors *************************************************************/
// Get error data so we can provide feedback
$error_data = $bb_login_error->get_error_data();
// Does user actually exist
if (isset($error_data['unique']) && false === $error_data['unique']) {
$user_exists = true;
} else {
$user_exists = !empty($_POST['log']) && (bool) bb_get_user($_POST['log'], array('by' => 'login'));
}
// Check for errors on post method
if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) {
// If the user doesn't exist then add that error
if (empty($user_exists)) {
if (!empty($_POST['log'])) {
$bb_login_error->add('user_login', __('User does not exist.'));
} else {
$bb_login_error->add('user_login', $email_login ? __('Enter a username or email address.') : __('Enter a username.'));
}
}
// If the password was wrong then add that error
if (!$bb_login_error->get_error_code()) {
$bb_login_error->add('password', __('Incorrect password.'));
}
开发者ID:hscale,项目名称:webento,代码行数:31,代码来源:bb-login.php
注:本文中的bb_get_user函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论