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" );'));
     }
 }
예제 #2
0
function bfox_bp_plans_screen_plan_setup_nav(BfoxReadingPlan $plan)
{
    global $bp;
    bfox_bp_plan($plan);
    $slug = BFOX_PLANS_SLUG;
    $plans_link = $plan->url();
    bp_core_new_nav_item(array('name' => __('Reading Plans', 'bfox'), 'slug' => $slug, 'position' => 70, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'default_subnav_slug' => 'overview', 'item_css_id' => $slug));
    bp_core_new_nav_default(array('parent_slug' => $slug, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'subnav_slug' => 'overview'));
    bp_core_new_subnav_item(array('name' => __('Overview', 'bp-plan'), 'slug' => 'overview', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130));
    bp_core_new_subnav_item(array('name' => __('Edit Settings', 'bp-plan'), 'slug' => 'edit-details', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130, 'user_has_access' => $plan->is_user_owner()));
    bp_core_new_subnav_item(array('name' => __('Edit Readings', 'bp-plan'), 'slug' => 'edit-readings', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130, 'user_has_access' => $plan->is_user_owner()));
    bp_core_new_subnav_item(array('name' => __('Edit Avatar', 'bp-plan'), 'slug' => 'avatar', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130, 'user_has_access' => $plan->is_user_owner()));
    bp_core_new_subnav_item(array('name' => __('Schedules', 'bp-plan'), 'slug' => 'schedules', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_schedules', 'position' => 130));
    bp_core_new_subnav_item(array('name' => __('Add to Schedule', 'bp-plan'), 'slug' => 'add-schedule', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_add_schedule', 'position' => 130));
    if ($slug == $bp->current_component && 'copy' == $bp->current_action) {
        bp_core_new_subnav_item(array('name' => __('Copy', 'bp-plan'), 'slug' => 'copy', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130));
    }
    if ($slug == $bp->current_component && 'delete' == $bp->current_action) {
        bp_core_new_subnav_item(array('name' => __('Delete', 'bp-plan'), 'slug' => 'delete', 'parent_slug' => $slug, 'parent_url' => $plans_link, 'screen_function' => 'bfox_bp_plans_screen_plan_view', 'position' => 130));
    }
}
예제 #3
0
파일: bp-groups.php 프로젝트: n-sane/zaroka
function groups_setup_nav() {
	global $bp;

	if ( $bp->current_component == $bp->groups->slug && $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {

		/* This is a single group page. */
		$bp->is_single_item = true;
		$bp->groups->current_group = new BP_Groups_Group( $group_id );

		/* Using "item" not "group" for generic support in other components. */
		if ( is_super_admin() )
			$bp->is_item_admin = 1;
		else
			$bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $bp->groups->current_group->id );

		/* If the user is not an admin, check if they are a moderator */
		if ( !$bp->is_item_admin )
			$bp->is_item_mod = groups_is_user_mod( $bp->loggedin_user->id, $bp->groups->current_group->id );

		/* Is the logged in user a member of the group? */
		$bp->groups->current_group->is_user_member = ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) ? true : false;

		/* Should this group be visible to the logged in user? */
		$bp->groups->current_group->is_group_visible_to_member = ( 'public' == $bp->groups->current_group->status || $is_member ) ? true : false;
	}

	/* Add 'Groups' to the main navigation */
	bp_core_new_nav_item( array( 'name' => sprintf( __( 'Groups <span>(%d)</span>', 'buddypress' ), groups_total_groups_for_user() ), 'slug' => $bp->groups->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $bp->groups->id ) );

	$groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';

	/* Add the subnav items to the groups nav item */
	bp_core_new_subnav_item( array( 'name' => __( 'My Groups', 'buddypress' ), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups' ) );
	bp_core_new_subnav_item( array( 'name' => __( 'Invites', 'buddypress' ), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invites', 'position' => 30, 'user_has_access' => bp_is_my_profile() ) );

	if ( $bp->current_component == $bp->groups->slug ) {

		if ( bp_is_my_profile() && !$bp->is_single_item ) {

			$bp->bp_options_title = __( 'My Groups', 'buddypress' );

		} else if ( !bp_is_my_profile() && !$bp->is_single_item ) {

			$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->displayed_user->id, 'type' => 'thumb' ) );
			$bp->bp_options_title = $bp->displayed_user->fullname;

		} else if ( $bp->is_single_item ) {
			// We are viewing a single group, so set up the
			// group navigation menu using the $bp->groups->current_group global.

			/* When in a single group, the first action is bumped down one because of the
			   group name, so we need to adjust this and set the group name to current_item. */
			$bp->current_item = $bp->current_action;
			$bp->current_action = $bp->action_variables[0];
			array_shift($bp->action_variables);

			$bp->bp_options_title = $bp->groups->current_group->name;

			if ( !$bp->bp_options_avatar = bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __( 'Group Avatar', 'buddypress' ) ) ) )
				$bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />';

			$group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';

			// If this is a private or hidden group, does the user have access?
			if ( 'private' == $bp->groups->current_group->status || 'hidden' == $bp->groups->current_group->status ) {
				if ( $bp->groups->current_group->is_user_member && is_user_logged_in() || is_super_admin() )
					$bp->groups->current_group->user_has_access = true;
				else
					$bp->groups->current_group->user_has_access = false;
			} else {
				$bp->groups->current_group->user_has_access = true;
			}

			/* Reset the existing subnav items */
			bp_core_reset_subnav_items($bp->groups->slug);

			/* Add a new default subnav item for when the groups nav is selected. */
			bp_core_new_nav_default( array( 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_home', 'subnav_slug' => 'home' ) );

			/* Add the "Home" subnav item, as this will always be present */
			bp_core_new_subnav_item( array( 'name' => __( 'Home', 'buddypress' ), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home' ) );

			/* If the user is a group mod or more, then show the group admin nav item */
			if ( $bp->is_item_mod || $bp->is_item_admin )
				bp_core_new_subnav_item( array( 'name' => __( 'Admin', 'buddypress' ), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 20, 'user_has_access' => ( $bp->is_item_admin + (int)$bp->is_item_mod ), 'item_css_id' => 'admin' ) );

			// If this is a private group, and the user is not a member, show a "Request Membership" nav item.
			if ( !is_super_admin() && is_user_logged_in() && !$bp->groups->current_group->is_user_member && !groups_check_for_membership_request( $bp->loggedin_user->id, $bp->groups->current_group->id ) && $bp->groups->current_group->status == 'private' )
				bp_core_new_subnav_item( array( 'name' => __( 'Request Membership', 'buddypress' ), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30 ) );

			if ( $bp->groups->current_group->enable_forum && function_exists('bp_forums_setup') )
				bp_core_new_subnav_item( array( 'name' => __( 'Forum', 'buddypress' ), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'forums' ) );

			bp_core_new_subnav_item( array( 'name' => sprintf( __( 'Members (%s)', 'buddypress' ), number_format( $bp->groups->current_group->total_member_count ) ), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'members'  ) );

			if ( is_user_logged_in() && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) ) {
				if ( function_exists('friends_install') )
					bp_core_new_subnav_item( array( 'name' => __( 'Send Invites', 'buddypress' ), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $bp->groups->current_group->user_has_access ) );
			}
		}
	}

	do_action( 'groups_setup_nav', $bp->groups->current_group->user_has_access );
}
예제 #4
0
파일: config.php 프로젝트: quyip8818/wps
 function kleo_change_settings_subnav()
 {
     $args = array('parent_slug' => 'settings', 'screen_function' => 'bp_woo_edit_account_screen', 'subnav_slug' => 'account');
     bp_core_new_nav_default($args);
 }
 public function nav_default()
 {
     if (!bp_is_my_profile()) {
         return;
     }
     global $bp;
     bp_core_new_nav_default(array('parent_slug' => $bp->activity->slug, 'subnav_slug' => MYSTREAM_ACTIVITY_SLUG, 'screen_function' => array($this, 'activity_screen')));
 }