本文整理汇总了PHP中bp_is_group函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_group函数的具体用法?PHP bp_is_group怎么用?PHP bp_is_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mpp_is_group_gallery_component
/**
* Is it groups gallery component?
* @return boolean
*/
function mpp_is_group_gallery_component()
{
if (function_exists('bp_is_group') && bp_is_group() && bp_is_current_action(MPP_GALLERY_SLUG)) {
return true;
}
return false;
}
示例2: lsx_buddypress_page_columns
/**
* Forces the BP Profile Pages to be 1 Column
*
* @package lsx
* @subpackage jetpack
* @category infinite scroll
*/
function lsx_buddypress_page_columns($layout)
{
if (bp_is_profile_component() || bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()) {
$layout = '1c';
}
return $layout;
}
示例3: setup_item
/**
* Gets the item id of the item (eg group, user) associated with the page you're on.
*
* @package BuddyPress Docs
* @since 1.0-beta
*
* @return str $view The current item type
*/
function setup_item()
{
global $bp;
if (empty($this->item_type)) {
return false;
}
$id = '';
$name = '';
$slug = '';
switch ($this->item_type) {
case 'group':
if (bp_is_group()) {
$group = groups_get_current_group();
$id = $group->id;
$name = $group->name;
$slug = $group->slug;
}
break;
case 'user':
if (bp_is_user()) {
$id = bp_displayed_user_id();
$name = bp_get_displayed_user_fullname();
$slug = bp_get_displayed_user_username();
}
break;
}
// Todo: abstract into groups. Will be a pain
$this->item_id = apply_filters('bp_docs_get_item_id', $id);
$this->item_name = apply_filters('bp_docs_get_item_name', $name);
$this->item_slug = apply_filters('bp_docs_get_item_slug', $slug);
// Put some stuff in $bp
$bp->bp_docs->current_item = $this->item_id;
}
示例4: bp_activity_at_message_notification
/**
* Sends an email notification and a BP notification when someone mentions you in an update
*
* @since BuddyPress (1.2)
*
* @param int $activity_id The id of the activity update
* @param int $receiver_user_id The unique user_id of the user who is receiving the update
*
* @uses bp_core_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses wp_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook
* @uses wp_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
// Don't leave multiple notifications for the same activity item
$notifications = BP_Core_Notification::get_all_for_user($receiver_user_id, 'all');
foreach ($notifications as $notification) {
if ($activity_id == $notification->item_id) {
return;
}
}
$activity = new BP_Activity_Activity($activity_id);
$subject = '';
$message = '';
$content = '';
// Add the BP notification
bp_core_add_notification($activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id);
// Now email the user with the contents of the message (if they have enabled email notifications)
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
$poster_name = bp_core_get_user_displayname($activity->user_id);
$message_link = bp_activity_get_permalink($activity_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
$poster_name = stripslashes($poster_name);
$content = bp_activity_filter_kses(strip_tags(stripslashes($activity->content)));
// Set up and send the message
$ud = bp_core_get_core_userdata($receiver_user_id);
$to = $ud->user_email;
$subject = bp_get_email_subject(array('text' => sprintf(__('%s mentioned you in an update', 'buddypress'), $poster_name)));
if (bp_is_active('groups') && bp_is_group()) {
$message = sprintf(__('%1$s mentioned you in the group "%2$s":
"%3$s"
To view and respond to the message, log in and visit: %4$s
---------------------
', 'buddypress'), $poster_name, bp_get_current_group_name(), $content, $message_link);
} else {
$message = sprintf(__('%1$s mentioned you in an update:
"%2$s"
To view and respond to the message, log in and visit: %3$s
---------------------
', 'buddypress'), $poster_name, $content, $message_link);
}
// Only show the disable notifications line if the settings component is enabled
if (bp_is_active('settings')) {
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
}
/* Send the message */
$to = apply_filters('bp_activity_at_message_notification_to', $to);
$subject = apply_filters('bp_activity_at_message_notification_subject', $subject, $poster_name);
$message = apply_filters('bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
wp_mail($to, $subject, $message);
}
do_action('bp_activity_sent_mention_email', $activity, $subject, $message, $content);
}
示例5: bp_groups_group_access_protection
/**
* Protect access to single groups.
*
* @since BuddyPress (2.1.0)
*/
function bp_groups_group_access_protection()
{
if (!bp_is_group()) {
return;
}
$current_group = groups_get_current_group();
$user_has_access = $current_group->user_has_access;
$no_access_args = array();
if (!$user_has_access && 'hidden' !== $current_group->status) {
// Always allow access to home and request-membership
if (bp_is_current_action('home') || bp_is_current_action('request-membership')) {
$user_has_access = true;
// User doesn't have access, so set up redirect args
} else {
if (is_user_logged_in()) {
$no_access_args = array('message' => __('You do not have access to this group.', 'buddypress'), 'root' => bp_get_group_permalink($current_group) . 'home/', 'redirect' => false);
}
}
}
// Protect the admin tab from non-admins
if (bp_is_current_action('admin') && !bp_is_item_admin()) {
$user_has_access = false;
$no_access_args = array('message' => __('You are not an admin of this group.', 'buddypress'), 'root' => bp_get_group_permalink($current_group), 'redirect' => false);
}
/**
* Allow plugins to filter whether the current user has access to this group content.
*
* Note that if a plugin sets $user_has_access to false, it may also
* want to change the $no_access_args, to avoid problems such as
* logged-in users being redirected to wp-login.php.
*
* @since BuddyPress (2.1.0)
*
* @param bool $user_has_access True if the user has access to the
* content, otherwise false.
* @param array $no_access_args Arguments to be passed to
* bp_core_no_access() in case of no access. Note that this
* value is passed by reference, so it can be modified by the
* filter callback.
*/
$user_has_access = apply_filters_ref_array('bp_group_user_has_access', array($user_has_access, &$no_access_args));
// If user has access, we return rather than redirect
if ($user_has_access) {
return;
}
// Hidden groups should return a 404 for non-members.
// Unset the current group so that you're not redirected
// to the default group tab
if ('hidden' == $current_group->status) {
buddypress()->groups->current_group = 0;
buddypress()->is_single_item = false;
bp_do_404();
return;
} else {
bp_core_no_access($no_access_args);
}
}
示例6: mpp_group_filter_status
function mpp_group_filter_status($statuses)
{
if (bp_is_group()) {
unset($statuses['friends']);
unset($statuses['private']);
} else {
unset($statuses['groupsonly']);
}
return $statuses;
}
示例7: bcg_is_disabled_for_group
/**
*
* @global type $bp
* @return type
*/
function bcg_is_disabled_for_group()
{
$bp = buddypress();
$group_id = false;
if (bp_is_group_create()) {
$group_id = $_COOKIE['bp_new_group_id'];
} elseif (bp_is_group()) {
$group_id = $bp->groups->current_group->id;
}
return apply_filters('bcg_is_disabled_for_group', bcg_is_disabled($group_id));
}
示例8: training_wpo_buddypress_init
function training_wpo_buddypress_init()
{
if (bp_is_user_activity()) {
remove_action('wpo_layout_breadcrumbs_buddy_render', 'training_wpo_layout_breadcrumbs_buddypress');
add_action('wpo_layout_breadcrumbs_buddy_render', 'training_wpo_buddypress_user_header');
}
if (bp_is_group()) {
remove_action('wpo_layout_breadcrumbs_buddy_render', 'training_wpo_layout_breadcrumbs_buddypress');
add_action('wpo_layout_breadcrumbs_buddy_render', 'training_wpo_buddypress_group_header');
}
}
示例9: mp_group_nav
function mp_group_nav()
{
if (!bp_is_group()) {
return;
}
$component = 'groups';
$component_id = groups_get_current_group()->id;
if (mpp_user_can_create_gallery($component, $component_id)) {
echo sprintf("<li><a href='%s'>%s</a></li>", mpp_get_gallery_base_url($component, $component_id), __('All Galleries', 'mediapress'));
echo sprintf("<li><a href='%s'>%s</a></li>", mpp_get_gallery_create_url($component, $component_id), __('Create Gallery', 'mediapress'));
}
}
示例10: cfbgr_is_restriction_js
/**
* Load the js only when needed
*
* @return bool
*/
function cfbgr_is_restriction_js()
{
// Group create
if (bp_is_group_create() && bp_is_group_creation_step('group-settings')) {
return true;
}
// Group manage
if (bp_is_group() && bp_is_group_admin_screen('group-settings')) {
return true;
}
return false;
}
示例11: wff_populate_group_global
/**
* Populate the $groups_template global for use outside the loop
*
* We build the group navigation outside the groups loop. In order to use BP's
* group template functions while building the nav, we must have the template
* global populated. In this function, we fill in any missing data, based on
* the current group.
*
* This issue should be fixed more elegantly upstream in BuddyPress, ideally
* by making the template functions fall back on the current group when the
* loop global is not populated.
*/
function wff_populate_group_global()
{
global $groups_template;
if (bp_is_group() && isset($groups_template->groups[0]->group_id) && empty($groups_template->groups[0]->name)) {
$current_group = groups_get_current_group();
// Fill in all missing properties
foreach ($current_group as $cur_key => $cur_value) {
if (!isset($groups_template->groups[0]->{$cur_key})) {
$groups_template->groups[0]->{$cur_key} = $cur_value;
}
}
}
}
示例12: bp_activity_at_message_notification
/**
* Sends an email notification and a BP notification when someone mentions you in an update
*
* @since 1.2.0
*
* @param int $activity_id The id of the activity update
* @param int $receiver_user_id The unique user_id of the user who is receiving the update
*
* @global object $bp BuddyPress global settings
* @uses bp_core_add_notification()
* @uses bp_get_user_meta()
* @uses bp_core_get_user_displayname()
* @uses bp_activity_get_permalink()
* @uses bp_core_get_user_domain()
* @uses bp_get_settings_slug()
* @uses bp_activity_filter_kses()
* @uses bp_core_get_core_userdata()
* @uses nxt_specialchars_decode()
* @uses get_blog_option()
* @uses bp_is_active()
* @uses bp_is_group()
* @uses bp_get_current_group_name()
* @uses apply_filters() To call the 'bp_activity_at_message_notification_to' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_subject' hook
* @uses apply_filters() To call the 'bp_activity_at_message_notification_message' hook
* @uses nxt_mail()
* @uses do_action() To call the 'bp_activity_sent_mention_email' hook
*/
function bp_activity_at_message_notification($activity_id, $receiver_user_id)
{
global $bp;
$activity = new BP_Activity_Activity($activity_id);
$subject = '';
$message = '';
// Add the BP notification
bp_core_add_notification($activity_id, $receiver_user_id, 'activity', 'new_at_mention', $activity->user_id);
// Now email the user with the contents of the message (if they have enabled email notifications)
if ('no' != bp_get_user_meta($receiver_user_id, 'notification_activity_new_mention', true)) {
$poster_name = bp_core_get_user_displayname($activity->user_id);
$message_link = bp_activity_get_permalink($activity_id);
$settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
$settings_link = bp_core_get_user_domain($receiver_user_id) . $settings_slug . '/notifications/';
$poster_name = stripslashes($poster_name);
$content = bp_activity_filter_kses(strip_tags(stripslashes($activity->content)));
// Set up and send the message
$ud = bp_core_get_core_userdata($receiver_user_id);
$to = $ud->user_email;
$sitename = nxt_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
$subject = '[' . $sitename . '] ' . sprintf(__('%s mentioned you in an update', 'buddypress'), $poster_name);
if (bp_is_active('groups') && bp_is_group()) {
$message = sprintf(__('%1$s mentioned you in the group "%2$s":
"%3$s"
To view and respond to the message, log in and visit: %4$s
---------------------
', 'buddypress'), $poster_name, bp_get_current_group_name(), $content, $message_link);
} else {
$message = sprintf(__('%1$s mentioned you in an update:
"%2$s"
To view and respond to the message, log in and visit: %3$s
---------------------
', 'buddypress'), $poster_name, $content, $message_link);
}
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
/* Send the message */
$to = apply_filters('bp_activity_at_message_notification_to', $to);
$subject = apply_filters('bp_activity_at_message_notification_subject', $subject, $poster_name);
$message = apply_filters('bp_activity_at_message_notification_message', $message, $poster_name, $content, $message_link, $settings_link);
nxt_mail($to, $subject, $message);
}
do_action('bp_activity_sent_mention_email', $activity, $subject, $message, $content);
}
示例13: klein_get_cover_photo_src
/**
* Returns the cover photo url
* @return string the cover photo url
*/
function klein_get_cover_photo_src()
{
if (!function_exists('bcp_get_cover_photo')) {
return;
}
$item_id = bp_displayed_user_id();
$item_type = 'user';
if (bp_is_group()) {
$item_id = bp_get_group_id();
$item_type = 'group';
}
$args = array('type' => $item_type, 'object_id' => $item_id);
$cover_photo_url = esc_url(bcp_get_cover_photo($args));
return $cover_photo_url;
}
示例14: set_bp_component_context
/**
*
*/
function set_bp_component_context()
{
if (bp_displayed_user_id() && !bp_is_group()) {
$this->type = 'profile';
} else {
if (!bp_displayed_user_id() && bp_is_group()) {
$this->type = 'group';
} else {
$this->type = 'profile';
}
}
$this->id = $this->get_current_bp_component_id();
if ($this->id == null) {
global $bp;
$this->id = $bp->loggedin_user->id;
}
}
示例15: bp_groups_group_admin_menu
/**
* Adds the Group Admin top-level menu to group pages
*
* @package BuddyPress
* @since 1.5
*
* @todo Add dynamic menu items for group extensions
*/
function bp_groups_group_admin_menu()
{
global $nxt_admin_bar, $bp;
// Only show if viewing a group
if (!bp_is_group()) {
return false;
}
// Only show this menu to group admins and super admins
if (!is_super_admin() && !bp_group_is_admin()) {
return false;
}
if ('3.2' == bp_get_major_nxt_version()) {
// Group avatar
$avatar = bp_core_fetch_avatar(array('object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'width' => 16, 'height' => 16));
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = !empty($avatar) ? 'group-admin-with-avatar' : 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => $avatar . bp_get_current_group_name(), 'href' => bp_get_group_permalink($bp->groups->current_group)));
} elseif ('3.3' == bp_get_major_nxt_version()) {
// Unique ID for the 'My Account' menu
$bp->group_admin_menu_id = 'group-admin';
// Add the top-level Group Admin button
$nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group)));
}
// Group Admin > Edit details
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'edit-details', 'title' => __('Edit Details', 'buddypress'), 'href' => bp_get_groups_action_link('admin/edit-details')));
// Group Admin > Group settings
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-settings', 'title' => __('Edit Settings', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-settings')));
// Group Admin > Group avatar
if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-avatar', 'title' => __('Edit Avatar', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-avatar')));
}
// Group Admin > Manage invitations
if (bp_is_active('friends')) {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-invitations', 'title' => __('Manage Invitations', 'buddypress'), 'href' => bp_get_groups_action_link('send-invites')));
}
// Group Admin > Manage members
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-members', 'title' => __('Manage Members', 'buddypress'), 'href' => bp_get_groups_action_link('admin/manage-members')));
// Group Admin > Membership Requests
if (bp_get_group_status($bp->groups->current_group) == 'private') {
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'membership-requests', 'title' => __('Membership Requests', 'buddypress'), 'href' => bp_get_groups_action_link('admin/membership-requests')));
}
// Delete Group
$nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'delete-group', 'title' => __('Delete Group', 'buddypress'), 'href' => bp_get_groups_action_link('admin/delete-group')));
}