本文整理汇总了PHP中bp_get_groups_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_get_groups_slug函数的具体用法?PHP bp_get_groups_slug怎么用?PHP bp_get_groups_slug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_get_groups_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_nav
function setup_nav()
{
global $blog_id;
//check multisite or normal mode for correct permission checking
if (is_multisite() && $blog_id != BP_ROOT_BLOG) {
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
$current_blog = $blog_id;
switch_to_blog(BP_ROOT_BLOG);
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
switch_to_blog($current_blog);
} else {
$can_manage_events = current_user_can('edit_events');
$can_manage_locations = current_user_can('edit_locations');
$can_manage_bookings = current_user_can('manage_bookings');
}
/* Add 'Events' to the main user profile navigation */
$main_nav = array('name' => __('Events', 'dbem'), 'slug' => em_bp_get_slug(), 'position' => 80, 'screen_function' => 'bp_em_events', 'default_subnav_slug' => 'profile');
$em_link = trailingslashit(bp_loggedin_user_domain() . em_bp_get_slug());
/* Create SubNav Items */
$sub_nav[] = array('name' => __('My Profile', 'dbem'), 'slug' => 'profile', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_events', 'position' => 10);
$sub_nav[] = array('name' => __('Events I\'m Attending', 'dbem'), 'slug' => 'attending', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_attending', 'position' => 20, 'user_has_access' => bp_is_my_profile());
if ($can_manage_events) {
$sub_nav[] = array('name' => __('My Events', 'dbem'), 'slug' => 'my-events', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_events', 'position' => 30, 'user_has_access' => bp_is_my_profile());
}
if ($can_manage_locations && get_option('dbem_locations_enabled')) {
$sub_nav[] = array('name' => __('My Locations', 'dbem'), 'slug' => 'my-locations', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_locations', 'position' => 40, 'user_has_access' => bp_is_my_profile());
}
if ($can_manage_bookings && get_option('dbem_rsvp_enabled')) {
$sub_nav[] = array('name' => __('My Event Bookings', 'dbem'), 'slug' => 'my-bookings', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_bookings', 'position' => 50, 'user_has_access' => bp_is_my_profile());
}
if (bp_is_active('groups')) {
/* Create Profile Group Sub-Nav */
$sub_nav[] = array('name' => __('Events', 'dbem'), 'slug' => 'group-events', 'parent_slug' => bp_get_groups_slug(), 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()), 'screen_function' => 'bp_em_my_group_events', 'position' => 60, 'user_has_access' => bp_is_my_profile());
}
parent::setup_nav($main_nav, $sub_nav);
add_action('bp_init', array(&$this, 'setup_group_nav'));
}
示例2: wdfb_expand_buddypress_macros
/**
* Expands some basic supported BuddyPress macros.
*/
function wdfb_expand_buddypress_macros($str)
{
if (!defined('BP_VERSION')) {
return $str;
}
if (function_exists('bp_get_activity_root_slug')) {
$str = preg_replace('/\\bBP_ACTIVITY_SLUG\\b/', bp_get_activity_root_slug(), $str);
}
if (function_exists('bp_get_groups_slug')) {
$str = preg_replace('/\\bBP_GROUPS_SLUG\\b/', bp_get_groups_slug(), $str);
}
if (function_exists('bp_get_members_slug')) {
$str = preg_replace('/\\bBP_MEMBERS_SLUG\\b/', bp_get_members_slug(), $str);
}
return $str;
}
示例3: bp_dtheme_ajax_invite_user
function bp_dtheme_ajax_invite_user()
{
global $bp;
check_ajax_referer('groups_invite_uninvite_user');
if (!$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id']) {
return false;
}
if (!bp_groups_user_can_send_invites($_POST['group_id']) || !friends_check_friendship($bp->loggedin_user->id, $_POST['friend_id'])) {
return false;
}
if ('invite' == $_POST['friend_action']) {
if (!groups_invite_user(array('user_id' => $_POST['friend_id'], 'group_id' => $_POST['group_id']))) {
return false;
}
$user = new BP_Core_User($_POST['friend_id']);
echo '<li id="uid-' . $user->id . '">';
echo $user->avatar_thumb;
echo '<h4>' . $user->user_link . '</h4>';
echo '<span class="activity">' . esc_attr($user->last_active) . '</span>';
echo '<div class="action">
<a class="button remove" href="' . wp_nonce_url($bp->loggedin_user->domain . bp_get_groups_slug() . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user') . '" id="uid-' . esc_attr($user->id) . '">' . __('Remove Invite', 'buddypress') . '</a>
</div>';
echo '</li>';
} else {
if ('uninvite' == $_POST['friend_action']) {
return (bool) groups_uninvite_user($_POST['friend_id'], $_POST['group_id']);
} else {
return false;
}
}
}
示例4: do_action
?>
<?php
do_action('bp_before_activity_type_tab_groups');
?>
<?php
if (bp_is_active('groups')) {
?>
<?php
if (bp_get_total_group_count_for_user(bp_loggedin_user_id())) {
?>
<li id="activity-groups"><a href="<?php
echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/';
?>
" title="<?php
_e('The activity of groups I am a member of.', 'buddypress');
?>
"><?php
printf(__('My Groups <span>%s</span>', 'buddypress'), bp_get_total_group_count_for_user(bp_loggedin_user_id()));
?>
</a></li>
<?php
}
?>
<?php
}
示例5: bp_get_group_invite_user_remove_invite_url
function bp_get_group_invite_user_remove_invite_url()
{
global $invites_template;
return wp_nonce_url(site_url(bp_get_groups_slug() . '/' . $invites_template->invite->group_id . '/invites/remove/' . $invites_template->invite->user->id), 'groups_invite_uninvite_user');
}
示例6: groups_screen_group_admin_delete_group
/**
* Handle the display of the Delete Group page.
*/
function groups_screen_group_admin_delete_group()
{
if ('delete-group' != bp_get_group_current_admin_tab()) {
return false;
}
if (!bp_is_item_admin() && !bp_current_user_can('bp_moderate')) {
return false;
}
$bp = buddypress();
if (isset($_REQUEST['delete-group-button']) && isset($_REQUEST['delete-group-understand'])) {
// Check the nonce first.
if (!check_admin_referer('groups_delete_group')) {
return false;
}
/**
* Fires before the deletion of a group from the Delete Group page.
*
* @since 1.5.0
*
* @param int $id ID of the group being deleted.
*/
do_action('groups_before_group_deleted', $bp->groups->current_group->id);
// Group admin has deleted the group, now do it.
if (!groups_delete_group($bp->groups->current_group->id)) {
bp_core_add_message(__('There was an error deleting the group. Please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('The group was deleted successfully.', 'buddypress'));
/**
* Fires after the deletion of a group from the Delete Group page.
*
* @since 1.0.0
*
* @param int $id ID of the group being deleted.
*/
do_action('groups_group_deleted', $bp->groups->current_group->id);
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()));
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()));
}
/**
* Fires before the loading of the Delete Group page template.
*
* @since 1.0.0
*
* @param int $id ID of the group that is being displayed.
*/
do_action('groups_screen_group_admin_delete_group', $bp->groups->current_group->id);
/**
* Filters the template to load for the Delete Group page.
*
* @since 1.0.0
*
* @param string $value Path to the Delete Group template.
*/
bp_core_load_template(apply_filters('groups_template_group_admin_delete_group', 'groups/single/home'));
}
示例7: setup_admin_bar
function setup_admin_bar()
{
global $bp, $blog_id;
// Prevent debug notices
$wp_admin_nav = array();
// Menus for logged in user
if (is_user_logged_in()) {
//check multisite or normal mode for correct permission checking
if (is_multisite() && $blog_id != BP_ROOT_BLOG) {
//FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
$current_blog = $blog_id;
switch_to_blog(BP_ROOT_BLOG);
$can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
$can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
$can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
switch_to_blog($current_blog);
} else {
$can_manage_events = current_user_can('edit_events');
$can_manage_locations = current_user_can('edit_locations');
$can_manage_bookings = current_user_can('manage_bookings');
}
$em_link = trailingslashit(bp_loggedin_user_domain() . em_bp_get_slug());
/* Add 'Events' to the main user profile navigation */
$wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-em-' . $this->id, 'title' => __('Events', 'dbem'), 'href' => $em_link);
/* Create SubNav Items */
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-profile', 'title' => __('My Profile', 'dbem'), 'href' => $em_link . 'profile/');
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-attending', 'title' => __('Events I\'m Attending', 'dbem'), 'href' => $em_link . 'attending/');
if ($can_manage_events) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-events', 'title' => __('My Events', 'dbem'), 'href' => $em_link . 'my-events/');
}
if ($can_manage_locations && get_option('dbem_locations_enabled')) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-locations', 'title' => __('My Locations', 'dbem'), 'href' => $em_link . 'my-locations/');
}
if ($can_manage_bookings && get_option('dbem_rsvp_enabled')) {
$wp_admin_nav[] = array('parent' => 'my-em-' . $this->id, 'id' => 'my-em-' . $this->id . '-my-bookings', 'title' => __('My Event Bookings', 'dbem'), 'href' => $em_link . 'my-bookings/');
}
if (bp_is_active('groups')) {
/* Create Profile Group Sub-Nav */
$wp_admin_nav[] = array('parent' => 'my-account-groups', 'id' => 'my-account-groups-' . $this->id, 'title' => __('Events', 'dbem'), 'href' => trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()) . 'group-events/');
}
}
parent::setup_admin_bar($wp_admin_nav);
}
示例8: bp_is_user_groups_activity
/**
* Is the current page a user's Groups activity stream?
*
* Eg http://example.com/members/joe/groups/
*
* @since 1.5.0
*
* @return bool True if the current page is a user's Groups activity stream.
*/
function bp_is_user_groups_activity()
{
if (!bp_is_active('groups')) {
return false;
}
$slug = bp_get_groups_slug() ? bp_get_groups_slug() : 'groups';
if (bp_is_user_activity() && bp_is_current_action($slug)) {
return true;
}
return false;
}
示例9: groups_notification_group_invites
function groups_notification_group_invites(&$group, &$member, $inviter_user_id)
{
global $bp;
$inviter_ud = bp_core_get_core_userdata($inviter_user_id);
$inviter_name = bp_core_get_userlink($inviter_user_id, true, false, true);
$inviter_link = bp_core_get_user_domain($inviter_user_id);
$group_link = bp_get_group_permalink($group);
if (!$member->invite_sent) {
$invited_user_id = $member->user_id;
// Post a screen notification first.
bp_core_add_notification($group->id, $invited_user_id, 'groups', 'group_invite');
if ('no' == bp_get_user_meta($invited_user_id, 'notification_groups_invite', true)) {
return false;
}
$invited_ud = bp_core_get_core_userdata($invited_user_id);
$settings_link = bp_core_get_user_domain($invited_user_id) . bp_get_settings_slug() . '/notifications/';
$invited_link = bp_core_get_user_domain($invited_user_id);
$invites_link = $invited_link . bp_get_groups_slug() . '/invites';
// Set up and send the message
$to = $invited_ud->user_email;
$sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
$subject = '[' . $sitename . '] ' . sprintf(__('You have an invitation to the group: "%s"', 'buddypress'), $group->name);
$message = sprintf(__('One of your friends %1$s has invited you to the group: "%2$s".
To view your group invites visit: %3$s
To view the group visit: %4$s
To view %5$s\'s profile visit: %6$s
---------------------
', 'buddypress'), $inviter_name, $group->name, $invites_link, $group_link, $inviter_name, $inviter_link);
$message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
/* Send the message */
$to = apply_filters('groups_notification_group_invites_to', $to);
$subject = apply_filters_ref_array('groups_notification_group_invites_subject', array($subject, &$group));
$message = apply_filters_ref_array('groups_notification_group_invites_message', array($message, &$group, $inviter_name, $inviter_link, $invites_link, $group_link, $settings_link));
wp_mail($to, $subject, $message);
do_action('bp_groups_sent_invited_email', $invited_user_id, $subject, $message, $group);
}
}
示例10: bp_get_member_activity_feed_link
/**
* Returns the member activity feed link
*
* @since 1.2.0
*
* @uses bp_is_profile_component()
* @uses bp_is_current_action()
* @uses bp_displayed_user_domain()
* @uses bp_get_activity_slug()
* @uses bp_is_active()
* @uses bp_get_friends_slug()
* @uses bp_get_groups_slug()
* @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook
*
* @return string $link The member activity feed link
*/
function bp_get_member_activity_feed_link()
{
global $bp;
if (bp_is_profile_component() || bp_is_current_action('just-me')) {
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
} elseif (bp_is_active('friends') && bp_is_current_action(bp_get_friends_slug())) {
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
} elseif (bp_is_active('groups') && bp_is_current_action(bp_get_groups_slug())) {
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
} elseif ('favorites' == $bp->current_action) {
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
} elseif ('mentions' == $bp->current_action) {
$link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
} else {
$link = '';
}
return apply_filters('bp_get_activities_member_rss_link', $link);
}
示例11: bp_get_activity_show_filters
/**
* Get available filters depending on the scope.
*
* @since BuddyPress (2.1.0)
*
* @param string $context The current context. 'activity', 'member',
* 'member_groups', 'group'
* @return string HTML for <option> values.
*/
function bp_get_activity_show_filters($context = '')
{
// Set default context based on current page
if (empty($context)) {
// On member pages, default to 'member', unless this
// is a user's Groups activity
if (bp_is_user()) {
if (bp_is_active('groups') && bp_is_current_action(bp_get_groups_slug())) {
$context = 'member_groups';
} else {
$context = 'member';
}
// On individual group pages, default to 'group'
} elseif (bp_is_active('groups') && bp_is_group()) {
$context = 'group';
// 'activity' everywhere else
} else {
$context = 'activity';
}
}
$filters = array();
// Walk through the registered actions, and prepare an the
// select box options.
foreach (bp_activity_get_actions() as $actions) {
foreach ($actions as $action) {
if (!in_array($context, (array) $action['context'])) {
continue;
}
// Friends activity collapses two filters into one
if (in_array($action['key'], array('friendship_accepted', 'friendship_created'))) {
$action['key'] = 'friendship_accepted,friendship_created';
}
$filters[$action['key']] = $action['label'];
}
}
/**
* Filters the options available in the activity filter dropdown.
*
* @since BuddyPress (2.2.0)
*
* @param array $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
* @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
*/
$filters = apply_filters('bp_get_activity_show_filters_options', $filters, $context);
// Build the options output
$output = '';
if (!empty($filters)) {
foreach ($filters as $value => $filter) {
$output .= '<option value="' . esc_attr($value) . '">' . esc_html($filter) . '</option>' . "\n";
}
}
/**
* Filters the HTML markup result for the activity filter dropdown.
*
* @since BuddyPress (2.1.0)
*
* @param string $output HTML output for the activity filter dropdown.
* @param array $filters Array of filter options for the given context, in the following format: $option_value => $option_name.
* @param string $context Context for the filter. 'activity', 'member', 'member_groups', 'group'.
*/
return apply_filters('bp_get_activity_show_filters', $output, $filters, $context);
}
示例12: test_member_groups_invitations
function test_member_groups_invitations()
{
$this->go_to(bp_core_get_user_domain(bp_loggedin_user_id()) . bp_get_groups_slug() . '/invites');
$this->assertTrue(bp_is_user_groups() && bp_is_current_action('invites'));
}
示例13: bp_activity_action_my_groups_feed
/**
* Load a user's my groups feed.
*
* @since BuddyPress (1.2)
*
* @global object $wp_query
* @uses bp_is_active()
* @uses bp_is_user_activity()
* @uses bp_is_current_action()
* @uses bp_get_groups_slug()
* @uses bp_is_action_variable()
* @uses status_header()
*
* @return bool False on failure
*/
function bp_activity_action_my_groups_feed()
{
global $wp_query;
if (!bp_is_active('groups') || !bp_is_user_activity() || !bp_is_current_action(bp_get_groups_slug()) || !bp_is_action_variable('feed', 0)) {
return false;
}
$wp_query->is_404 = false;
status_header(200);
include_once 'feeds/bp-activity-mygroups-feed.php';
die;
}
示例14: _expand_macro
private function _expand_macro($macro)
{
$value = false;
$user = wp_get_current_user();
switch ($macro) {
case 'BP_ACTIVITY_SLUG':
if (function_exists('bp_get_activity_root_slug')) {
$value = bp_get_activity_root_slug();
}
break;
case 'BP_GROUPS_SLUG':
if (function_exists('bp_get_groups_slug')) {
$value = bp_get_groups_slug();
}
break;
case 'BP_MEMBERS_SLUG':
if (function_exists('bp_get_members_slug')) {
$value = bp_get_members_slug();
}
break;
}
return apply_filters('logout_redirect-macro_value', $value, $macro);
}
示例15: bp_dtheme_ajax_invite_user
/**
* Invites a friend to join a group via a POST request.
*
* @since BuddyPress (1.2)
* @todo Audit return types
*/
function bp_dtheme_ajax_invite_user()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
check_ajax_referer('groups_invite_uninvite_user');
if (!$_POST['friend_id'] || !$_POST['friend_action'] || !$_POST['group_id']) {
return;
}
if (!bp_groups_user_can_send_invites($_POST['group_id'])) {
return;
}
if (!friends_check_friendship(bp_loggedin_user_id(), $_POST['friend_id'])) {
return;
}
$group_id = (int) $_POST['group_id'];
$friend_id = (int) $_POST['friend_id'];
if ('invite' == $_POST['friend_action']) {
$group = groups_get_group($group_id);
// Users who have previously requested membership do not need
// another invitation created for them
if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
$user_status = 'is_pending';
// Create the user invitation
} else {
if (groups_invite_user(array('user_id' => $friend_id, 'group_id' => $group_id))) {
$user_status = 'is_invited';
// Miscellaneous failure
} else {
return;
}
}
$user = new BP_Core_User($_POST['friend_id']);
echo '<li id="uid-' . $user->id . '">';
echo $user->avatar_thumb;
echo '<h4>' . $user->user_link . '</h4>';
echo '<span class="activity">' . esc_attr($user->last_active) . '</span>';
echo '<div class="action">
<a class="button remove" href="' . wp_nonce_url(bp_loggedin_user_domain() . bp_get_groups_slug() . '/' . $_POST['group_id'] . '/invites/remove/' . $user->id, 'groups_invite_uninvite_user') . '" id="uid-' . esc_attr($user->id) . '">' . __('Remove Invite', 'vibe') . '</a>
</div>';
if ('is_pending' == $user_status) {
echo '<p class="description">' . sprintf(__('%s has previously requested to join this group. Sending an invitation will automatically add the member to the group.', 'vibe'), $user->user_link) . '</p>';
}
echo '</li>';
exit;
} elseif ('uninvite' == $_POST['friend_action']) {
// Users who have previously requested membership should not
// have their requests deleted on the "uninvite" action
if (BP_Groups_Member::check_for_membership_request($friend_id, $group_id)) {
return;
}
// Remove the unsent invitation
if (!groups_uninvite_user($friend_id, $group_id)) {
return;
}
exit;
} else {
return;
}
}