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


PHP bp_get_activity_slug函数代码示例

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


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

示例1: bp_reshare_notajaxed_feed_url

function bp_reshare_notajaxed_feed_url($feed_url)
{
    if ($_COOKIE['bp-activity-scope'] == 'reshares') {
        $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/reshares/feed/';
    }
    return $feed_url;
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:7,代码来源:bp-reshare-filters.php

示例2: test_member_activity_page

 public function test_member_activity_page()
 {
     $url = home_url($this->u->user_nicename) . '/' . bp_get_activity_slug();
     $this->go_to($url);
     $this->assertTrue(bp_is_user());
     $this->assertTrue(bp_is_my_profile());
     $this->assertEquals($this->u->ID, bp_displayed_user_id());
     $this->assertTrue(bp_is_activity_component());
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:9,代码来源:root-profiles.php

示例3: bebop_get_feed_url

function bebop_get_feed_url()
{
    global $this_bp_feed;
    if (!empty($this_bp_feed)) {
        return bp_displayed_user_domain() . bp_get_activity_slug() . '/' . $this_bp_feed;
    } else {
        return false;
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:9,代码来源:bebop-feeds.php

示例4: setup_globals

 /**
  * Setup globals
  *
  * The BP_MEMBERS_SLUG constant is deprecated, and only used here for
  * backwards compatibility.
  *
  * @since 1.5
  * @global obj $bp
  */
 function setup_globals()
 {
     global $bp, $current_user, $displayed_user_id;
     // Define a slug, if necessary
     if (!defined('BP_MEMBERS_SLUG')) {
         define('BP_MEMBERS_SLUG', $this->id);
     }
     $globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
     parent::setup_globals($globals);
     /** Logged in user ****************************************************/
     // Fetch the full name for the logged in user
     $bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
     // Hits the DB on single WP installs so get this separately
     $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
     // The domain for the user currently logged in. eg: http://domain.com/members/andy
     $bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
     // The core userdata of the user who is currently logged in.
     $bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
     /** Displayed user ****************************************************/
     // The domain for the user currently being displayed
     $bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
     // The core userdata of the user who is currently being displayed
     $bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
     // Fetch the full name displayed user
     $bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
     /** Profiles Fallback *************************************************/
     if (!bp_is_active('xprofile')) {
         $bp->profile->slug = 'profile';
         $bp->profile->id = 'profile';
     }
     /** Default Profile Component *****************************************/
     if (!defined('BP_DEFAULT_COMPONENT')) {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     } else {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     }
     if (!bp_current_component() && bp_displayed_user_id()) {
         /**
          * BuddyPress will attempt to resolve to the most specific URL possible,
          * to avoid search-engine-unfriendly content reduplication. Filter
          * bp_guarantee_unique_uris (and return false) to avoid this behavior
          */
         if (apply_filters('bp_guarantee_unique_uris', true)) {
             bp_core_redirect(bp_displayed_user_domain() . $bp->default_component);
         } else {
             $bp->current_component = $bp->default_component;
         }
     }
 }
开发者ID:newington,项目名称:buddypress,代码行数:62,代码来源:bp-members-loader.php

示例5: bp_activity_action_permalink_router

/**
 * Allow core components and dependent plugins to register activity actions
 *
 * @since BuddyPress (1.2)
 *
 * @global object $bp BuddyPress global settings
 * @uses bp_is_activity_component()
 * @uses bp_is_current_action()
 * @uses bp_action_variable()
 * @uses bp_activity_get_specific()
 * @uses bp_is_active()
 * @uses bp_core_get_user_domain()
 * @uses groups_get_group()
 * @uses bp_get_group_permalink()
 * @uses apply_filters_ref_array() To call the 'bp_activity_permalink_redirect_url' hook
 * @uses bp_core_redirect()
 * @uses bp_get_root_domain()
 *
 * @return bool False on failure
 */
function bp_activity_action_permalink_router()
{
    global $bp;
    // Not viewing activity
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default
    $redirect = false;
    // Redirect based on the type of activity
    if (bp_is_active('groups') && $activity->component == $bp->groups->id) {
        // Activity is a user update
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else
        } else {
            // Set redirect to group activity stream
            if ($group = groups_get_group(array('group_id' => $activity->item_id))) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream
    } else {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    // Allow redirect to be filtered
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page
    bp_core_redirect($redirect);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:71,代码来源:bp-activity-actions.php

示例6: setup_globals

 /**
  * Setup globals
  *
  * The BP_MEMBERS_SLUG constant is deprecated, and only used here for
  * backwards compatibility.
  *
  * @since 1.5
  * @global obj $bp
  */
 function setup_globals()
 {
     global $bp, $current_user, $displayed_user_id;
     // Define a slug, if necessary
     if (!defined('BP_MEMBERS_SLUG')) {
         define('BP_MEMBERS_SLUG', $this->id);
     }
     $globals = array('path' => BP_PLUGIN_DIR, 'slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'search_string' => __('Search Members...', 'buddypress'));
     parent::setup_globals($globals);
     /** Logged in user ****************************************************/
     // Fetch the full name for the logged in user
     $bp->loggedin_user->fullname = bp_core_get_user_displayname($bp->loggedin_user->id);
     // Hits the DB on single nxt installs so get this separately
     $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin();
     // The domain for the user currently logged in. eg: http://domain.com/members/andy
     $bp->loggedin_user->domain = bp_core_get_user_domain($bp->loggedin_user->id);
     // The core userdata of the user who is currently logged in.
     $bp->loggedin_user->userdata = bp_core_get_core_userdata($bp->loggedin_user->id);
     /** Displayed user ****************************************************/
     // The user id of the user currently being viewed:
     // $bp->displayed_user->id is set in /bp-core/bp-core-catchuri.php
     if (empty($bp->displayed_user->id)) {
         $bp->displayed_user->id = 0;
     }
     // The domain for the user currently being displayed
     $bp->displayed_user->domain = bp_core_get_user_domain($bp->displayed_user->id);
     // The core userdata of the user who is currently being displayed
     $bp->displayed_user->userdata = bp_core_get_core_userdata($bp->displayed_user->id);
     // Fetch the full name displayed user
     $bp->displayed_user->fullname = bp_core_get_user_displayname($bp->displayed_user->id);
     /** Profiles Fallback *************************************************/
     if (!bp_is_active('xprofile')) {
         $bp->profile->slug = 'profile';
         $bp->profile->id = 'profile';
     }
     /** Default Profile Component *****************************************/
     if (!defined('BP_DEFAULT_COMPONENT')) {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' == $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     } else {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     }
     if (!$bp->current_component && $bp->displayed_user->id) {
         $bp->current_component = $bp->default_component;
     }
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:58,代码来源:bp-members-loader.php

示例7: bp_reshare_type_tabs

function bp_reshare_type_tabs()
{
    ?>
	<li id="activity-reshares"><a href="<?php 
    echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/reshares/';
    ?>
" title="<?php 
    _e('Activity that I have reshared.', 'bp-reshare');
    ?>
"><?php 
    _e('Reshares', 'bp-reshare');
    ?>
 <strong><?php 
    printf(__('<span>%s</span>', 'bp-reshare'), bp_reshare_get_total_reshare_count_for_user(bp_loggedin_user_id()));
    ?>
</strong></a></li>
	<?php 
}
开发者ID:KristianI,项目名称:bp-reshare,代码行数:18,代码来源:bp-reshare-screens.php

示例8: test_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible

 public function test_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     $old_current_user = get_current_user_id();
     $this->set_current_user($u1);
     $this->go_to(bp_core_get_user_domain($u2));
     $old_bp_nav = buddypress()->bp_nav;
     $old_default_component = buddypress()->default_component;
     buddypress()->default_component = 'foo';
     buddypress()->bp_nav = array('foo' => array('show_for_displayed_user' => false));
     $subnav_item = array('user_has_access' => false);
     // Just test relevant info
     $found = bp_core_maybe_hook_new_subnav_screen_function($subnav_item);
     $this->assertSame('failure', $found['status']);
     $this->assertSame(bp_core_get_user_domain($u2) . bp_get_activity_slug() . '/', $found['redirect_args']['root']);
     // Clean up
     $this->set_current_user($old_current_user);
     buddypress()->default_component = $old_default_component;
     buddypress()->bp_nav = $old_bp_nav;
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:21,代码来源:bpCoreMaybeHookNewSubnavScreenFunction.php

示例9: my_nav_menu_profile_link

function my_nav_menu_profile_link($menu)
{
    if (!is_user_logged_in()) {
        return $menu . '<li class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Вход/Регистрация" href="' . wp_login_url(get_site_url()) . '">Вход/Регистрация</a></li>';
    } else {
        $profileextras = '<li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Активност" href="' . get_site_url() . '/activity' . '">Активност</a></li>
                <li class="menu-item menu-item-type-post_type menu-item-object-page"><a data-toggle="dropdown"  class="dropdown-toggle" href="#">' . __('Моят профил') . '   <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>' . '</a>
                <ul role="menu" class=" dropdown-menu">
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Профил" href="' . bp_loggedin_user_domain('/') . '">Профил</a></li>
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Съобщения" href="' . bp_loggedin_user_domain('/') . 'messages/' . '">Съобщения</a></li>
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Моите пиеси" href="' . get_site_url() . '/my-plays/' . '">Моите пиеси</a></li>
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Приятели" href="' . bp_loggedin_user_domain('/') . 'friends/' . '">Приятели</a></li>
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Споменавания" href="' . bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/' . '">Споменавания</a></li>
                  <li id="menu-item" class="menu-item menu-item-type-post_type menu-item-object-page"><a title="Изход" href="' . wp_logout_url(get_site_url()) . '">Изход</a></li>
                </ul>
                </li>';
    }
    $menu = $menu . $profileextras;
    return $menu;
}
开发者ID:vkolova,项目名称:bgscena,代码行数:20,代码来源:extras.php

示例10: bp_legacy_theme_activity_template_loader

/**
 * Load the activity loop template when activity is requested via AJAX,
 *
 * @return string JSON object containing 'contents' (output of the template loop
 * for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
 *
 * @since BuddyPress (1.2)
 */
function bp_legacy_theme_activity_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $scope = '';
    if (!empty($_POST['scope'])) {
        $scope = $_POST['scope'];
    }
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions(bp_loggedin_user_id());
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    // Buffer the loop in the template to a var for JS to spit out.
    ob_start();
    bp_get_template_part('activity/activity-loop');
    $result['contents'] = ob_get_contents();
    /**
     * Filters the feed URL for when activity is requested via AJAX.
     *
     * @since BuddyPress (1.7.0)
     *
     * @param string $feed_url URL for the feed to be used.
     * @param string $scope    Scope for the activity request.
     */
    $result['feed_url'] = apply_filters('bp_legacy_theme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    exit(json_encode($result));
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:53,代码来源:buddypress-functions.php

示例11: bp_activity_format_notifications

/**
 * Format notifications related to activity.
 *
 * @since 1.5.0
 *
 * @uses bp_loggedin_user_domain()
 * @uses bp_get_activity_slug()
 * @uses bp_core_get_user_displayname()
 * @uses apply_filters() To call the 'bp_activity_multiple_at_mentions_notification' hook.
 * @uses apply_filters() To call the 'bp_activity_single_at_mentions_notification' hook.
 * @uses do_action() To call 'activity_format_notifications' hook.
 *
 * @param string $action            The type of activity item. Just 'new_at_mention' for now.
 * @param int    $item_id           The activity ID.
 * @param int    $secondary_item_id In the case of at-mentions, this is the mentioner's ID.
 * @param int    $total_items       The total number of notifications to format.
 * @param string $format            'string' to get a BuddyBar-compatible notification, 'array' otherwise.
 * @return string $return Formatted @mention notification.
 */
function bp_activity_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    switch ($action) {
        case 'new_at_mention':
            $activity_id = $item_id;
            $poster_user_id = $secondary_item_id;
            $at_mention_link = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/';
            $at_mention_title = sprintf(__('@%s Mentions', 'buddypress'), bp_get_loggedin_user_username());
            $amount = 'single';
            if ((int) $total_items > 1) {
                $text = sprintf(__('You have %1$d new mentions', 'buddypress'), (int) $total_items);
                $amount = 'multiple';
            } else {
                $user_fullname = bp_core_get_user_displayname($poster_user_id);
                $text = sprintf(__('%1$s mentioned you', 'buddypress'), $user_fullname);
            }
            break;
    }
    if ('string' == $format) {
        /**
         * Filters the @mention notification for the string format.
         *
         * This is a variable filter that is dependent on how many items
         * need notified about. The two possible hooks are bp_activity_single_at_mentions_notification
         * or bp_activity_multiple_at_mentions_notification.
         *
         * @since 1.5.0
         *
         * @param string $string          HTML anchor tag for the mention.
         * @param string $at_mention_link The permalink for the mention.
         * @param int    $total_items     How many items being notified about.
         * @param int    $activity_id     ID of the activity item being formatted.
         * @param int    $poster_user_id  ID of the user posting the mention.
         */
        $return = apply_filters('bp_activity_' . $amount . '_at_mentions_notification', '<a href="' . esc_url($at_mention_link) . '" title="' . esc_attr($at_mention_title) . '">' . esc_html($text) . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
    } else {
        /**
         * Filters the @mention notification for any non-string format.
         *
         * This is a variable filter that is dependent on how many items need notified about.
         * The two possible hooks are bp_activity_single_at_mentions_notification
         * or bp_activity_multiple_at_mentions_notification.
         *
         * @since 1.5.0
         *
         * @param array  $array           Array holding the content and permalink for the mention notification.
         * @param string $at_mention_link The permalink for the mention.
         * @param int    $total_items     How many items being notified about.
         * @param int    $activity_id     ID of the activity item being formatted.
         * @param int    $poster_user_id  ID of the user posting the mention.
         */
        $return = apply_filters('bp_activity_' . $amount . '_at_mentions_notification', array('text' => $text, 'link' => $at_mention_link), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id);
    }
    /**
     * Fires right before returning the formatted activity notifications.
     *
     * @since 1.2.0
     *
     * @param string $action            The type of activity item.
     * @param int    $item_id           The activity ID.
     * @param int    $secondary_item_id @mention mentioner ID.
     * @param int    $total_items       Total amount of items to format.
     */
    do_action('activity_format_notifications', $action, $item_id, $secondary_item_id, $total_items);
    return $return;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:85,代码来源:bp-activity-notifications.php

示例12: groups_screen_group_activity_permalink

function groups_screen_group_activity_permalink()
{
    global $bp;
    if (!bp_is_groups_component() || !bp_is_active('activity') || bp_is_active('activity') && !bp_is_current_action(bp_get_activity_slug()) || !bp_action_variable(0)) {
        return false;
    }
    $bp->is_single_item = true;
    bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home'));
}
开发者ID:newington,项目名称:buddypress,代码行数:9,代码来源:bp-groups-screens.php

示例13: groups_screen_group_activity_permalink

/**
 * Handle the display of a single group activity item.
 */
function groups_screen_group_activity_permalink()
{
    if (!bp_is_groups_component() || !bp_is_active('activity') || bp_is_active('activity') && !bp_is_current_action(bp_get_activity_slug()) || !bp_action_variable(0)) {
        return false;
    }
    buddypress()->is_single_item = true;
    /** This filter is documented in bp-groups/bp-groups-screens.php */
    bp_core_load_template(apply_filters('groups_template_group_home', 'groups/single/home'));
}
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:12,代码来源:bp-groups-screens.php

示例14: setup_admin_bar

 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of the $wp_admin_nav
  *      parameter array.
  * @uses is_user_logged_in()
  * @uses trailingslashit()
  * @uses bp_get_total_mention_count_for_user()
  * @uses bp_loggedin_user_id()
  * @uses bp_is_active()
  * @uses bp_get_friends_slug()
  * @uses bp_get_groups_slug()
  *
  * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a
  *                            description.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Menus for logged in user.
     if (is_user_logged_in()) {
         // Setup the logged in user variables.
         $activity_link = trailingslashit(bp_loggedin_user_domain() . bp_get_activity_slug());
         // Unread message count.
         if (bp_activity_do_mentions()) {
             $count = bp_get_total_mention_count_for_user(bp_loggedin_user_id());
             if (!empty($count)) {
                 $title = sprintf(_x('Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress'), bp_core_number_format($count));
             } else {
                 $title = _x('Mentions', 'Toolbar Mention logged in user', 'buddypress');
             }
         }
         // Add the "Activity" sub menu.
         $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Activity', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Personal.
         $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => _x('Personal', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link);
         // Mentions.
         if (bp_activity_do_mentions()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions'));
         }
         // Favorite activity items.
         if (bp_activity_can_favorite()) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => _x('Favorites', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites'));
         }
         // Friends?
         if (bp_is_active('friends')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => _x('Friends', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug()));
         }
         // Groups?
         if (bp_is_active('groups')) {
             $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => _x('Groups', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug()));
         }
     }
     parent::setup_admin_bar($wp_admin_nav);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:56,代码来源:bp-activity-loader.php

示例15: bp_dtheme_activity_template_loader

/**
 * Load the activity loop template when activity is requested via AJAX,
 *
 * @return string JSON object containing 'contents' (output of the template loop for the Activity component) and 'feed_url' (URL to the relevant RSS feed).
 * @since BuddyPress (1.2)
 */
function bp_dtheme_activity_template_loader()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    $scope = '';
    if (!empty($_POST['scope'])) {
        $scope = $_POST['scope'];
    }
    // We need to calculate and return the feed URL for each scope
    switch ($scope) {
        case 'friends':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/friends/feed/';
            break;
        case 'groups':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/groups/feed/';
            break;
        case 'favorites':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
            break;
        case 'mentions':
            $feed_url = bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
            bp_activity_clear_new_mentions(bp_loggedin_user_id());
            break;
        default:
            $feed_url = home_url(bp_get_activity_root_slug() . '/feed/');
            break;
    }
    // Buffer the loop in the template to a var for JS to spit out.
    ob_start();
    locate_template(array('activity/activity-loop.php'), true);
    $result['contents'] = ob_get_contents();
    $result['feed_url'] = apply_filters('bp_dtheme_activity_feed_url', $feed_url, $scope);
    ob_end_clean();
    exit(json_encode($result));
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:43,代码来源:ajax.php


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