本文整理汇总了PHP中bb_get_forum函数的典型用法代码示例。如果您正苦于以下问题:PHP bb_get_forum函数的具体用法?PHP bb_get_forum怎么用?PHP bb_get_forum使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bb_get_forum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
//.........这里部分代码省略.........
示例2: bp_forums_get_forum
/**
* Get a forum by ID.
*
* Wrapper for {@link bb_get_forum()}.
*
* @param int $forum_id ID of the forum being fetched.
* @return object bbPress forum object.
*/
function bp_forums_get_forum($forum_id)
{
/** This action is documented in bp-forums/bp-forums-screens */
do_action('bbpress_init');
return bb_get_forum($forum_id);
}
示例3: bb_getHotTopicTags
/**
* Returns the hot tags in order of hotness in a given forum or all hot tags
*
* @since 1.0
* @return integer|object The tag data when successfully executed or an IXR_Error object on failure
* @param array $args Arguments passed by the XML-RPC call
* @param string $args[0] The username for authentication
* @param string $args[1] The password for authentication
* @param integer $args[2] The number of tags to return (optional)
* @param integer|string $args[3] The forum id or slug (optional)
*
* XML-RPC request to get the 20 hottest tags in the forum with slug "hawtness"
* <methodCall>
* <methodName>bb.getTopicTags</methodName>
* <params>
* <param><value><string>joeblow</string></value></param>
* <param><value><string>123password</string></value></param>
* <param><value><int>20</int></value></param>
* <param><value><string>hawtness</string></value></param>
* </params>
* </methodCall>
*/
function bb_getHotTopicTags($args)
{
do_action('bb_xmlrpc_call', 'bb.getHotTopicTags');
// Escape args
$this->escape($args);
// Get the login credentials
$username = $args[0];
$password = (string) $args[1];
// Check the user is valid
if ($this->auth_readonly) {
$user = $this->authenticate($username, $password);
}
do_action('bb_xmlrpc_call_authenticated', 'bb.getHotTopicTags');
// If an error was raised by authentication or by an action then return it
if ($this->error) {
return $this->error;
}
// Must be a number
$per_page = isset($args[2]) ? (int) $args[2] : false;
// Can be numeric id or slug
$forum_id = isset($args[3]) ? $args[3] : false;
if ($forum_id) {
// Check for bad data
if (!is_string($forum_id) && !is_integer($forum_id)) {
$this->error = new IXR_Error(400, __('The forum id is invalid.'));
return $this->error;
}
// Check the requested forum exists
if (!($forum = bb_get_forum($forum_id))) {
$this->error = new IXR_Error(404, __('No forum found.'));
return $this->error;
}
global $bbdb;
$topic_ids = $bbdb->get_col($bbdb->prepare("SELECT topic_id FROM `" . $bbdb->topics . "` WHERE `topic_status` = 0 AND `topic_open` = 1 AND `tag_count` > 0 AND `forum_id` = %s;", $forum_id));
if (!count($topic_ids)) {
$this->error = new IXR_Error(400, __('No topics found.'));
return $this->error;
}
global $nxt_taxonomy_object;
$tags = $nxt_taxonomy_object->get_object_terms($topic_ids, 'bb_topic_tag', array('fields' => 'all_with_object_id', 'orderby' => 'count', 'order' => 'DESC'));
if (!$tags || is_nxt_error($tags)) {
$this->error = new IXR_Error(500, __('Could not retrieve hot topic tags.'));
return $this->error;
}
if (!count($tags)) {
$this->error = new IXR_Error(500, __('No hot topic tags found.'));
return $this->error;
}
global $bb_log;
$bb_log->debug($tags);
for ($i = 0; isset($tags[$i]); $i++) {
_bb_make_tag_compat($tags[$i]);
}
$bb_log->debug($tags);
// Only include "safe" data in the array
$_tags = array();
foreach ($tags as $tag) {
$_tag = $this->prepare_topic_tag($tag);
if (!in_array($_tag, $_tags)) {
$_tags[] = $_tag;
}
}
if ($per_page) {
$_tags = array_slice($_tags, 0, $per_page);
}
} else {
if (!($tags = bb_get_top_tags(array('get' => 'all', 'number' => $per_page)))) {
$this->error = new IXR_Error(500, __('No hot topic tags found.'));
return $this->error;
}
// Only include "safe" data in the array
$_tags = array();
foreach ($tags as $tag) {
$_tags[] = $this->prepare_topic_tag($tag);
}
}
do_action('bb_xmlrpc_call', 'bb.getHotTopicTags');
return $_tags;
//.........这里部分代码省略.........
示例4: bb_get_new_topic_link
/**
* bb_get_new_topic_link() - Get the link to the form for a new topic
*
* @since 1.0
* @param mixed The arguments for this function.
* @return string The link to the new topic form
*/
function bb_get_new_topic_link($args = null)
{
$defaults = array('text' => __('Add New »'), 'forum' => 0, 'tag' => '');
if ($args && is_string($args) && false === strpos($args, '=')) {
$args = array('text' => $args);
}
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
if ($forum && ($forum = bb_get_forum($forum))) {
$url = get_forum_link($forum->forum_id) . '#postform';
} elseif ($tag && ($tag = bb_get_tag($tag))) {
$url = bb_get_tag_link($tag->tag) . '#postform';
} elseif (bb_is_forum()) {
global $forum;
$url = get_forum_link($forum->forum_id) . '#postform';
} elseif (bb_is_tag()) {
global $tag;
$url = bb_get_tag_link($tag) . '#postform';
} elseif (bb_is_topic()) {
$url = get_forum_link() . '#postform';
} elseif (bb_is_front()) {
$url = bb_get_uri(null, array('new' => 1));
}
if (!bb_is_user_logged_in()) {
$url = bb_get_uri('bb-login.php', array('re' => $url), BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_USER_FORMS);
} elseif (bb_is_forum() || bb_is_topic()) {
if (!bb_current_user_can('write_topic', get_forum_id())) {
return;
}
} else {
if (!bb_current_user_can('write_topics')) {
return;
}
}
if ($url = esc_attr(apply_filters('new_topic_url', $url, $args))) {
return '<a href="' . $url . '" class="new-topic">' . $text . '</a>' . "\n";
}
}
示例5: get_forum
function get_forum($forum_id)
{
bb_log_deprecated('class::function', __CLASS__ . '::' . __FUNCTION__, 'bb_get_forum');
return bb_get_forum($forum_id);
}
示例6: bb_get_forum
<?php
$forum_options=gf_forum_prepare_fields(gf_get_current_forum_id());
$deleted_forum = bb_get_forum( gf_get_current_forum_id() );
?>
<form class="delete-forum standard-form" method="post" id="delete-forums" action="">
<fieldset>
<legend><?php _e('Delete Forum','gf'); ?></legend>
<p><?php _e('This forum contains:','gf'); ?></p>
<ul>
<li><?php printf(__('%d topic','gf'), $deleted_forum->topics); ?></li>
<li><?php printf(__('%d post','gf'), $deleted_forum->posts); ?></li>
</ul>
<div id="option-forum-delete-contents">
<div class="label"><?php _e( 'Action','gf' ); ?></div>
<div class="inputs">
<label class="radios">
<input type="radio" name="move_topics" id="move-topics-delete" value="delete" /> <?php _e('Delete all topics and posts in this forum. <em>This can never be undone.</em>','gf'); ?>
</label>
<label class="radios">
<input type="radio" name="move_topics" id="move-topics-move" value="move" checked="checked" /> <?php _e('Move topics from this forum into the replacement forum below.','gf'); ?>
</label>
</div>
</div>
<div id="option-forum-delete-contents">
<label for="move-topics-forum"><?php _e( 'Replacement forum','gf' ); ?></label>
<div class="inputs">
<?php echo gf_get_forum_dropdown( array('id' => 'move_topics_forum', 'callback' => 'strcmp', 'callback_args' => array($deleted_forum->forum_id), 'selected' => $deleted_forum->forum_parent) ); ?>
</div>
</div>
</fieldset>
示例7: isset
// Tag recent topics
$feed = 'tag-topics';
} else {
// Tag recent posts
$feed = 'tag-posts';
}
$feed_id = isset($_GET['tag']) ? $_GET['tag'] : bb_get_path(2);
} elseif (isset($_GET['forum']) || bb_get_path() == 'forum') {
if (isset($_GET['topics']) || bb_get_path(3) == 'topics') {
// Forum recent topics
$feed = 'forum-topics';
} else {
// Forum recent posts
$feed = 'forum-posts';
}
$forum = bb_get_forum(isset($_GET['forum']) ? $_GET['forum'] : bb_get_path(2));
$feed_id = $forum->forum_id;
} elseif (isset($_GET['topics']) || bb_get_path() == 'topics') {
// Recent topics
$feed = 'all-topics';
} else {
// Recent posts
$feed = 'all-posts';
}
// Initialise the override variable
$bb_db_override = false;
do_action('bb_rss.php_pre_db');
if (!$bb_db_override) {
// Get the posts and the title for the given feed
switch ($feed) {
case 'view':
示例8: absint
<?php
require_once 'admin-action.php';
$topic_id = absint($_POST['topic_id']);
$forum_id = absint($_POST['forum_id']);
if (!is_numeric($topic_id) || !is_numeric($forum_id)) {
bb_die(__('Invalid topic or forum.'));
}
if (!bb_current_user_can('move_topic', $topic_id, $forum_id)) {
nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
exit;
}
bb_check_admin_referer('move-topic_' . $topic_id);
$topic = get_topic($topic_id);
$forum = bb_get_forum($forum_id);
if (!$topic || !$forum) {
bb_die(__('Your topic or forum caused all manner of confusion'));
}
bb_move_topic($topic_id, $forum_id);
if (!($redirect = nxt_get_referer())) {
$redirect = get_topic_link($topic_id);
}
bb_safe_redirect($redirect);
exit;
示例9: bp_forums_get_forum
/** Forum Functions ***********************************************************/
function bp_forums_get_forum($forum_id)
{
do_action('bbpress_init');
return bb_get_forum($forum_id);
}
示例10: bb_export_forum
function bb_export_forum($forum_id)
{
if (!($_forum = bb_get_forum($forum_id))) {
return;
}
$_forum = get_object_vars($_forum);
$translate = array('forum_name' => '!title', 'forum_desc' => '?!content', 'forum_parent' => '?parent');
$forum = _bb_translate_for_export($translate, $_forum);
return _bb_export_object(array('type' => 'forum', 'id' => $_forum['forum_id']), $forum);
}
示例11: bb_get_forums
<?php
require_once 'admin.php';
$forums = bb_get_forums();
$forums_count = $forums ? count($forums) : 0;
if (isset($_GET['action']) && 'delete' == $_GET['action']) {
$forum_to_delete = (int) $_GET['id'];
$deleted_forum = bb_get_forum($forum_to_delete);
if (!$deleted_forum || $forums_count < 2 || !bb_current_user_can('delete_forum', $forum_to_delete)) {
bb_safe_redirect(add_query_arg(array('action' => false, 'id' => false)));
exit;
}
}
if (isset($_GET['message'])) {
switch ($_GET['message']) {
case 'updated':
bb_admin_notice(__('<strong>Forum Updated.</strong>'));
break;
case 'deleted':
bb_admin_notice(sprintf(__('<strong>Forum deleted.</strong> You should <a href="%s">recount your site information</a>.'), bb_get_uri('bb-admin/tools-recount.php', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN)));
break;
}
}
if (!isset($_GET['action'])) {
nxt_enqueue_script('admin-forums');
} elseif ('delete' == @$_GET['action']) {
bb_admin_notice(sprintf(__('Are you sure you want to delete the "<strong>%s</strong>" forum?'), $deleted_forum->forum_name));
}
$bb_admin_body_class = ' bb-admin-forums';
bb_get_admin_header();
?>
示例12: if
<?php if ( gf_current_user_can_admin()||gf_current_user_can_mod() ) : ?>
<!-- mimick bbpress dashboard-->
<div class="admin">
<div class="dashboard" id="dashboard-right-now">
<h3><?php _e("Right Now","gf");?></h3>
<?php $forum=bb_get_forum(gf_get_root_forum_id());
?>
<div class="table">
<table cellspacing="0" cellpadding="0">
<thead>
<tr>
<th>Totals</th>
<th>Per Day</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="<?php echo gf_get_forum_manage_link();?>"><span> <?php echo gf_get_total_forums_count();?></span> <?php _e("forums","gf");?></a></td>
<td>N/A</td>
</tr>
<tr>
<td><span><?php echo gf_get_total_topic_count();?></span> topics</td>
<td><span>N/A</span> </td>
</tr>
<tr>
<td><span><?php echo gf_get_total_posts_count();?></span> posts</td>
<td><span>N/A</span> </td>
</tr>
<tr>
<td><span><?php echo gf_get_total_tags();?></span> tags</td>
示例13: die
$x->send();
break;
case 'order-forums':
if (!bb_current_user_can('manage_forums')) {
die('-1');
}
bb_check_ajax_referer($action);
if (!is_array($_POST['order'])) {
die('0');
}
global $bbdb;
$forums = array();
bb_get_forums();
// cache
foreach ($_POST['order'] as $pos => $forum_id) {
$forum = $bbdb->escape_deep(get_object_vars(bb_get_forum($forum_id)));
$forum['forum_order'] = $pos;
$forums[(int) $forum_id] = $forum;
}
foreach ($_POST['root'] as $root => $ids) {
foreach ($ids as $forum_id) {
$forums[(int) $forum_id]['forum_parent'] = (int) $root;
}
}
foreach ($forums as $forum) {
bb_update_forum($forum);
}
die('1');
break;
default:
do_action('bb_ajax_' . $_POST['action']);
示例14: bb_repermalink
$view_deleted = true;
}
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);
}
示例15: bb_move_forum_topics
function bb_move_forum_topics($from_forum_id, $to_forum_id)
{
global $bbdb;
$from_forum_id = (int) $from_forum_id;
$to_forum_id = (int) $to_forum_id;
add_filter('get_forum_where', 'bb_no_where');
// Just in case
$from_forum = bb_get_forum($from_forum_id);
if (!($to_forum = bb_get_forum($to_forum_id))) {
return false;
}
$posts = $to_forum->posts + ($from_forum ? $from_forum->posts : 0);
$topics = $to_forum->topics + ($from_forum ? $from_forum->topics : 0);
$bbdb->update($bbdb->forums, compact('topics', 'posts'), array('forum_id' => $to_forum_id));
$bbdb->update($bbdb->forums, array('topics' => 0, 'posts' => 0), array('forum_id' => $from_forum_id));
$bbdb->update($bbdb->posts, array('forum_id' => $to_forum_id), array('forum_id' => $from_forum_id));
$topic_ids = $bbdb->get_col($bbdb->prepare("SELECT topic_id FROM {$bbdb->topics} WHERE forum_id = %d", $from_forum_id));
$return = $bbdb->update($bbdb->topics, array('forum_id' => $to_forum_id), array('forum_id' => $from_forum_id));
nxt_cache_flush('bb_post');
if ($topic_ids) {
foreach ($topic_ids as $topic_id) {
// should maybe just flush these groups
nxt_cache_delete($topic_id, 'bb_topic');
nxt_cache_delete($topic_id, 'bb_thread');
}
}
nxt_cache_delete($from_forum_id, 'bb_forum');
nxt_cache_delete($to_forum_id, 'bb_forum');
nxt_cache_flush('bb_forums');
return $return;
}