• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_loggedin_user_domain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: profile_tab_gifts

 public function profile_tab_gifts()
 {
     global $bp;
     bp_core_new_nav_item(array('parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->profile->slug, 'default_subnav_slug' => 'send_gift', 'show_for_displayed_user' => false, 'name' => 'Gifts', 'slug' => 'gifts', 'screen_function' => array($this, 'send_gift_posts'), 'position' => 40));
     bp_core_new_subnav_item(array('name' => 'Send Gift', 'slug' => 'send_gift', 'show_for_displayed_user' => false, 'parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->bp_nav['gifts']['slug'], 'position' => 10, 'screen_function' => array($this, 'send_gift_posts')));
     bp_core_new_subnav_item(array('name' => 'Received Gift', 'slug' => 'received_gift', 'parent_url' => bp_loggedin_user_domain() . '/gifts/', 'parent_slug' => $bp->bp_nav['gifts']['slug'], 'position' => 10, 'screen_function' => array($this, 'received_gifts_posts')));
 }
开发者ID:aiyazkhorajia,项目名称:buddypress-gift-addon,代码行数:7,代码来源:buddypress-gift-addon.php


示例2: bp_members_admin_bar_my_account_menu

/**
 * Add the "My Account" menu and all submenus.
 *
 * @since 1.6.0
 *
 * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        $bp = buddypress();
        // Stored in the global so we can add menus easily later on
        $bp->my_account_menu_id = 'my-account-buddypress';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(bp_get_requested_url())));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:32,代码来源:bp-members-adminbar.php


示例3: 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


示例4: bp_content_setup_nav

function bp_content_setup_nav()
{
    global $bp;
    bp_core_new_nav_item(array('name' => __('My Posts', 'buddypress'), 'slug' => 'my-posts', 'screen_function' => 'my_posts_screen_link', 'position' => 40, 'default_subnav_slug' => 'my-posts-subnav'));
    bp_core_new_subnav_item(array('name' => __('', 'buddypress'), 'slug' => 'my-posts', 'parent_url' => trailingslashit(bp_loggedin_user_domain() . 'main-tab'), 'parent_slug' => 'my-posts', 'screen_function' => 'my_posts_screen_link', 'position' => 10));
    do_action('bp_content_setup_nav');
}
开发者ID:hardikdashora,项目名称:posts-on-buddpress-profiles,代码行数:7,代码来源:profiles.php


示例5: friends_screen_requests

/**
 * Catch and process the Requests page.
 */
function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    } elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_withdraw_friendship');
        if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
            bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
        }
        bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
    }
    do_action('friends_screen_requests');
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:eresyyl,项目名称:mk,代码行数:36,代码来源:bp-friends-screens.php


示例6: friends_format_notifications

/**
 * Format the BuddyBar/Toolbar notifications for the Friends component
 *
 * @package BuddyPress
 *
 * @param string $action The kind of notification being rendered
 * @param int $item_id The primary item id
 * @param int $secondary_item_id The secondary item id
 * @param int $total_items The total number of messaging-related notifications waiting for the user
 * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
 */
function friends_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    switch ($action) {
        case 'friendship_accepted':
            $link = trailingslashit(bp_loggedin_user_domain() . bp_get_friends_slug() . '/my-friends');
            // Set up the string and the filter
            if ((int) $total_items > 1) {
                $text = sprintf(__('%d friends accepted your friendship requests', 'buddypress'), (int) $total_items);
                $filter = 'bp_friends_multiple_friendship_accepted_notification';
            } else {
                $text = sprintf(__('%s accepted your friendship request', 'buddypress'), bp_core_get_user_displayname($item_id));
                $filter = 'bp_friends_single_friendship_accepted_notification';
            }
            break;
        case 'friendship_request':
            $link = bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/?new';
            // Set up the string and the filter
            if ((int) $total_items > 1) {
                $text = sprintf(__('You have %d pending friendship requests', 'buddypress'), (int) $total_items);
                $filter = 'bp_friends_multiple_friendship_request_notification';
            } else {
                $text = sprintf(__('You have a friendship request from %s', 'buddypress'), bp_core_get_user_displayname($item_id));
                $filter = 'bp_friends_single_friendship_request_notification';
            }
            break;
    }
    // Return either an HTML link or an array, depending on the requested format
    if ('string' == $format) {
        $return = apply_filters($filter, '<a href="' . $link . '">' . $text . '</a>', (int) $total_items);
    } else {
        $return = apply_filters($filter, array('link' => $link, 'text' => $text), (int) $total_items);
    }
    do_action('friends_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $return);
    return $return;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:46,代码来源:bp-friends-activity.php


示例7: bp_follow_format_notifications

/**
 * Format on screen notifications into something readable by users.
 *
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 */
function bp_follow_format_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
    global $bp;
    do_action('bp_follow_format_notifications', $action, $item_id, $secondary_item_id, $total_items, $format);
    switch ($action) {
        case 'new_follow':
            $link = $text = false;
            if (1 == $total_items) {
                $text = sprintf(__('%s is now following you', 'bp-follow'), bp_core_get_user_displayname($item_id));
                $link = bp_core_get_user_domain($item_id) . '?bpf_read';
            } else {
                $text = sprintf(__('%d more users are now following you', 'bp-follow'), $total_items);
                if (bp_is_active('notifications')) {
                    $link = bp_get_notifications_permalink();
                } else {
                    $link = bp_loggedin_user_domain() . $bp->follow->followers->slug . '/?new';
                }
            }
            break;
        default:
            $link = apply_filters('bp_follow_extend_notification_link', false, $action, $item_id, $secondary_item_id, $total_items);
            $text = apply_filters('bp_follow_extend_notification_text', false, $action, $item_id, $secondary_item_id, $total_items);
            break;
    }
    if (!$link || !$text) {
        return false;
    }
    if ('string' == $format) {
        return apply_filters('bp_follow_new_followers_notification', '<a href="' . $link . '">' . $text . '</a>', $total_items, $link, $text, $item_id, $secondary_item_id);
    } else {
        $array = array('text' => $text, 'link' => $link);
        return apply_filters('bp_follow_new_followers_return_notification', $array, $item_id, $secondary_item_id, $total_items);
    }
}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:39,代码来源:bp-follow-notifications.php


示例8: friends_screen_requests

function friends_screen_requests()
{
    if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_accept_friendship');
        if (friends_accept_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship accepted', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    } elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
        // Check the nonce
        check_admin_referer('friends_reject_friendship');
        if (friends_reject_friendship(bp_action_variable(1))) {
            bp_core_add_message(__('Friendship rejected', 'buddypress'));
        } else {
            bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
    }
    do_action('friends_screen_requests');
    if (isset($_GET['new'])) {
        bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
    }
    bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:27,代码来源:bp-friends-screens.php


示例9: mme_nav_menu_profile_links

 function mme_nav_menu_profile_links($menu, $args)
 {
     if (is_user_logged_in() && $args->theme_location == 'member') {
         $profilelink = '<li><a href="' . bp_loggedin_user_domain('/') . '">' . __('Mein Profil', 'hr-beisl') . '</a></li>';
         $menu = $profilelink . $menu;
     }
     return $menu;
 }
开发者ID:abisz,项目名称:HR-Beisl-Theme,代码行数:8,代码来源:functions.php


示例10: add_dashboard_in_menu

 function add_dashboard_in_menu($menu)
 {
     $dash_menu['dashboard'] = array('icon' => 'icon-meter', 'label' => __('Dashboard', 'wplms-dashboard'), 'link' => bp_loggedin_user_domain() . WPLMS_DASHBOARD_SLUG);
     foreach ($menu as $key => $item) {
         $dash_menu[$key] = $item;
     }
     return $dash_menu;
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:8,代码来源:dashboard.php


示例11: setup_nav

 /**
  * Set up navigation
  *
  * @since 1.3
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Add 'Example' to the main navigation
     $main_nav = array('name' => __('Projects', 'collabpress'), 'slug' => $this->slug, 'position' => 44, 'screen_function' => array($this, 'template_loader'), 'default_subnav_slug' => 'tasks', 'show_for_displayed_user' => array($this, 'show_tab_for_current_user'));
     $projects_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
     // Add a few subnav items under the main Example tab
     $sub_nav[] = array('name' => bp_is_my_profile() ? __('My Tasks', 'collabpress') : sprintf(__('%s&#8217s Tasks', 'collabpress'), bp_get_user_firstname()), 'slug' => 'tasks', 'parent_url' => $projects_link, 'parent_slug' => $this->slug, 'screen_function' => array($this, 'template_loader'), 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:clarkewd,项目名称:CollabPress,代码行数:14,代码来源:cp-bp.php


示例12: setup_nav

 public function setup_nav($main = array(), $sub = array())
 {
     $bp = buddypress();
     $component = 'members';
     $component_id = mpp_get_current_component_id();
     if (!mpp_is_enabled($component, $component_id)) {
         //allow to disable user galleries in case they don't want it
         return false;
     }
     $view_helper = MPP_Gallery_Screens::get_instance();
     // Add 'Gallery' to the user's main navigation
     $main_nav = array('name' => sprintf(__('Gallery <span>%d</span>', 'mediapress'), mpp_get_total_gallery_for_user()), 'slug' => $this->slug, 'position' => 86, 'screen_function' => array($view_helper, 'user_galleries'), 'default_subnav_slug' => 'my-galleries', 'item_css_id' => $this->id);
     if (bp_is_user()) {
         $user_domain = bp_displayed_user_domain();
     } else {
         $user_domain = bp_loggedin_user_domain();
     }
     $gallery_link = trailingslashit($user_domain . $this->slug);
     //with a trailing slash
     // Add the My Gallery nav item
     $sub_nav[] = array('name' => __('My Gallery', 'mediapress'), 'slug' => 'my-galleries', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 10, 'item_css_id' => 'gallery-my-gallery');
     if (mpp_user_can_create_gallery($component, get_current_user_id())) {
         // Add the Create gallery link to gallery nav
         $sub_nav[] = array('name' => __('Create a Gallery', 'mediapress'), 'slug' => 'create', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'user_has_access' => bp_is_my_profile(), 'position' => 20);
     }
     if (mpp_component_has_type_filters_enabled($component, $component_id)) {
         $i = 10;
         $supported_types = mpp_component_get_supported_types($component);
         foreach ($supported_types as $type) {
             if (!mpp_is_active_type($type)) {
                 continue;
             }
             $type_object = mpp_get_type_object($type);
             $sub_nav[] = array('name' => $type_object->label, 'slug' => 'type/' . $type, 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 20 + $i);
             $i = $i + 10;
             //increment the position
         }
     }
     // Add the Upload link to gallery nav
     /*$sub_nav[] = array(
           'name'				=> __( 'Upload', 'mediapress'),
           'slug'				=> 'upload',
           'parent_url'		=> $gallery_link,
           'parent_slug'		=> $this->slug,
           'screen_function'	=> array( $view_helper, 'upload_media' ),
           'user_has_access'	=> bp_is_my_profile(),
           'position'			=> 30
       );*/
     parent::setup_nav($main_nav, $sub_nav);
     //disallow these names in various lists
     //we have yet to implement it
     $this->forbidden_names = apply_filters('mpp_forbidden_names', array('gallery', 'galleries', 'my-gallery', 'create', 'delete', 'upload', 'add', 'edit', 'admin', 'request', 'upload', 'tags', 'audio', 'video', 'photo'));
     //use this to extend the valid status
     $this->valid_status = apply_filters('mpp_valid_gallery_status', array_keys(mpp_get_active_statuses()));
     do_action('mpp_setup_nav');
     // $bp->gallery->current_gallery->user_has_access
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:57,代码来源:mpp-bp-component.php


示例13: mexp_gdrive_get_user_profile_url

/**
 * Get user profile URL to add our Google Drive options.
 *
 * If BuddyPress is enabled and the BP Settings component is enabled, we'll
 * use the user settings URL.  Otherwise, we'll use the admin dashboard
 * profile link from the main site.
 *
 * @return string
 */
function mexp_gdrive_get_user_profile_url()
{
    if (function_exists('buddypress') && bp_is_active('settings')) {
        $url = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug());
    } else {
        $url = get_admin_url($GLOBALS['current_site']->blog_id, 'profile.php');
    }
    return apply_filters('mexp_gdrive_get_user_profile_url', $url . '#gauth');
}
开发者ID:hwdsbcommons,项目名称:gdrive,代码行数:18,代码来源:functions.php


示例14: setup_settings_privacy_nav

 public function setup_settings_privacy_nav($wp_admin_nav)
 {
     // Setup the logged in user variables
     if (is_rtmedia_privacy_user_overide()) {
         $settings_link = trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug());
         // Add the "Profile" subnav item
         $wp_admin_nav[] = array('parent' => 'my-account-' . buddypress()->settings->id, 'id' => 'my-account-' . buddypress()->settings->id . '-privacy', 'title' => _x('Privacy', 'My Account Privacy sub nav', 'rtmedia'), 'href' => trailingslashit($settings_link . 'privacy'));
     }
     return $wp_admin_nav;
 }
开发者ID:saisai,项目名称:rtMedia,代码行数:10,代码来源:RTMediaNav.php


示例15: bp_links_dtheme_activity_type_tabs_setup

function bp_links_dtheme_activity_type_tabs_setup()
{
    global $bp;
    if (!bp_links_is_default_theme()) {
        return false;
    }
    if (is_user_logged_in() && bp_links_total_links_for_user(bp_loggedin_user_id())) {
        echo sprintf('<li id="activity-links"><a href="%s" title="%s">%s</a></li>', bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . bp_links_slug() . '/', __('The activity of links I created.', 'buddypress-links'), __('My Links', 'buddypress-links') . sprintf(' <span>%s</span>', bp_links_total_links_for_user(bp_loggedin_user_id())));
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:10,代码来源:bp-links-dtheme.php


示例16: add_videos_subnav_tab

function add_videos_subnav_tab()
{
    global $bp;
    bp_core_new_subnav_item(array('name' => 'Posts', 'slug' => 'posts', 'parent_url' => trailingslashit(bp_loggedin_user_domain() . 'favorites'), 'parent_slug' => 'favorites', 'screen_function' => 'profile_screen_posts', 'position' => 10));
    bp_core_new_subnav_item(array('name' => 'Articles', 'slug' => 'articles', 'parent_url' => trailingslashit(bp_loggedin_user_domain() . 'favorites'), 'parent_slug' => 'favorites', 'screen_function' => 'profile_screen_articles', 'position' => 20));
    $bp->bp_nav['profile']['name'] = 'About Me';
    $bp->bp_nav['buddyblog']['name'] = 'Published Articles';
    $bp->bp_nav['friends']['name'] = 'Soul Family';
    $bp->bp_nav['friends']['position'] = 20;
}
开发者ID:poweronio,项目名称:mbsite,代码行数:10,代码来源:poweron.php


示例17: widget

 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     // set widget title when logged out
     if (!is_user_logged_in()) {
         $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
         if (!empty($title)) {
             echo $before_title . $title . $after_title;
         }
     }
     // start widget display code
     if (function_exists('bp_is_active')) {
         // check is user is logged in
         if (is_user_logged_in()) {
             echo "<div id='sidebarme'>";
             echo "<a href='" . bp_loggedin_user_domain() . "'>";
             echo bp_loggedin_user_avatar('type=thumb');
             echo "</a>";
             echo "<ul class='sidebarme-quicklinks'>";
             echo "<li class='sidebarme-username'>" . bp_core_get_userlink(bp_loggedin_user_id()) . "</li>";
             echo "<li class='sidebarme-profile'>";
             echo "<a href='" . bp_loggedin_user_domain() . "profile/edit'>" . __('Edit Profile', 'boss') . "</a>";
             echo " &middot; ";
             echo wp_loginout();
             echo "</li>";
             echo "</ul>";
             echo "</div>";
             // check if user is logged out
         } else {
             echo "<form name='login-form' id='sidebar-login-form' class='standard-form' action='" . site_url('wp-login.php', 'login_post') . "' method='post'>";
             echo "<label>" . __('Username', 'boss') . "</label>";
             $return = isset($_POST['value']) ? $_POST['value'] : '';
             $return .= "<input type='text' name='log' id='sidebar-user-login' class='input' value='";
             if (isset($user_login)) {
                 $return .= esc_attr(stripslashes($user_login));
             }
             $return .= "' tabindex='97' />";
             echo $return;
             echo "<label>" . __('Password', 'boss') . "</label>";
             echo "<input type='password' name='pwd' id='sidebar-user-pass' class='input' value='' tabindex='98' />";
             echo "<p class='forgetmenot'><input name='rememberme' type='checkbox' id='sidebar-rememberme' value='forever' tabindex='99' /> " . __('Remember Me', 'boss') . "</p>";
             echo do_action('bp_sidebar_login_form');
             echo "<input type='submit' name='wp-submit' id='sidebar-wp-submit' value='" . __('Log In', 'boss') . "' tabindex='100' />";
             if (bp_get_signup_allowed()) {
                 echo " <a class='sidebar-wp-register' href='" . bp_get_signup_page() . "'>" . __('Register', 'boss') . "</a>";
             }
             echo "</form>";
         }
     }
     // end widget display code
     echo $after_widget;
 }
开发者ID:tvolmari,项目名称:hammydowns,代码行数:53,代码来源:buddyboss-profile-widget-loader.php


示例18: bp_core_new_nav_item

/**
 * Add an item to the main BuddyPress navigation array.
 *
 * @global BuddyPress $bp The one true BuddyPress instance.
 *
 * @param array $args {
 *     Array describing the new nav item.
 *     @type string $name Display name for the nav item.
 *     @type string $slug Unique URL slug for the nav item.
 *     @type bool|string $item_css_id Optional. 'id' attribute for the nav
 *           item. Default: the value of $slug.
 *     @type bool $show_for_displayed_user Optional. Whether the nav item
 *           should be visible when viewing a member profile other than your
 *           own. Default: true.
 *     @type bool $site_admin_only Optional. Whether the nav item should be
 *           visible only to site admins (those with the 'bp_moderate' cap).
 *           Default: false.
 *     @type int $position Optional. Numerical index specifying where the item
 *           should appear in the nav array. Default: 99.
 *     @type callable $screen_function The callback function that will run
 *           when the nav item is clicked.
 *     @type bool|string $default_subnav_slug Optional. The slug of the default
 *           subnav item to select when the nav item is clicked.
 * }
 * @return bool|null Returns false on failure.
 */
function bp_core_new_nav_item($args = '')
{
    global $bp;
    $defaults = array('name' => false, 'slug' => false, 'item_css_id' => false, 'show_for_displayed_user' => true, 'site_admin_only' => false, 'position' => 99, 'screen_function' => false, 'default_subnav_slug' => false);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    // If we don't have the required info we need, don't create this subnav item
    if (empty($name) || empty($slug)) {
        return false;
    }
    // If this is for site admins only and the user is not one, don't create the subnav item
    if (!empty($site_admin_only) && !bp_current_user_can('bp_moderate')) {
        return false;
    }
    if (empty($item_css_id)) {
        $item_css_id = $slug;
    }
    $bp->bp_nav[$slug] = array('name' => $name, 'slug' => $slug, 'link' => trailingslashit(bp_loggedin_user_domain() . $slug), 'css_id' => $item_css_id, 'show_for_displayed_user' => $show_for_displayed_user, 'position' => $position, 'screen_function' => &$screen_function, 'default_subnav_slug' => $default_subnav_slug);
    /**
     * If this nav item is hidden for the displayed user, and
     * the logged in user is not the displayed user
     * looking at their own profile, don't create the nav item.
     */
    if (empty($show_for_displayed_user) && !bp_user_has_access()) {
        return false;
    }
    /**
     * If the nav item is visible, we are not viewing a user, and this is a root
     * component, don't attach the default subnav function so we can display a
     * directory or something else.
     */
    if (-1 != $position && bp_is_root_component($slug) && !bp_displayed_user_id()) {
        return;
    }
    // Look for current component
    if (bp_is_current_component($slug) || bp_is_current_item($slug)) {
        // The requested URL has explicitly included the default subnav
        // (eg: http://example.com/members/membername/activity/just-me/)
        // The canonical version will not contain this subnav slug.
        if (!empty($default_subnav_slug) && bp_is_current_action($default_subnav_slug) && !bp_action_variable(0)) {
            unset($bp->canonical_stack['action']);
        } elseif (!bp_current_action()) {
            // Add our screen hook if screen function is callable
            if (is_callable($screen_function)) {
                add_action('bp_screens', $screen_function, 3);
            }
            if (!empty($default_subnav_slug)) {
                $bp->current_action = apply_filters('bp_default_component_subnav', $default_subnav_slug, $r);
            }
        }
    }
    do_action('bp_core_new_nav_item', $r, $args, $defaults);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:79,代码来源:bp-core-buddybar.php


示例19: kleo_menu_notifications

function kleo_menu_notifications($item_output, $item, $depth, $args)
{
    global $kleo_config;
    $output = '';
    $url = bp_loggedin_user_domain() . BP_NOTIFICATIONS_SLUG;
    $notifications = bp_notifications_get_notifications_for_user(bp_loggedin_user_id(), 'object');
    $count = !empty($notifications) ? count($notifications) : 0;
    if ($count > 0) {
        $alert = 'new-alert';
        $status = ' has-notif';
    } else {
        $alert = 'no-alert';
        $status = '';
    }
    $attr_title = strip_tags($item->attr_title);
    if (isset($item->icon) && $item->icon != '') {
        $kleo_config['mobile_notify_icon'] = $item->icon;
        $title_icon = '<i class="icon-' . $item->icon . '"></i>';
        if ($item->iconpos == 'after') {
            $title = $item->title . ' ' . $title_icon;
        } elseif ($item->iconpos == 'icon') {
            $title = $title_icon;
        } else {
            $title = $title_icon . ' ' . $item->title;
        }
        //If we have the menu item then add it to the mobile menu
        add_action('kleo_mobile_header_icons', 'kleo_bp_mobile_notify', 9);
    } else {
        $title = $item->title;
    }
    $output .= '<a class="notify-contents" href="' . $url . '" title="' . $attr_title . '">' . '<span class="notify-items"> ' . $title . ' <span class="kleo-notifications ' . $alert . '">' . $count . '</span></span>' . '</a>';
    $output .= '<div class="kleo-toggle-submenu"><ul class="submenu-inner' . $status . '">';
    if (!empty($notifications)) {
        foreach ((array) $notifications as $notification) {
            $output .= '<li class="kleo-submenu-item" id="kleo-notification-' . $notification->id . '">';
            $output .= '<a href="' . $notification->href . '">' . $notification->content . '</a>';
            //$output .= '<a data-id="' . $notification->id . '" title="' . __( 'Mark as read', 'kleo_framework' ) . '" class="remove" href="#">×</a>';
            $output .= '</li>';
        }
    } else {
        $output .= '<li class="kleo-submenu-item">' . __('No new notifications', 'kleo_framework') . '</li>';
    }
    $output .= '</ul>';
    if (!empty($notifications)) {
        $style = '';
    } else {
        $style = ' style="display: none;"';
    }
    $output .= '<div class="minicart-buttons text-center"' . $style . '><a class="btn btn-default mark-as-read" href="#">' . __('Mark all as read', 'kleo_framework') . '</a></div>';
    $output .= '</div>';
    return $output;
}
开发者ID:quyip8818,项目名称:wps,代码行数:52,代码来源:menu-notifications.php


示例20: setup_nav

 /**
  * Set the component's navigation 
  */
 public function setup_nav()
 {
     // Main navigation
     $main_nav = array('name' => sprintf(__('Projects <span>%s</span>', 'bp-portfolio'), bp_portfolio_get_user_projects_count(bp_displayed_user_id())), 'slug' => bp_get_portfolio_slug(), 'position' => 80, 'screen_function' => 'bp_portfolio_screen_personal', 'default_subnav_slug' => 'personal');
     $portfolio_link = trailingslashit(bp_loggedin_user_domain() . bp_get_portfolio_slug());
     // Add a few subnav items under the main Portfolio tab
     $sub_nav[] = array('name' => __('Personal', 'bp-portfolio'), 'slug' => 'personal', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_personal', 'position' => 10);
     if (bp_displayed_user_id() == bp_loggedin_user_id()) {
         // Add a few subnav items under the main Portfolio tab
         $sub_nav[] = array('name' => __('Add', 'bp-portfolio'), 'slug' => 'add', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_add', 'position' => 20);
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
开发者ID:ncrocfer,项目名称:BP-Portfolio,代码行数:16,代码来源:bp-portfolio-loader.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_loggedin_user_fullname函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_loggedin_user_avatar函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap