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


PHP bp_forums_get_topic_id_from_slug函数代码示例

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


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

示例1: bp_has_forum_topic_posts

/**
 * Initiate the loop for a single topic's posts.
 *
 * @param array $args {
 *     Arguments for limiting the contents of the topic posts loop.
 *     @type int $topic_id ID of the topic to which the posts belong.
 *     @type int $per_page Number of items to return per page. Default: 15.
 *     @type int $max Max items to return. Default: false.
 *     @type string $order 'ASC' or 'DESC'.
 * }
 * @return bool True when posts are found corresponding to the args,
 *         otherwise false.
 */
function bp_has_forum_topic_posts($args = '')
{
    global $topic_template;
    $defaults = array('topic_id' => false, 'per_page' => 15, 'max' => false, 'order' => 'ASC');
    $r = bp_parse_args($args, $defaults, 'has_forum_topic_posts');
    extract($r, EXTR_SKIP);
    if (empty($topic_id) && bp_is_groups_component() && bp_is_current_action('forum') && bp_is_action_variable('topic', 0) && bp_action_variable(1)) {
        $topic_id = bp_forums_get_topic_id_from_slug(bp_action_variable(1));
    } elseif (empty($topic_id) && bp_is_forums_component() && bp_is_current_action('topic') && bp_action_variable(0)) {
        $topic_id = bp_forums_get_topic_id_from_slug(bp_action_variable(0));
    }
    if (empty($topic_id)) {
        return false;
    } else {
        $topic_template = new BP_Forums_Template_Topic((int) $topic_id, $per_page, $max, $order);
        // Current topic forum_id needs to match current_group forum_id
        if (bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta(bp_get_current_group_id(), 'forum_id')) {
            return false;
        }
    }
    return apply_filters('bp_has_topic_posts', $topic_template->has_posts(), $topic_template);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:35,代码来源:bp-forums-template.php

示例2: bp_has_forum_topic_posts

function bp_has_forum_topic_posts( $args = '' ) {
	global $topic_template, $bp;

	$defaults = array(
		'topic_id' => false,
		'per_page' => 15,
		'max'      => false,
		'order'    => 'ASC'
	);

	$r = wp_parse_args( $args, $defaults );
	extract( $r, EXTR_SKIP );

	if ( !$topic_id && $bp->current_component == $bp->groups->slug && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] )
		$topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );

	if ( is_numeric( $topic_id ) ) {
		$topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order );

		// Current topic forum_id needs to match current_group forum_id
		if ( $bp->current_component == $bp->groups->slug && $topic_template->forum_id != groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) )
			return false;

	} else {
		return false;
	}

	return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), &$topic_template );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:29,代码来源:bp-forums-templatetags.php

示例3: groups_screen_group_forum

/**
 * This screen function handles actions related to group forums.
 */
function groups_screen_group_forum()
{
    if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
        return false;
    }
    if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) {
        bp_do_404();
        return;
    }
    $bp = buddypress();
    if (!$bp->groups->current_group->user_has_access) {
        bp_core_no_access();
        return;
    }
    if (!bp_is_single_item()) {
        return false;
    }
    // Fetch the details we need.
    $topic_slug = (string) bp_action_variable(1);
    $topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
    $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
    $user_is_banned = false;
    if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
        $user_is_banned = true;
    }
    if (!empty($topic_slug) && !empty($topic_id)) {
        // Posting a reply.
        if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) {
            // Check the nonce.
            check_admin_referer('bp_forums_new_reply');
            // Auto join this user if they are not yet a member of this group.
            if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id());
            }
            $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false;
            // Don't allow reply flooding.
            if (bp_forums_reply_exists($_POST['reply_text'], $topic_id, bp_loggedin_user_id())) {
                bp_core_add_message(__('It looks like you\'ve already said that!', 'buddypress'), 'error');
            } else {
                if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) {
                    bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error');
                } else {
                    bp_core_add_message(__('Your reply was posted successfully', 'buddypress'));
                }
            }
            $query_vars = isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '';
            $redirect = bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars;
            if (!empty($post_id)) {
                $redirect .= '#post-' . $post_id;
            }
            bp_core_redirect($redirect);
        } elseif (bp_is_action_variable('stick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_stick_topic');
            if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) {
                bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was made sticky successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been stickied.
             *
             * @since 1.1.0
             *
             * @param int $topic_id ID of the topic being stickied.
             */
            do_action('groups_stick_forum_topic', $topic_id);
            bp_core_redirect(wp_get_referer());
        } elseif (bp_is_action_variable('unstick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_unstick_topic');
            if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) {
                bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was unstuck successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been un-stickied.
             *
             * @since 1.1.0
             *
             * @param int $topic_id ID of the topic being un-stickied.
             */
            do_action('groups_unstick_forum_topic', $topic_id);
            bp_core_redirect(wp_get_referer());
        } elseif (bp_is_action_variable('close', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
            // Check the nonce.
            check_admin_referer('bp_forums_close_topic');
            if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) {
                bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error');
            } else {
                bp_core_add_message(__('The topic was closed successfully', 'buddypress'));
            }
            /**
             * Fires after a group forum topic has been closed.
             *
             * @since 1.1.0
//.........这里部分代码省略.........
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:101,代码来源:bp-groups-screens.php

示例4: groups_screen_group_forum

/**
 * This screen function handles actions related to group forums
 *
 * @package BuddyPress
 */
function groups_screen_group_forum()
{
    global $bp;
    if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
        return false;
    }
    if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) {
        bp_do_404();
        return;
    }
    if (!$bp->groups->current_group->user_has_access) {
        bp_core_no_access();
        return;
    }
    if (bp_is_single_item()) {
        // Fetch the details we need
        $topic_slug = (string) bp_action_variable(1);
        $topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
        $forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
        $user_is_banned = false;
        if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
            $user_is_banned = true;
        }
        if (!empty($topic_slug) && !empty($topic_id)) {
            // Posting a reply
            if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) {
                // Check the nonce
                check_admin_referer('bp_forums_new_reply');
                // Auto join this user if they are not yet a member of this group
                if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
                    groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id());
                }
                $topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false;
                if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) {
                    bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error');
                } else {
                    bp_core_add_message(__('Your reply was posted successfully', 'buddypress'));
                }
                if (isset($_SERVER['QUERY_STRING'])) {
                    $query_vars = '?' . $_SERVER['QUERY_STRING'];
                }
                bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id);
            } else {
                if (bp_is_action_variable('stick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                    // Check the nonce
                    check_admin_referer('bp_forums_stick_topic');
                    if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) {
                        bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error');
                    } else {
                        bp_core_add_message(__('The topic was made sticky successfully', 'buddypress'));
                    }
                    do_action('groups_stick_forum_topic', $topic_id);
                    bp_core_redirect(wp_get_referer());
                } else {
                    if (bp_is_action_variable('unstick', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                        // Check the nonce
                        check_admin_referer('bp_forums_unstick_topic');
                        if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) {
                            bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error');
                        } else {
                            bp_core_add_message(__('The topic was unstuck successfully', 'buddypress'));
                        }
                        do_action('groups_unstick_forum_topic', $topic_id);
                        bp_core_redirect(wp_get_referer());
                    } else {
                        if (bp_is_action_variable('close', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                            // Check the nonce
                            check_admin_referer('bp_forums_close_topic');
                            if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) {
                                bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error');
                            } else {
                                bp_core_add_message(__('The topic was closed successfully', 'buddypress'));
                            }
                            do_action('groups_close_forum_topic', $topic_id);
                            bp_core_redirect(wp_get_referer());
                        } else {
                            if (bp_is_action_variable('open', 2) && (isset($bp->is_item_admin) || isset($bp->is_item_mod))) {
                                // Check the nonce
                                check_admin_referer('bp_forums_open_topic');
                                if (!bp_forums_openclose_topic(array('topic_id' => $topic_id, 'mode' => 'open'))) {
                                    bp_core_add_message(__('There was an error when opening that topic', 'buddypress'), 'error');
                                } else {
                                    bp_core_add_message(__('The topic was opened successfully', 'buddypress'));
                                }
                                do_action('groups_open_forum_topic', $topic_id);
                                bp_core_redirect(wp_get_referer());
                            } else {
                                if (empty($user_is_banned) && bp_is_action_variable('delete', 2) && !bp_action_variable(3)) {
                                    // Fetch the topic
                                    $topic = bp_forums_get_topic_details($topic_id);
                                    /* Check the logged in user can delete this topic */
                                    if (!$bp->is_item_admin && !$bp->is_item_mod && (int) bp_loggedin_user_id() != (int) $topic->topic_poster) {
                                        bp_core_redirect(wp_get_referer());
                                    }
                                    // Check the nonce
//.........这里部分代码省略.........
开发者ID:newington,项目名称:buddypress,代码行数:101,代码来源:bp-groups-screens.php

示例5: bp_has_forum_topic_posts

/**
 * Initiate the loop for a single topic's posts.
 *
 * @param array $args {
 *     Arguments for limiting the contents of the topic posts loop.
 *     @type int $topic_id ID of the topic to which the posts belong.
 *     @type int $per_page Number of items to return per page. Default: 15.
 *     @type int $max Max items to return. Default: false.
 *     @type string $order 'ASC' or 'DESC'.
 * }
 * @return bool True when posts are found corresponding to the args,
 *         otherwise false.
 */
function bp_has_forum_topic_posts( $args = '' ) {
	global $topic_template;

	$defaults = array(
		'topic_id' => false,
		'per_page' => 15,
		'max'      => false,
		'order'    => 'ASC'
	);

	$r = bp_parse_args( $args, $defaults, 'has_forum_topic_posts' );
	extract( $r, EXTR_SKIP );

	if ( empty( $topic_id ) && bp_is_groups_component() && bp_is_current_action( 'forum' ) && bp_is_action_variable( 'topic', 0 ) && bp_action_variable( 1 ) )
		$topic_id = bp_forums_get_topic_id_from_slug( bp_action_variable( 1 ) );
	elseif ( empty( $topic_id ) && bp_is_forums_component() && bp_is_current_action( 'topic' ) && bp_action_variable( 0 ) )
		$topic_id = bp_forums_get_topic_id_from_slug( bp_action_variable( 0 ) );

	if ( empty( $topic_id ) ) {
		return false;

	} else {
		$topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );

		// Current topic forum_id needs to match current_group forum_id
		if ( bp_is_groups_component() && $topic_template->forum_id != groups_get_groupmeta( bp_get_current_group_id(), 'forum_id' ) )
			return false;
	}

	/**
	 * Filters whether or not there are topics to display.
	 *
	 * @since BuddyPress (1.1.0)
	 *
	 * @param bool                     $value          Whether or not there are topics.
	 * @param BP_Forums_Template_Topic $topic_template Topic template global to use when rendering.
	 */
	return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template );
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:52,代码来源:bp-forums-template.php

示例6: _get_topic_id

 protected function _get_topic_id()
 {
     return bp_forums_get_topic_id_from_slug($this->params['bp_action_variables'][1]);
 }
开发者ID:kubens,项目名称:Snippets,代码行数:4,代码来源:bp.php

示例7: groups_screen_group_forum

function groups_screen_group_forum() {
	global $bp;

	if ( $bp->is_single_item && $bp->groups->current_group->user_has_access ) {

		/* Fetch the details we need */
		$topic_slug = $bp->action_variables[1];
		$topic_id = bp_forums_get_topic_id_from_slug( $topic_slug );
		$forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );

		if ( $topic_slug && $topic_id ) {

			/* Posting a reply */
			if ( !$bp->action_variables[2] && isset( $_POST['submit_reply'] ) ) {
				/* Check the nonce */
				check_admin_referer( 'bp_forums_new_reply' );

				/* Auto join this user if they are not yet a member of this group */
				if ( $bp->groups->auto_join && !is_super_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
					groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );

				if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
					bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
				else
					bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );

				if ( $_SERVER['QUERY_STRING'] )
					$query_vars = '?' . $_SERVER['QUERY_STRING'];

				bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic_slug . '/' . $query_vars . '#post-' . $post_id );
			}

			/* Sticky a topic */
			else if ( 'stick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
				/* Check the nonce */
				check_admin_referer( 'bp_forums_stick_topic' );

				if ( !bp_forums_sticky_topic( array( 'topic_id' => $topic_id ) ) )
					bp_core_add_message( __( 'There was an error when making that topic a sticky', 'buddypress' ), 'error' );
				else
					bp_core_add_message( __( 'The topic was made sticky successfully', 'buddypress' ) );

				do_action( 'groups_stick_forum_topic', $topic_id );
				bp_core_redirect( wp_get_referer() );
			}

			/* Un-Sticky a topic */
			else if ( 'unstick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
				/* Check the nonce */
				check_admin_referer( 'bp_forums_unstick_topic' );

				if ( !bp_forums_sticky_topic( array( 'topic_id' => $topic_id, 'mode' => 'unstick' ) ) )
					bp_core_add_message( __( 'There was an error when unsticking that topic', 'buddypress'), 'error' );
				else
					bp_core_add_message( __( 'The topic was unstuck successfully', 'buddypress') );

				do_action( 'groups_unstick_forum_topic', $topic_id );
				bp_core_redirect( wp_get_referer() );
			}

			/* Close a topic */
			else if ( 'close' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
				/* Check the nonce */
				check_admin_referer( 'bp_forums_close_topic' );

				if ( !bp_forums_openclose_topic( array( 'topic_id' => $topic_id ) ) )
					bp_core_add_message( __( 'There was an error when closing that topic', 'buddypress'), 'error' );
				else
					bp_core_add_message( __( 'The topic was closed successfully', 'buddypress') );

				do_action( 'groups_close_forum_topic', $topic_id );
				bp_core_redirect( wp_get_referer() );
			}

			/* Open a topic */
			else if ( 'open' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
				/* Check the nonce */
				check_admin_referer( 'bp_forums_open_topic' );

				if ( !bp_forums_openclose_topic( array( 'topic_id' => $topic_id, 'mode' => 'open' ) ) )
					bp_core_add_message( __( 'There was an error when opening that topic', 'buddypress'), 'error' );
				else
					bp_core_add_message( __( 'The topic was opened successfully', 'buddypress') );

				do_action( 'groups_open_forum_topic', $topic_id );
				bp_core_redirect( wp_get_referer() );
			}

			/* Delete a topic */
			else if ( 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
				/* Fetch the topic */
				$topic = bp_forums_get_topic_details( $topic_id );

				/* Check the logged in user can delete this topic */
				if ( !$bp->is_item_admin && !$bp->is_item_mod && (int)$bp->loggedin_user->id != (int)$topic->topic_poster )
					bp_core_redirect( wp_get_referer() );

				/* Check the nonce */
				check_admin_referer( 'bp_forums_delete_topic' );

//.........这里部分代码省略.........
开发者ID:n-sane,项目名称:zaroka,代码行数:101,代码来源:bp-groups.php

示例8: ac_notifier_remove_notification_for_topic

/**
 * @since 1.0.3
 * it is not used any more because qwe are linking to threaded view
 * Remove notification for group forum posts/new topic
 */
function ac_notifier_remove_notification_for_topic()
{
    global $bp;
    //is group & group forum active ?
    if (!(bp_is_active("groups") && bp_is_active("forums"))) {
        return;
    }
    //if either group or forum is not actuive do not do anything
    //check if we are on single topic screen, right?
    if (bp_is_group_forum_topic() && is_user_logged_in()) {
        $topic_id = bp_forums_get_topic_id_from_slug($bp->action_variables[1]);
        //get id from slug
        $topic = get_topic($topic_id);
        $group_id = $bp->groups->current_group->id;
        //find activity id for this topic
        $activity_id = bp_activity_get_activity_id(array('user_id' => $topic->poster_id, 'component' => $bp->groups->id, 'type' => "new_forum_topic", "item_id" => $group_id, 'secondary_item_id' => $topic_id));
        //remove notification for new topic comments: easy
        if (!empty($activity_id)) {
            bp_core_delete_notifications_by_item_id($bp->loggedin_user->id, $activity_id, $bp->ac_notifier->id, 'new_activity_comment_' . $activity_id);
        }
        $posts = ac_notifier_get_forum_post_ids($topic_id);
        if (!empty($posts)) {
            //find all activities for the post
            $activities = ac_notifier_get_activity_ids(array("item_id" => $group_id, "secondary_ids" => $posts, "component" => $bp->groups->id, "type" => "new_forum_post"));
            //pass the array
            foreach ((array) $activities as $ac_id) {
                bp_core_delete_notifications_by_item_id($bp->loggedin_user->id, $ac_id, $bp->ac_notifier->id, 'new_activity_comment_' . $ac_id);
            }
        }
    }
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:36,代码来源:ac-notify.php

示例9: bplf_catcher


//.........这里部分代码省略.........
                // Individual member new forum topic feed
                // /members/username/activity/forumtopics/feed
            // Individual member new forum topic feed
            // /members/username/activity/forumtopics/feed
            case 'forumtopics':
                if (!defined('BPLF_DISABLE_MEMBER_TOPICS_FEED')) {
                    $this_bp_feed = 'member_topics';
                }
                break;
                // Individual member forum reply feed
                // /members/username/activity/forumreplies/feed
            // Individual member forum reply feed
            // /members/username/activity/forumreplies/feed
            case 'forumreplies':
                if (!defined('BPLF_DISABLE_MEMBER_REPLIES_FEED')) {
                    $this_bp_feed = 'member_replies';
                }
                break;
                // Individual member forum activity feed
                // /members/username/activity/forums/feed
            // Individual member forum activity feed
            // /members/username/activity/forums/feed
            case 'forums':
                if (!defined('BPLF_DISABLE_MEMBER_FORUMS_FEED')) {
                    $this_bp_feed = 'member_forums';
                }
                break;
        }
    }
    // Group activity feeds
    if (bp_is_groups_component() && isset($bp->groups->current_group->id) && bp_action_variable(0) == 'feed') {
        switch (bp_current_action()) {
            // Group activity updates
            // /groups/groupname/updates/feed
            case 'updates':
                if (!defined('BPLF_DISABLE_GROUP_UPDATES_FEED')) {
                    $this_bp_feed = 'group_updates';
                }
                break;
                // New group forum topics
                // /groups/groupname/forumtopics/feed
            // New group forum topics
            // /groups/groupname/forumtopics/feed
            case 'forumtopics':
                if (!defined('BPLF_DISABLE_GROUP_TOPICS_FEED')) {
                    $this_bp_feed = 'group_topics';
                }
                break;
                // New group forum replies
                // /groups/groupname/forumreplies/feed
            // New group forum replies
            // /groups/groupname/forumreplies/feed
            case 'forumreplies':
                if (!defined('BPLF_DISABLE_GROUP_REPLIES_FEED')) {
                    $this_bp_feed = 'group_replies';
                }
                break;
                // Group forum activity
                // /groups/groupname/forums/feed
            // Group forum activity
            // /groups/groupname/forums/feed
            case 'forums':
                if (!defined('BPLF_DISABLE_GROUP_FORUMS_FEED')) {
                    $this_bp_feed = 'group_forums';
                }
                break;
                // Group membership activity
                // /groups/groupname/membership/feed
            // Group membership activity
            // /groups/groupname/membership/feed
            case 'membership':
                if (!defined('BPLF_DISABLE_GROUP_MEMBERSHIP_FEED')) {
                    $this_bp_feed = 'group_membership';
                }
                break;
        }
    }
    // Individual forum topic feeds
    // /groups/groupname/forum/topic/topicslug/feed
    if (bp_is_groups_component() && bp_current_action() == 'forum' && bp_action_variable(0) == 'topic' && bp_action_variable(1) && bp_action_variable(2) == 'feed') {
        global $bplf_topic, $bplf_topic_posts;
        if (!defined('BPLF_DISABLE_INDIVIDUAL_TOPIC_FEED')) {
            $topic_id = bp_forums_get_topic_id_from_slug(bp_action_variable(1));
            $bplf_topic = bp_forums_get_topic_details($topic_id);
            $topic_args = array('per_page' => 50, 'max' => 50, 'order' => 'ASC');
            $topic_args = apply_filters('bp_lotsa_feeds_topic_feed_args', $topic_args);
            extract($topic_args);
            $bplf_topic_posts = new BP_Forums_Template_Topic($topic_id, $per_page, $max, $order);
            $this_bp_feed = 'forum_topic';
        }
    }
    $this_bp_feed = apply_filters('bplf_which_feed', $this_bp_feed);
    if (!$this_bp_feed) {
        return false;
    }
    $wp_query->is_404 = false;
    status_header(200);
    include_once apply_filters('bplf_feed_template', dirname(__FILE__) . '/feed-template.php');
    die;
}
开发者ID:r-a-y,项目名称:bp-lotsa-feeds,代码行数:101,代码来源:bp-lotsa-feeds.php

示例10: get_forum_arr_pos

 private function get_forum_arr_pos()
 {
     global $bp, $forum_template;
     $topic_slug = $bp->action_variables[1];
     $topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
     for ($i = 0; $i <= count($forum_template->topics); $i++) {
         if ($topic_id == $forum_template->topics[$i]->topic_id) {
             $array_pos = $i;
         }
     }
     return $array_pos;
 }
开发者ID:netconstructor,项目名称:SeoPress,代码行数:12,代码来源:functions.php


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