/** * 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'))); }
/** * Add the Group Admin top-level menu when viewing group pages. * * @since 1.5.0 * * @todo Add dynamic menu items for group extensions. * * @return false|null False if not on a group page, or if user does not have * access to group admin options. */ function bp_groups_group_admin_menu() { global $wp_admin_bar; $bp = buddypress(); // Only show if viewing a group. if (!bp_is_group() || bp_is_group_create()) { return false; } // Only show this menu to group admins and super admins. if (!bp_current_user_can('bp_moderate') && !bp_group_is_admin()) { return false; } // Unique ID for the 'Edit Group' menu. $bp->group_admin_menu_id = 'group-admin'; // Add the top-level Group Admin button. $wp_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group))); // Index of the Manage tabs parent slug. $nav_index = $bp->groups->current_group->slug . '_manage'; // Check if current group has Manage tabs. if (empty($bp->bp_options_nav[$nav_index])) { return; } // Build the Group Admin menus. foreach ($bp->bp_options_nav[$nav_index] as $menu) { /** * Should we add the current manage link in the Group's "Edit" Admin Bar menu ? * * All core items will be added, plugins can use a new parameter in the BP Group Extension API * to also add the link to the "edit screen" of their group component. To do so, set the * the 'show_in_admin_bar' argument of your edit screen to true */ if ($menu['show_in_admin_bar']) { $title = sprintf(_x('Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress'), $menu['name']); // Title is specific for delete. if ('delete-group' == $menu['slug']) { $title = sprintf(_x('%s Group', 'Group WP Admin Bar delete link', 'buddypress'), $menu['name']); } $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => $menu['slug'], 'title' => $title, 'href' => bp_get_groups_action_link('admin/' . $menu['slug']))); } } }
/** * Add the Group Admin top-level menu when viewing group pages. * * @since BuddyPress (1.5.0) * * @todo Add dynamic menu items for group extensions. */ function bp_groups_group_admin_menu() { global $wp_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 (!bp_current_user_can('bp_moderate') && !bp_group_is_admin()) { return false; } // Unique ID for the 'Edit Group' menu $bp->group_admin_menu_id = 'group-admin'; // Add the top-level Group Admin button $wp_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 $wp_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 $wp_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')) { $wp_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')) { $wp_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 $wp_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') { $wp_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 $wp_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'))); }
function bp_groups_action_link($action = '', $query_args = '', $nonce = false) { echo bp_get_groups_action_link($action, $query_args, $nonce); }
function ass_admin_notice_form() { global $bp; if (groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id()) || is_super_admin()) { $submit_link = bp_get_groups_action_link('notifications'); ?> <form action="<?php echo $submit_link; ?> " method="post"> <?php wp_nonce_field('ass_email_options'); ?> <h3><?php _e('Send an email notice to everyone in the group', 'bp-ass'); ?> </h3> <p><?php _e('You can use the form below to send an email notice to all group members.', 'bp-ass'); ?> <br> <b><?php _e('Everyone in the group will receive the email -- regardless of their email settings -- so use with caution', 'bp-ass'); ?> </b>.</p> <p> <label for="ass-admin-notice-subject"><?php _e('Email Subject:', 'bp-ass'); ?> </label> <input type="text" name="ass_admin_notice_subject" id="ass-admin-notice-subject" value="" /> </p> <p> <label for="ass-admin-notice-textarea"><?php _e('Email Content:', 'bp-ass'); ?> </label> <textarea value="" name="ass_admin_notice" id="ass-admin-notice-textarea"></textarea> </p> <p> <input type="submit" name="ass_admin_notice_send" value="<?php _e('Email this notice to everyone in the group', 'bp-ass'); ?> " /> </p> <br /> <?php $welcome_email = groups_get_groupmeta(bp_get_current_group_id(), 'ass_welcome_email'); ?> <?php $welcome_email_enabled = isset($welcome_email['enabled']) ? $welcome_email['enabled'] : ''; ?> <h3><?php _e('Welcome Email', 'bp-ass'); ?> </h3> <p><?php _e('Send an email when a new member join the group.', 'bp-ass'); ?> </p> <p> <label> <input<?php checked($welcome_email_enabled, 'yes'); ?> type="checkbox" name="ass_welcome_email[enabled]" id="ass-welcome-email-enabled" value="yes" /> <?php _e('Enable welcome email', 'bp-ass'); ?> </label> </p> <p class="ass-welcome-email-field<?php if ($welcome_email_enabled != 'yes') { echo ' hide-if-js'; } ?> "> <label for="ass-welcome-email-subject"><?php _e('Email Subject:', 'bp-ass'); ?> </label> <input value="<?php echo isset($welcome_email['subject']) ? $welcome_email['subject'] : ''; ?> " type="text" name="ass_welcome_email[subject]" id="ass-welcome-email-subject" /> </p> <p class="ass-welcome-email-field<?php if ($welcome_email_enabled != 'yes') { echo ' hide-if-js'; } ?> "> <label for="ass-welcome-email-content"><?php _e('Email Content:', 'bp-ass'); ?> </label> <textarea name="ass_welcome_email[content]" id="ass-welcome-email-content"><?php echo isset($welcome_email['content']) ? $welcome_email['content'] : ''; ?> </textarea> </p> <p> <input type="submit" name="ass_welcome_email_submit" value="<?php _e('Save', 'bp-ass'); ?> " /> </p> </form> <?php } }
/** * Returns the RSS feed URL. * * @since 1.0 */ function bplf_get_feed_url() { global $this_bp_feed; switch ($this_bp_feed) { case 'member_comments': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/comments/feed/'; break; case 'member_blog_posts': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/blogposts/feed/'; break; case 'member_updates': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/updates/feed/'; break; case 'friendships': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/friendships/feed/'; break; case 'member_topics': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/forumtopics/feed/'; break; case 'member_replies': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/forumreplies/feed/'; break; case 'member_forums': $url = bp_displayed_user_domain() . bp_get_activity_slug() . '/forums/feed/'; break; case 'group_updates': $url = bp_get_groups_action_link('updates/feed'); break; case 'group_topics': $url = bp_get_groups_action_link('forumtopics/feed'); break; case 'group_topics': $url = bp_get_groups_action_link('forumreplies/feed'); break; case 'group_forums': $url = bp_get_groups_action_link('forums/feed'); break; case 'group_membership': $url = bp_get_groups_action_link('membership/feed'); break; case 'forum_topic': $url = bp_get_groups_action_link('forum/topic/' . bp_action_variable(1) . '/feed'); break; } return apply_filters('bplf_feed_url', $url); }