Esempio n. 1
0
 function admin_nav()
 {
     global $wp_admin_bar;
     global $rtmedia;
     if (!isset($rtmedia->options['buddypress_enableOnProfile']) || isset($rtmedia->options['buddypress_enableOnProfile']) && $rtmedia->options['buddypress_enableOnProfile'] == '0') {
         return;
     }
     if (function_exists("bp_use_wp_admin_bar") && !bp_use_wp_admin_bar()) {
         return;
     }
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Only add menu for logged in user
     if (is_user_logged_in()) {
         // Add secondary parent item for all BuddyPress components
         $wp_admin_bar->add_menu(array('parent' => 'my-account', 'id' => 'my-account-' . RTMEDIA_MEDIA_SLUG, 'title' => RTMEDIA_MEDIA_LABEL, 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/'));
         if (is_rtmedia_album_enable()) {
             $wp_admin_bar->add_menu(array('parent' => 'my-account-' . RTMEDIA_MEDIA_SLUG, 'id' => 'my-account-media-' . RTMEDIA_ALBUM_SLUG, 'title' => RTMEDIA_ALBUM_PLURAL_LABEL, 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/album/'));
         }
         global $rtmedia;
         foreach ($rtmedia->allowed_types as $type) {
             if (isset($rtmedia->options['allowedTypes_' . $type['name'] . '_enabled'])) {
                 if (!$rtmedia->options['allowedTypes_' . $type['name'] . '_enabled']) {
                     continue;
                 }
                 $name = strtoupper($type['name']);
                 $wp_admin_bar->add_menu(array('parent' => 'my-account-' . constant('RTMEDIA_MEDIA_SLUG'), 'id' => 'my-account-media-' . constant('RTMEDIA_' . $name . '_SLUG'), 'title' => $type['plural_label'], 'href' => trailingslashit(get_rtmedia_user_link(get_current_user_id())) . RTMEDIA_MEDIA_SLUG . '/' . constant('RTMEDIA_' . $name . '_SLUG') . '/'));
             }
         }
     }
 }
Esempio n. 2
0
/**
 * Setup profile / BuddyBar navigation.
 *
 * This function was moved from {@link BP_Follow_Component} in v1.3.0 due
 * to the users module being toggleable.
 *
 * @since 1.3.0
 */
function bp_follow_user_setup_nav($main_nav = array(), $sub_nav = array())
{
    global $bp;
    // If we're in the admin area and we're using the WP toolbar, we don't need
    // to run the rest of this method
    if (defined('WP_NETWORK_ADMIN') && bp_use_wp_admin_bar()) {
        return;
    }
    // Need to change the user ID, so if we're not on a member page, $counts variable is still calculated
    $user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
    $counts = bp_follow_total_follow_counts(array('user_id' => $user_id));
    // BuddyBar compatibility
    $domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
    /** FOLLOWERS NAV ************************************************/
    bp_core_new_nav_item(array('name' => sprintf(__('Following <span>%d</span>', 'bp-follow'), $counts['following']), 'slug' => $bp->follow->following->slug, 'position' => $bp->follow->params['adminbar_myaccount_order'], 'screen_function' => 'bp_follow_screen_following', 'default_subnav_slug' => 'following', 'item_css_id' => 'members-following'));
    /** FOLLOWING NAV ************************************************/
    bp_core_new_nav_item(array('name' => sprintf(__('Followers <span>%d</span>', 'bp-follow'), $counts['followers']), 'slug' => $bp->follow->followers->slug, 'position' => apply_filters('bp_follow_followers_nav_position', 62), 'screen_function' => 'bp_follow_screen_followers', 'default_subnav_slug' => 'followers', 'item_css_id' => 'members-followers'));
    /** ACTIVITY SUBNAV **********************************************/
    // Add activity sub nav item
    if (bp_is_active('activity') && apply_filters('bp_follow_show_activity_subnav', true)) {
        bp_core_new_subnav_item(array('name' => _x('Following', 'Activity subnav tab', 'bp-follow'), 'slug' => constant('BP_FOLLOWING_SLUG'), 'parent_url' => trailingslashit($domain . bp_get_activity_slug()), 'parent_slug' => bp_get_activity_slug(), 'screen_function' => 'bp_follow_screen_activity_following', 'position' => 21, 'item_css_id' => 'activity-following'));
    }
    // BuddyBar compatibility
    add_action('bp_adminbar_menus', 'bp_follow_group_buddybar_items');
}
 function alt_bp_change_settings_default()
 {
     global $bp;
     $args = array('parent_slug' => 'settings', 'screen_function' => 'bp_core_screen_notification_settings', 'subnav_slug' => 'notifications');
     bp_core_new_nav_default($args);
     if (bp_use_wp_admin_bar()) {
         add_action('wp_before_admin_bar_render', create_function('', 'global $wp_admin_bar; $wp_admin_bar->remove_menu( "my-account-settings-general" );'));
     }
 }
Esempio n. 4
0
 function __construct($tp_active = false)
 {
     global $current_blog, $gsm_simple_menu;
     $this->home = !is_multisite() || defined('BP_ENABLE_MULTIBLOG') || $current_blog->blog_id == BP_ROOT_BLOG;
     $this->adminbar = !(bp_use_wp_admin_bar() || defined('BP_DISABLE_ADMIN_BAR') || get_site_option('hide-loggedout-adminbar') && !is_user_logged_in());
     $this->stylesheet = get_option('stylesheet');
     $this->settings = get_option($this->settings_key);
     if (!($this->style = genesis_get_option('style_selection'))) {
         $this->style = 'style.css';
     }
     if ($this->simple_menu = !empty($gsm_simple_menu)) {
         $this->custom_subnav =& $gsm_simple_menu;
     }
     do_action('gconnect_before_init');
     if (is_admin()) {
         require_once GENESISCONNECT_DIR . 'lib/class.options.php';
         $this->admin = new GConnect_Admin($this, $tp_active);
     } else {
         require_once GENESISCONNECT_DIR . 'lib/class.front.php';
         $this->front = new GConnect_Front($this, $tp_active);
         if (!$tp_active && !is_user_logged_in() && $this->home) {
             $custom_register = $this->get_option('custom_register');
             if ($custom_register && 'none' != $custom_register) {
                 require_once GENESISCONNECT_DIR . 'lib/class.visitor.php';
                 $this->front->set_visitor(new GConnect_visitor($this, $custom_register));
             } elseif (is_multisite()) {
                 add_action('wp', array(&$this, 'bp_core_wpsignup_redirect'));
             } else {
                 add_action('init', array(&$this, 'bp_core_wpsignup_redirect'));
             }
         }
     }
     if ('widget' == $this->get_option('before_content')) {
         genesis_register_sidebar(array('name' => 'Before BuddyPress', 'description' => __('This is above the BuddyPress content', 'genesis-connect'), 'id' => 'gconnect-before'));
     }
     if (is_dir(GENESISCONNECT_DIR . 'child-theme/' . $this->stylesheet)) {
         $addon_directory = GENESISCONNECT_DIR . 'child-theme/' . $this->stylesheet;
         $addon_functions = $addon_directory . '/my-functions.php';
         if (is_file($addon_functions)) {
             require_once $addon_functions;
         }
         if (!is_admin()) {
             $this->front->set_addon($addon_directory, GENESISCONNECT_URL . 'child-theme/' . $this->stylesheet);
         }
     } elseif (!is_admin()) {
         $this->front->set_addon(get_stylesheet_directory(), get_stylesheet_directory_uri());
     }
     do_action('gconnect_after_init');
 }
/**
 * Handle the Toolbar CSS.
 *
 * @since BuddyPress (1.5.0)
 */
function bp_core_load_admin_bar_css()
{
    global $wp_styles;
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    // Toolbar styles
    $stylesheet = buddypress()->plugin_url . "bp-core/css/admin-bar{$min}.css";
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), bp_get_version());
    $wp_styles->add_data('bp-admin-bar', 'rtl', true);
    if ($min) {
        $wp_styles->add_data('bp-admin-bar', 'suffix', $min);
    }
}
Esempio n. 6
0
/**
 * Handle the Toolbar CSS
 *
 * @since BuddyPress 1.5
 */
function bp_core_load_admin_bar_css()
{
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    // Toolbar styles
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), bp_get_version());
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . 'bp-core/css/admin-bar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_admin_bar_rtl_css', $stylesheet), array('bp-admin-bar'), bp_get_version());
}
Esempio n. 7
0
/**
 * Handle the Admin Bar CSS
 *
 * @since BuddyPress 1.5
 */
function bp_core_load_admin_bar_css()
{
    $version = '2011116';
    if (!bp_use_wp_admin_bar() || defined('DOING_AJAX')) {
        return;
    }
    // Admin bar styles
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array('admin-bar'), $version);
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/admin-bar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_admin_bar_rtl_css', $stylesheet), array('bp-admin-bar'), $version);
}
 /**
  * Setup the Toolbar
  *
  * @global obj $wp_admin_bar
  * @param array $wp_admin_menus
  */
 function setup_admin_bar($wp_admin_nav = '')
 {
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Set this objects menus
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global
         global $wp_admin_bar;
         // Add each admin menu
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     // Call action
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
Esempio n. 9
0
File: 2.1.php Progetto: eresyyl/mk
/**
 * Enqueue the BuddyBar CSS.
 *
 * @deprecated BuddyPress (2.1.0)
 */
function bp_core_load_buddybar_css()
{
    if (bp_use_wp_admin_bar() || (int) bp_get_option('hide-loggedout-adminbar') && !is_user_logged_in() || defined('BP_DISABLE_ADMIN_BAR') && BP_DISABLE_ADMIN_BAR) {
        return;
    }
    $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    if (file_exists(get_stylesheet_directory() . '/_inc/css/adminbar.css')) {
        // Backwards compatibility
        $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';
    } else {
        $stylesheet = buddypress()->plugin_url . "bp-core/css/buddybar{$min}.css";
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_buddybar_rtl_css', $stylesheet), array(), bp_get_version());
    wp_style_add_data('bp-admin-bar', 'rtl', true);
    if ($min) {
        wp_style_add_data('bp-admin-bar', 'suffix', $min);
    }
}
Esempio n. 10
0
/**
 * Fire the 'bp_setup_admin_bar' action, where plugins should add items to the WP admin bar.
 */
function bp_setup_admin_bar()
{
    if (bp_use_wp_admin_bar()) {
        do_action('bp_setup_admin_bar');
    }
}
 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @since 1.5.0
  *
  * @see WP_Admin_Bar::add_menu() for a description of the syntax
  *      required by each item in the $wp_admin_nav parameter array.
  * @global object $wp_admin_bar
  *
  * @param array $wp_admin_nav An array of nav item arguments. Each item in this parameter
  *                            array is passed to {@link WP_Admin_Bar::add_menu()}.
  *                            See that method for a description of the required syntax for
  *                            each item.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Bail if this is an ajax request.
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false.
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     /**
      * Filters the admin navigation passed into setup_admin_bar.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since 1.9.0
      *
      * @param array $wp_admin_nav Array of navigation items to add.
      */
     $wp_admin_nav = apply_filters('bp_' . $this->id . '_admin_nav', $wp_admin_nav);
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Fill in position if one wasn't passed for backpat.
         $pos = 0;
         $not_set_pos = 1;
         foreach ($wp_admin_nav as $key => $nav) {
             if (!isset($nav['position'])) {
                 $wp_admin_nav[$key]['position'] = $pos + $not_set_pos;
                 if (9 !== $not_set_pos) {
                     ++$not_set_pos;
                 }
             } else {
                 $pos = $nav['position'];
                 // Reset not set pos to 1
                 if ($pos % 10 === 0) {
                     $not_set_pos = 1;
                 }
             }
         }
         // Sort admin nav by position.
         $wp_admin_nav = bp_sort_by_key($wp_admin_nav, 'position', 'num');
         // Set this objects menus.
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global.
         global $wp_admin_bar;
         // Add each admin menu.
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     /**
      * Fires at the end of the setup_admin_bar method inside BP_Component.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since 1.5.0
      */
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
Esempio n. 12
0
/**
 * Fire the 'bp_setup_admin_bar' action, where plugins should add items to the WP admin bar.
 */
function bp_setup_admin_bar()
{
    if (bp_use_wp_admin_bar()) {
        /**
         * Fires inside the 'bp_setup_admin_bar' function, where plugins should add items to the WP admin bar.
         *
         * This hook will only fire if bp_use_wp_admin_bar() returns true.
         *
         * @since BuddyPress (1.5.0)
         */
        do_action('bp_setup_admin_bar');
    }
}
Esempio n. 13
0
/**
 * Enqueue supplemental WordPress Toolbar styling
 *
 * @since BuddyPress (2.1.0)
 *
 * @see bp_core_register_common_styles()
 * @see bp_core_load_admin_bar_css()
 */
function bp_core_enqueue_admin_bar_css()
{
    // Bail if not using WordPress's admin bar or it's not showing on this
    // page request.
    if (!bp_use_wp_admin_bar() || !is_admin_bar_showing()) {
        return;
    }
    // Enqueue the additional adminbar css
    wp_enqueue_style('bp-admin-bar');
}
Esempio n. 14
0
 /**
  * Set up the component entries in the WordPress Admin Bar.
  *
  * @see WP_Admin_Bar::add_menu() for a description of the syntax
  *      required by each item in the $wp_admin_nav parameter array.
  * @global obj $wp_admin_bar
  *
  * @param array $wp_admin_nav An array of nav item arguments. Each item
  *        in this parameter array is passed to {@link WP_Admin_Bar::add_menu()}.
  *        See that method for a description of the required syntax for
  *        each item.
  */
 public function setup_admin_bar($wp_admin_nav = array())
 {
     // Bail if this is an ajax request
     if (defined('DOING_AJAX')) {
         return;
     }
     // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
     if (!bp_use_wp_admin_bar()) {
         return;
     }
     /**
      * Filters the admin navigation passed into setup_admin_bar.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since BuddyPress (1.9.0)
      *
      * @param array $wp_admin_nav Array of navigation items to add.
      */
     $wp_admin_nav = apply_filters('bp_' . $this->id . '_admin_nav', $wp_admin_nav);
     // Do we have Toolbar menus to add?
     if (!empty($wp_admin_nav)) {
         // Set this objects menus
         $this->admin_menu = $wp_admin_nav;
         // Define the WordPress global
         global $wp_admin_bar;
         // Add each admin menu
         foreach ($this->admin_menu as $admin_menu) {
             $wp_admin_bar->add_menu($admin_menu);
         }
     }
     /**
      * Fires at the end of the setup_admin_bar method inside BP_Component.
      *
      * This is a dynamic hook that is based on the component string ID.
      *
      * @since BuddyPress (1.5.0)
      */
     do_action('bp_' . $this->id . '_setup_admin_bar');
 }
/**
 * Hide Notification subnav item and menu element and all acces
 * to notifications settings page if bp_notifications_manager_disabled is yes
 */
function bp_notifications_manager_subnav()
{
    if (get_option('bp_notifications_manager_disabled') == 'yes') {
        global $bp;
        // if current user is not admin
        //if( !is_site_admin() ){ // this work only for bp 1.6 ( so i use  !current_user_can('manage_options') to check if is admin user)
        if (!current_user_can('manage_options')) {
            bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
            //bp_core_remove_nav_item( $bp->settings->slug, 'notifications' );
            // //remove notifcation subnav item and notification link for adminbar
            //bp_core_remove_subnav_item($bp->settings->slug, 'notifications');
            //remove_action( 'bp_adminbar_menus', 'bp_adminbar_notifications_menu', 8 );
            // remove notification setting link from wp adminbar if is bp use it
            if (bp_use_wp_admin_bar()) {
                $bp->temp_slug = $slug;
                add_action('wp_before_admin_bar_render', create_function('', 'global $bp, $wp_admin_bar; $wp_admin_bar->remove_menu( "my-account-settings-notifications" );'));
            }
        }
    }
}
Esempio n. 16
0
/**
 * Handle the BuddyBar CSS
 */
function bp_core_load_buddybar_css()
{
    if (bp_use_wp_admin_bar() || (int) bp_get_option('hide-loggedout-adminbar') && !is_user_logged_in() || defined('BP_DISABLE_ADMIN_BAR') && BP_DISABLE_ADMIN_BAR) {
        return;
    }
    if (file_exists(get_stylesheet_directory() . '/_inc/css/adminbar.css')) {
        // Backwards compatibility
        $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';
    } elseif (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar.css';
    }
    wp_enqueue_style('bp-admin-bar', apply_filters('bp_core_admin_bar_css', $stylesheet), array(), '20110723');
    if (!is_rtl()) {
        return;
    }
    if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar-rtl.dev.css';
    } else {
        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar-rtl.css';
    }
    wp_enqueue_style('bp-admin-bar-rtl', apply_filters('bp_core_buddybar_rtl_css', $stylesheet), array('bp-admin-bar'), '20110723');
}