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

PHP bp_is_single_item函数代码示例

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

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



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

示例1: is_group

 /**
  * Are we looking at something that needs group theme compatibility?
  *
  * @since 1.7.0
  */
 public function is_group()
 {
     // Bail if not looking at a group.
     if (!bp_is_groups_component()) {
         return;
     }
     // Group Directory.
     if (!bp_current_action() && !bp_current_item()) {
         bp_update_is_directory(true, 'groups');
         /**
          * Fires at the start of the group theme compatibility setup.
          *
          * @since 1.1.0
          */
         do_action('groups_directory_groups_setup');
         add_filter('bp_get_buddypress_template', array($this, 'directory_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'directory_content'));
         // Creating a group.
     } elseif (bp_is_groups_component() && bp_is_current_action('create')) {
         add_filter('bp_get_buddypress_template', array($this, 'create_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'create_content'));
         // Group page.
     } elseif (bp_is_single_item()) {
         add_filter('bp_get_buddypress_template', array($this, 'single_template_hierarchy'));
         add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
         add_filter('bp_replace_the_content', array($this, 'single_content'));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:35,代码来源:class-bp-groups-theme-compat.php


示例2: bp_checkins_is_group_places_area

function bp_checkins_is_group_places_area()
{
    if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins') && bp_action_variable(0) == 'places') {
        return true;
    } else {
        return false;
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:8,代码来源:bp-checkins-functions.php


示例3: bp_checkins_is_group_checkins_area

function bp_checkins_is_group_checkins_area()
{
    if (!(int) bp_get_option('bp-checkins-activate-component') || '' == bp_get_option('bp-checkins-activate-component')) {
        return false;
    }
    if (bp_is_groups_component() && bp_is_single_item() && bp_is_current_action('checkins')) {
        return true;
    } else {
        return false;
    }
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:11,代码来源:bp-checkins-shared.php


示例4: cbox_fix_bbp_new_topic_button

/**
 * Temporarily fix the "New Topic" button when using bbPress with BP.
 *
 * @todo Remove this when bbPress addresses this.
 */
function cbox_fix_bbp_new_topic_button()
{
    // if groups isn't active, stop now!
    if (!bp_is_active('groups')) {
        return;
    }
    // if bbPress 2 isn't enabled, stop now!
    if (!function_exists('bbpress')) {
        return;
    }
    // remove the 'New Topic' button
    // this is done because the 'bp_get_group_new_topic_button' filter doesn't
    // work properly
    remove_action('bp_group_header_actions', 'bp_group_new_topic_button');
    // version of bp_is_group_forum() that works with bbPress 2
    $is_group_forum = bp_is_single_item() && bp_is_groups_component() && bp_is_current_action('forum');
    // If these conditions are met, this button should not be displayed
    if (!is_user_logged_in() || !$is_group_forum || bp_is_group_forum_topic() || bp_group_is_user_banned()) {
        return false;
    }
    // create function to output new topic button
    $new_button = create_function('', "\n\t\t// do not show in sidebar\n\t\tif ( did_action( 'open_sidebar' ) )\n\t\t\treturn;\n\n\t\t// render the button\n\t\tbp_button( array(\n\t\t\t'id'                => 'new_topic',\n\t\t\t'component'         => 'groups',\n\t\t\t'must_be_logged_in' => true,\n\t\t\t'block_self'        => true,\n\t\t\t'wrapper_class'     => 'group-button',\n\t\t\t'link_href'         => '#new-post',    // anchor modified\n\t\t\t'link_class'        => 'group-button', // removed a link_class here\n\t\t\t'link_id'           => 'new-topic-button',\n\t\t\t'link_text'         => __( 'New Topic', 'buddypress' ),\n\t\t\t'link_title'        => __( 'New Topic', 'buddypress' ),\n\t\t) );\n\t");
    // add our customized 'New Topic' button
    add_action('bp_group_header_actions', $new_button);
}
开发者ID:shads196770,项目名称:cbox-theme,代码行数:30,代码来源:buddypress-cbox.php


示例5: widget_community_nav


//.........这里部分代码省略.........
            echo site_url();
            ?>
/<?php 
            echo BP_FORUMS_SLUG;
            ?>
/" title="<?php 
            _e('Forums', 'cc');
            ?>
"><?php 
            _e('Forums', 'cc');
            ?>
</a>
                                                </li>
                                        <?php 
        }
        ?>
					<?php 
    }
    ?>
					<?php 
    if (bp_is_active('blogs') && is_multisite()) {
        ?>
                                                        <li<?php 
        if (bp_is_blogs_component()) {
            ?>
 class="selected"<?php 
        }
        ?>
>
							<a href="<?php 
        echo site_url();
        ?>
/<?php 
        echo BP_BLOGS_SLUG;
        ?>
/" title="<?php 
        _e('Blogs', 'cc');
        ?>
"><?php 
        _e('Blogs', 'cc');
        ?>
</a>
						</li>
					<?php 
    }
    ?>
  				</ul>
				
   <?php 
    if (bp_is_single_item() || bp_is_user()) {
        ?>
	   	<?php 
        if (bp_is_group()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Group', 'cc');
            ?>
</h3>
				<?php 
            bp_get_options_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>

		<?php 
        if (bp_is_user()) {
            ?>
		<div id="community-single-nav" class="widget-title" >
		  <ul class="item-list">
		  <h3 class="widgettitle"><?php 
            _e('@ Member', 'cc');
            ?>
</h3>
		  <?php 
            bp_get_displayed_user_nav();
            ?>
				<?php 
            do_action('bp_group_options_nav');
            ?>
			</ul>
		
		</div>	
		<?php 
        }
        ?>
  	<?php 
    }
    ?>
  	</div>
<?php 
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:101,代码来源:widgets.php


示例6: bp_get_template_part

        <div id="item-header" role="complementary">

            <?php 
    bp_get_template_part('members/single/member-header');
    ?>

        </div>
        <!-- #item-header -->
    </section>

<?php 
}
?>

<?php 
if (sq_option('bp_full_group', 0) == 1 && bp_is_single_item() && bp_is_groups_component()) {
    ?>

    <?php 
    if (bp_has_groups()) {
        while (bp_groups()) {
            bp_the_group();
            ?>

    <section class="alternate-color bp-full-width-profile">
        <div id="item-header" role="complementary">

            <?php 
            bp_get_template_part('groups/single/group-header');
            ?>
开发者ID:quyip8818,项目名称:wps,代码行数:30,代码来源:buddypress.php


示例7: bp_dtheme_ajax_querystring

/**
 * This function looks scarier than it actually is. :)
 * Each object loop (activity/members/groups/blogs/forums) contains default parameters to
 * show specific information based on the page we are currently looking at.
 * The following function will take into account any cookies set in the JS and allow us
 * to override the parameters sent. That way we can change the results returned without reloading the page.
 * By using cookies we can also make sure that user settings are retained across page loads.
 *
 * @return string Query string for the activity/members/groups/blogs/forums loops
 * @since BuddyPress (1.2)
 */
function bp_dtheme_ajax_querystring($query_string, $object)
{
    if (empty($object)) {
        return '';
    }
    // Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts
    if (!empty($_POST['cookie'])) {
        $_BP_COOKIE = wp_parse_args(str_replace('; ', '&', urldecode($_POST['cookie'])));
    } else {
        $_BP_COOKIE =& $_COOKIE;
    }
    $qs = array();
    /**
     * Check if any cookie values are set. If there are then override the default params passed to the
     * template loop
     */
    // Activity stream filtering on action
    if (!empty($_BP_COOKIE['bp-' . $object . '-filter']) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter']) {
        $qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter'];
        $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
    }
    if (!empty($_BP_COOKIE['bp-' . $object . '-scope'])) {
        if ('personal' == $_BP_COOKIE['bp-' . $object . '-scope']) {
            $user_id = bp_displayed_user_id() ? bp_displayed_user_id() : bp_loggedin_user_id();
            $qs[] = 'user_id=' . $user_id;
        }
        // Activity stream scope only on activity directory.
        if ('all' != $_BP_COOKIE['bp-' . $object . '-scope'] && !bp_displayed_user_id() && !bp_is_single_item()) {
            $qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope'];
        }
    }
    // If page and search_terms have been passed via the AJAX post request, use those.
    if (!empty($_POST['page']) && '-1' != $_POST['page']) {
        $qs[] = 'page=' . $_POST['page'];
    }
    $object_search_text = bp_get_search_default_text($object);
    if (!empty($_POST['search_terms']) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms']) {
        $qs[] = 'search_terms=' . $_POST['search_terms'];
    }
    // Now pass the querystring to override default values.
    $query_string = empty($qs) ? '' : join('&', (array) $qs);
    $object_filter = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-filter'])) {
        $object_filter = $_BP_COOKIE['bp-' . $object . '-filter'];
    }
    $object_scope = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-scope'])) {
        $object_scope = $_BP_COOKIE['bp-' . $object . '-scope'];
    }
    $object_page = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-page'])) {
        $object_page = $_BP_COOKIE['bp-' . $object . '-page'];
    }
    $object_search_terms = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-search-terms'])) {
        $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms'];
    }
    $object_extras = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-extras'])) {
        $object_extras = $_BP_COOKIE['bp-' . $object . '-extras'];
    }
    return apply_filters('bp_dtheme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras);
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:74,代码来源:ajax.php


示例8: bp_modify_page_title

/**
 * Filter the page title for BuddyPress pages.
 *
 * @since BuddyPress (1.5.0)
 *
 * @see wp_title()
 * @global object $bp BuddyPress global settings.
 *
 * @param string $title Original page title.
 * @param string $sep How to separate the various items within the page title.
 * @param string $seplocation Direction to display title.
 * @return string New page title.
 */
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) {
	global $bp;

	// If this is not a BP page, just return the title produced by WP
	if ( bp_is_blog_page() ) {
		return $title;
	}

	// If this is a 404, let WordPress handle it
	if ( is_404() ) {
		return $title;
	}

	// If this is the front page of the site, return WP's title
	if ( is_front_page() || is_home() ) {
		return $title;
	}

	$title = '';

	// Displayed user
	if ( bp_get_displayed_user_fullname() && ! is_404() ) {
		// Get the component's ID to try and get its name
		$component_id = $component_name = bp_current_component();

		// Use the component nav name
		if ( ! empty( $bp->bp_nav[$component_id] ) ) {
			// Remove counts that are added by the nav item
			$span = strpos( $bp->bp_nav[ $component_id ]['name'], '<span' );
			if ( false !== $span ) {
				$component_name = substr( $bp->bp_nav[ $component_id ]['name'], 0, $span - 1 );

			} else {
				$component_name = $bp->bp_nav[ $component_id ]['name'];
			}

		// Fall back on the component ID
		} elseif ( ! empty( $bp->{$component_id}->id ) ) {
			$component_name = ucwords( $bp->{$component_id}->id );
		}

		// Append action name if we're on a member component sub-page
		if ( ! empty( $bp->bp_options_nav[ $component_id ] ) && ! empty( $bp->canonical_stack['action'] ) ) {
			$component_subnav_name = wp_filter_object_list( $bp->bp_options_nav[ $component_id ], array( 'slug' => bp_current_action() ), 'and', 'name' );

			if ( $component_subnav_name ) {
				$component_subnav_name = array_shift( $component_subnav_name );
			} else {
				$component_subnav_name = '';
			}

		} else {
			$component_subnav_name = '';
		}

		// If on the user profile's landing page, just use the fullname
		if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) {
			$title = bp_get_displayed_user_fullname();

		// Use component name on member pages
		} else {
			// If we have a subnav name, add it separately for localization
			if ( ! empty( $component_subnav_name ) ) {
				// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name
				$title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) );

			} else {
				// translators: construct the page title. 1 = user name, 2 = component name, 3 = separator
				$title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) );
			}
		}

	// A single group
	} elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) {
		$subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : '';
		// translators: 1 = group name, 2 = group nav section name, 3 = separator
		$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep );

	// A single item from a component other than groups
	} elseif ( bp_is_single_item() ) {
		// translators: 1 = component item name, 2 = component nav section name, 3 = separator
		$title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep );

	// An index or directory
	} elseif ( bp_is_directory() ) {
		$current_component = bp_current_component();

//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:bp-core-filters.php


示例9: setup_title

 /**
  * Set up the title for pages and <title>.
  */
 public function setup_title()
 {
     if (bp_is_groups_component()) {
         $bp = buddypress();
         if (bp_is_my_profile() && !bp_is_single_item()) {
             $bp->bp_options_title = _x('Memberships', 'My Groups page <title>', 'buddypress');
         } elseif (!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', 'alt' => sprintf(__('Profile picture of %s', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
             // We are viewing a single group, so set up the
             // group navigation menu using the $this->current_group global.
         } elseif (bp_is_single_item()) {
             $bp->bp_options_title = $this->current_group->name;
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $this->current_group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __('Group Profile Photo', 'buddypress')));
             if (empty($bp->bp_options_avatar)) {
                 $bp->bp_options_avatar = '<img src="' . esc_url(bp_core_avatar_default_thumb()) . '" alt="' . esc_attr__('No Group Profile Photo', 'buddypress') . '" class="avatar" />';
             }
         }
     }
     parent::setup_title();
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:24,代码来源:bp-groups-loader.php


示例10: groups_add_forum_where_sql

/**
 * Add WHERE clauses to bbPress query for group-specific data and access protection.
 *
 * @param string $sql
 * @return string
 */
function groups_add_forum_where_sql($sql = '')
{
    global $bp;
    // Define locale variable
    $parts = array();
    // Set this for groups
    $parts['groups'] = "(gm.meta_key = 'forum_id' AND gm.meta_value = t.forum_id)";
    // Restrict to public...
    $parts['private'] = "g.status = 'public'";
    /**
     * ...but do some checks to possibly remove public restriction.
     *
     * Decide if private are visible
     */
    // Are we in our own profile?
    if (bp_is_my_profile()) {
        unset($parts['private']);
    } elseif (bp_current_user_can('bp_moderate')) {
        unset($parts['private']);
    } elseif (bp_is_single_item()) {
        unset($parts['private']);
    }
    // Check the SQL filter that was passed
    if (!empty($sql)) {
        $parts['passed'] = $sql;
    }
    // Assemble Voltron
    $parts_string = implode(' AND ', $parts);
    // Set it to the global filter
    $bp->groups->filter_sql = $parts_string;
    // Return the global filter
    return $bp->groups->filter_sql;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:39,代码来源:bp-groups-filters.php


示例11: bp_modify_page_title

/**
 * Filter the page title for BuddyPress pages.
 *
 * @since 1.5.0
 *
 * @see wp_title()
 * @global object $bp BuddyPress global settings.
 *
 * @param  string $title       Original page title.
 * @param  string $sep         How to separate the various items within the page title.
 * @param  string $seplocation Direction to display title.
 * @return string              New page title.
 */
function bp_modify_page_title($title = '', $sep = '&raquo;', $seplocation = 'right')
{
    global $bp, $paged, $page, $_wp_theme_features;
    // If this is not a BP page, just return the title produced by WP.
    if (bp_is_blog_page()) {
        return $title;
    }
    // If this is a 404, let WordPress handle it.
    if (is_404()) {
        return $title;
    }
    // If this is the front page of the site, return WP's title.
    if (is_front_page() || is_home()) {
        return $title;
    }
    // Return WP's title if not a BuddyPress page.
    if (!is_buddypress()) {
        return $title;
    }
    // Setup an empty title parts array.
    $title_parts = array();
    // Is there a displayed user, and do they have a name?
    $displayed_user_name = bp_get_displayed_user_fullname();
    // Displayed user.
    if (!empty($displayed_user_name) && !is_404()) {
        // Get the component's ID to try and get its name.
        $component_id = $component_name = bp_current_component();
        // Set empty subnav name.
        $component_subnav_name = '';
        // Use the component nav name.
        if (!empty($bp->bp_nav[$component_id])) {
            $component_name = _bp_strip_spans_from_title($bp->bp_nav[$component_id]['name']);
            // Fall back on the component ID.
        } elseif (!empty($bp->{$component_id}->id)) {
            $component_name = ucwords($bp->{$component_id}->id);
        }
        // Append action name if we're on a member component sub-page.
        if (!empty($bp->bp_options_nav[$component_id]) && !empty($bp->canonical_stack['action'])) {
            $component_subnav_name = wp_filter_object_list($bp->bp_options_nav[$component_id], array('slug' => bp_current_action()), 'and', 'name');
            if (!empty($component_subnav_name)) {
                $component_subnav_name = array_shift($component_subnav_name);
            }
        }
        // If on the user profile's landing page, just use the fullname.
        if (bp_is_current_component($bp->default_component) && bp_get_requested_url() === bp_displayed_user_domain()) {
            $title_parts[] = $displayed_user_name;
            // Use component name on member pages.
        } else {
            $title_parts = array_merge($title_parts, array_map('strip_tags', array($displayed_user_name, $component_name)));
            // If we have a subnav name, add it separately for localization.
            if (!empty($component_subnav_name)) {
                $title_parts[] = strip_tags($component_subnav_name);
            }
        }
        // A single group.
    } elseif (bp_is_active('groups') && !empty($bp->groups->current_group) && !empty($bp->bp_options_nav[$bp->groups->current_group->slug])) {
        $subnav = isset($bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name']) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
        $title_parts = array($bp->bp_options_title, $subnav);
        // A single item from a component other than groups.
    } elseif (bp_is_single_item()) {
        $title_parts = array($bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name']);
        // An index or directory.
    } elseif (bp_is_directory()) {
        $current_component = bp_current_component();
        // No current component (when does this happen?).
        $title_parts = array(_x('Directory', 'component directory title', 'buddypress'));
        if (!empty($current_component)) {
            $title_parts = array(bp_get_directory_title($current_component));
        }
        // Sign up page.
    } elseif (bp_is_register_page()) {
        $title_parts = array(__('Create an Account', 'buddypress'));
        // Activation page.
    } elseif (bp_is_activation_page()) {
        $title_parts = array(__('Activate Your Account', 'buddypress'));
        // Group creation page.
    } elseif (bp_is_group_create()) {
        $title_parts = array(__('Create a Group', 'buddypress'));
        // Blog creation page.
    } elseif (bp_is_create_blog()) {
        $title_parts = array(__('Create a Site', 'buddypress'));
    }
    // Strip spans.
    $title_parts = array_map('_bp_strip_spans_from_title', $title_parts);
    // Sep on right, so reverse the order.
    if ('right' == $seplocation) {
        $title_parts = array_reverse($title_parts);
//.........这里部分代码省略.........
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:101,代码来源:bp-core-filters.php


示例12: bp_activity_user_can_delete

/**
 * Determine if the current user can delete an activity item.
 *
 * @since BuddyPress (1.2.0)
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook
 *
 * @param object $activity Optional. Falls back on the current item in the loop.
 * @return bool True if can delete, false otherwise.
 */
function bp_activity_user_can_delete($activity = false)
{
    global $activities_template;
    // Try to use current activity if none was passed
    if (empty($activity) && !empty($activities_template->activity)) {
        $activity = $activities_template->activity;
    }
    // If current_comment is set, we'll use that in place of the main activity
    if (isset($activity->current_comment)) {
        $activity = $activity->current_comment;
    }
    // Assume the user cannot delete the activity item
    $can_delete = false;
    // Only logged in users can delete activity
    if (is_user_logged_in()) {
        // Community moderators can always delete activity (at least for now)
        if (bp_current_user_can('bp_moderate')) {
            $can_delete = true;
        }
        // Users are allowed to delete their own activity. This is actually
        // quite powerful, because doing so also deletes all comments to that
        // activity item. We should revisit this eventually.
        if (isset($activity->user_id) && (int) $activity->user_id === bp_loggedin_user_id()) {
            $can_delete = true;
        }
        // Viewing a single item, and this user is an admin of that item
        if (bp_is_single_item() && bp_is_item_admin()) {
            $can_delete = true;
        }
    }
    /**
     * Filters whether the current user can delete an activity item.
     *
     * @since BuddyPress (1.5.0)
     *
     * @param bool   $can_delete Whether the user can delete the item.
     * @param object $activity Current activity item object.
     */
    return (bool) apply_filters('bp_activity_user_can_delete', $can_delete, $activity);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:51,代码来源:bp-activity-template.php


示例13: setup_nav

 /**
  * Set up your component's navigation.
  *
  * The navigation elements created here are responsible for the main site navigation (eg
  * Profile > Activity > Mentions), as well as the navigation in the BuddyBar. WP Admin Bar
  * navigation is broken out into a separate method; see
  * BP_course_Component::setup_admin_bar().
  *
  * @global obj $bp
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $show_for_displayed_user = apply_filters('wplms_user_profile_courses', false);
     $main_nav = array('name' => sprintf(__('Courses <span>%s</span>', 'vibe'), bp_course_get_total_course_count_for_user()), 'slug' => BP_COURSE_SLUG, 'position' => 5, 'screen_function' => 'bp_course_my_courses', 'show_for_displayed_user' => $show_for_displayed_user, 'default_subnav_slug' => BP_COURSE_SLUG);
     // Add 'course' to the main navigation
     if (function_exists('vibe_get_option')) {
         $course_view = vibe_get_option('course_view');
         if (isset($course_view) && $course_view) {
             $main_nav['show_for_displayed_user'] = $show_for_displayed_user;
             //Change for admin
         }
     }
     $course_link = trailingslashit(bp_loggedin_user_domain() . BP_COURSE_SLUG);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     if (!empty($user_domain)) {
         $user_access = bp_is_my_profile();
         $user_access = apply_filters('wplms_user_profile_courses', $user_access);
         $sub_nav[] = array('name' => __('My Courses', 'vibe'), 'slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'parent_slug' => BP_COURSE_SLUG, 'screen_function' => 'bp_course_my_courses', 'user_has_access' => $user_access, 'position' => 10);
         bp_core_new_subnav_item(array('name' => __('Results', 'vibe'), 'slug' => BP_COURSE_RESULTS_SLUG, 'parent_slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'screen_function' => 'bp_course_my_results', 'position' => 30, 'user_has_access' => $user_access));
         bp_core_new_subnav_item(array('name' => __('Stats', 'vibe'), 'slug' => BP_COURSE_STATS_SLUG, 'parent_slug' => BP_COURSE_SLUG, 'parent_url' => $course_link, 'screen_function' => 'bp_course_stats', 'position' => 40, 'user_has_access' => $user_access));
         $sub_nav[] = array('name' => __('Instructing Courses', 'vibe'), 'slug' => BP_COURSE_INSTRUCTOR_SLUG, 'parent_url' => $course_link, 'parent_slug' => BP_COURSE_SLUG, 'screen_function' => 'bp_course_instructor_courses', 'user_has_access' => bp_is_my_profile_intructor(), 'position' => 50);
         parent::setup_nav($main_nav, $sub_nav);
     }
     // If your component needs additional navigation menus that are not handled by
     // BP_Component::setup_nav(), you can register them manually here. For course,
     // if your component needs a subsection under a user's Settings menu, add
     // it like this. See bp_course_screen_settings_menu() for more info
     /*global $bp;
     
     		$bp->is_single_item=true; // Extra comments : BuddyPress never detects a single course page
     		$bp->current_component=BP_COURSE_SLUG;  // Extra comments : BuddyPress successfully detects Course 
     		$bp->current_item=$bp->current_action='fikka-dynamics'; // Extra comments : Only Works if we force the current item variable. Never really works.
     		*/
     if (bp_is_course_component() && bp_is_single_item()) {
         // Reset sub nav
         $sub_nav = array();
         // Add 'courses' to the main navigation
         $main_nav = array('name' => __('Home', 'vibe'), 'slug' => get_current_course_slug(), 'position' => -1, 'screen_function' => 'bp_screen_course_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         /*
         			BELOW Part has to hacked to build a custom Menu system. BuddyPress never really detects MENUS properly
         
         			// Add the "Home" subnav item, as this will always be present
         			$sub_nav[] = array(
         				'name'            =>  _e( 'CURRICULUM', 'vibe' ),
         				'slug'            => 'structure',
         				'parent_url'      => $course_link,
         				'parent_slug'     => get_current_course_slug(),
         				'screen_function' => 'bp_screen_course_structure',
         				'position'        => 10,
         				'item_css_id'     => 'structure'
         			);
         
         			$sub_nav[] = array(
         				'name'            =>  _x( 'Home', 'Course home', 'vibe' ),
         				'slug'            => 'home',
         				'parent_url'      => $course_link,
         				'parent_slug'     => $this->current_group->slug,
         				'screen_function' => 'bp_screen_course_home',
         				'position'        => 10,
         				'item_css_id'     => 'home'
         			);
         /*
         			// If this is a private course, and the user is not a
         			// member and does not have an outstanding invitation,
         			// show a "Request Membership" nav item.
         			if ( is_user_logged_in() && !user_check_course_subscribe()){
         
         				$sub_nav[] = array(
         					'name'               => __( 'Subscribe Course', 'vibe' ),
         					'slug'               => 'subscribe-course',
         					'parent_url'         => bp_get_course_permalink(),
         					'parent_slug'        => get_current_course_slug(),
         					'screen_function'    => 'bp_screen_course_subscribe',
         					'position'           => 30
         				);
         			}
         
         			if ( is_user_logged_in() && user_check_course_subscribe()){
         
         				$sub_nav[] = array(
         					'name'               => __( 'Course Status', 'vibe' ),
         					'slug'               => 'course-continue',
         					'parent_url'         => bp_get_course_permalink(),
//.........这里部分代码省略.........
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:101,代码来源:bp-course-loader.php


示例14: bp_activity_user_can_delete

/**
 * Determine if the current user can delete an activity item.
 *
 * @since BuddyPress (1.2)
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook
 *
 * @param object $activity Optional. Falls back on the current item in the loop.
 * @return bool True if can delete, false otherwise.
 */
function bp_activity_user_can_delete($activity = false)
{
    global $activities_template;
    if (!$activity) {
        $activity = $activities_template->activity;
    }
    if (isset($activity->current_comment)) {
        $activity = $activity->current_comment;
    }
    $can_delete = false;
    if (bp_current_user_can('bp_moderate')) {
        $can_delete = true;
    }
    if (is_user_logged_in() && $activity->user_id == bp_loggedin_user_id()) {
        $can_delete = true;
    }
    if (bp_is_item_admin() && bp_is_single_item()) {
        $can_delete = true;
    }
    return apply_filters('bp_activity_user_can_delete', $can_delete, $activity);
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:32,代码来源:bp-activity-template.php


示例15: define

 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// Set 'BP_SHOW_DISPLAYNAME_ON_PROFILE' constant if not already defined
if (!defined('BP_SHOW_DISPLAYNAME_ON_PROFILE')) {
    define('BP_SHOW_DISPLAYNAME_ON_PROFILE', true);
}
if ((bool) BP_SHOW_DISPLAYNAME_ON_PROFILE === true) {
    // only show the display name for the <h1> tag on a member profile
    add_action('bp_before_member_header', create_function('', 'remove_filter( "bp_displayed_user_fullname", "ray_bp_displayed_user_fullname" );'), 99);
    // add back the username filter
    add_action('bp_before_member_header_meta', create_function('', 'add_filter( "bp_displayed_user_fullname",    "ray_bp_displayed_user_fullname" );'), 0);
    // support for BP Lists
    if (function_exists('bp_is_lists_component') && bp_is_lists_component() && bp_is_single_item()) {
        add_filter('bp_displayed_user_fullname', 'ray_bp_displayed_user_fullname');
    }
} else {
    add_filter('bp_displayed_user_fullname', 'ray_bp_displayed_user_fullname');
}
/* UTILITY *********************************************************/
/**
 * Returns either the username or user nicename depending on the BuddyPress
 * username compatibility mode.
 *
 * @since 0.6
 *
 * @param obj $userdata Object The userdata that includes the user_login and user_nicename.
 * @mixed String on success; boolean false on failure
 */
开发者ID:r-a-y,项目名称:buddypress-usernames-only,代码行数:31,代码来源:bp-usernames-only.php


示例16: breadcrumbs_plus_get_bbpress_items

/**
 * Gets the items for the breadcrumb item if bbPress is installed.
 *
 * @since 0.4
 *
 * @param array $args Mixed arguments for the menu.
 * @return array List of items to be shown in the item.
 */
function breadcrumbs_plus_get_bbpress_items($args = array())
{
    $item = array();
    $post_type_object = get_post_type_object(bbp_get_forum_post_type());
    if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
        if (function_exists('bp_is_active')) {
            global $bp;
            // we're outside the loop!
            // Assign some variables here
            $page1 = isset($bp->members->root_slug) ? $bp->members->root_slug : '';
            // slug for the Members page. The BuddyPress default is 'members'.
            $page2 = isset($bp->groups->root_slug) ? $bp->groups->root_slug : '';
            // slug for the Groups page. The BuddyPress default is 'groups'.
            $page3 = isset($bp->activity->root_slug) ? $bp->activity->root_slug : '';
            // slug for the Activity page. The BuddyPress default is 'activity'.
            $page4 = isset($bp->forums->root_slug) ? $bp->forums->root_slug : '';
            // slug for the Forums page. The BuddyPress default is 'forums'.
            $page5 = isset($bp->achievements->root_slug) ? $bp->achievements->root_slug : '';
            // slug for the Achievements page. The BuddyPress default is 'achievements'.
            if (!bp_is_blog_page() && (is_page() || is_page($page1) || is_page($page2) || is_page($page3) || is_page($page4) || is_page($page5)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
                $item[] = '';
            }
            if (bp_is_user() && !bp_is_register_page()) {
                $item[] = '';
            }
        } else {
            //$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
        }
    }
    if (bbp_is_forum_archive()) {
        $item[] = bbp_get_forum_archive_title();
    } else {
        $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
    }
    if (bbp_is_topic_archive()) {
        $item[] = bbp_get_topic_archive_title();
    } elseif (bbp_is_single_view()) {
        $item[] = bbp_get_view_title();
    } elseif (bbp_is_single_topic()) {
        $topic_id = get_queried_object_id();
        $item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id)));
        if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
            $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" rel="v:url" property="v:title">' . bbp_get_topic_title($topic_id) . '</a></div>';
        } else {
            $item[] = '';
        }
        if (bbp_is_topic_split()) {
            $item[] = __('Split', 'framework');
        } elseif (bbp_is_topic_merge()) {
            $item[] = __('Merge', 'framework');
        } elseif (bbp_is_topic_edit()) {
            $item[] = __('Edit', 'framework');
        }
    } elseif (bbp_is_single_reply()) {
        $reply_id = get_queried_object_id();
        $item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id)));
        if (!bbp_is_reply_edit()) {
            $item[] = bbp_get_reply_title($reply_id);
        } else {
            $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" rel="v:url" property="v:title">' . bbp_get_reply_title($reply_id) . '</a></div>';
            $item[] = __('Edit', 'framework');
        }
    } elseif (bbp_is_single_forum()) {
        $forum_id = get_queried_object_id();
        $forum_parent_id = bbp_get_forum_parent_id($forum_id);
        if (0 !== $forum_parent_id) {
            $item = array_merge($item, breadcrumbs_plus_get_parents($forum_parent_id));
        }
        $item[] = bbp_get_forum_title($forum_id);
    } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
        if (bbp_is_single_user_edit()) {
            $item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" rel="v:url" property="v:title">' . bbp_get_displayed_user_field('display_name') . '</a></div>';
            $item[] = __('Edit', 'framework');
        } else {
            $item[] = bbp_get_displayed_user_field('display_name');
        }
    }
    return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args);
}
开发者ID:justinwool,项目名称:vortago,代码行数:87,代码来源:breadcrumbs-plus.php


示例17: bp_screen_course_home

function bp_screen_course_home()
{
    if (!bp_is_single_item()) {
        return false;
    }
    do_action('bp_screen_course_home');
    bp_core_load_template(apply_filters('bp_template_course_home', 'courses/single/home'));
}
开发者ID:nikitansk,项目名称:devschool,代码行数:8,代码来源:bp-course-screens.php


示例18: bp_get_the_topic_permalink

/**
 * Return the permalink for the current topic in the loop.
 *
 * @since 1.0.0
 *
 * @return string Permalink for the current topic.
 */
function 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP bp_is_user函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_is_single_activity函数代码示例发布时间: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