if (!bp_get_new_group_id()) { ?> <input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id(); ?> " /><?php } else { ?> <input type="hidden" name="group_id" id="group_id" value="<?php bp_new_group_id(); ?> " /><?php } ?> <?php if (!bp_get_new_group_id()) { ?> </form> <?php } ?> <?php do_action('bp_after_group_send_invites_content'); ?> <?php }
function bp_new_group_id() { echo bp_get_new_group_id(); }
/** * Get the current group id * * Check for: * - current group * - new group * - group admin * * @since BuddyPress (1.8) */ public static function get_group_id() { // Usually this will work $group_id = bp_get_current_group_id(); // On the admin, get the group id out of the $_GET params if (empty($group_id) && is_admin() && (isset($_GET['page']) && 'bp-groups' === $_GET['page']) && !empty($_GET['gid'])) { $group_id = (int) $_GET['gid']; } // This fallback will only be hit when the create step is very // early if (empty($group_id) && bp_get_new_group_id()) { $group_id = bp_get_new_group_id(); } // On some setups, the group id has to be fetched out of the // $_POST array // @todo Figure out why this is happening during group creation if (empty($group_id) && isset($_POST['group_id'])) { $group_id = (int) $_POST['group_id']; } return $group_id; }
/** * The create screen save method * * @package Rendez Vous * @subpackage Groups * * @since Rendez Vous (1.1.0) * * @param int $group_id the group ID * @uses bp_get_new_group_id() to get the just created group ID * @uses Rendez_Vous_Group->edit_screen_save() to save the group extension settings */ public function create_screen_save($group_id = null) { // Check for possibly empty group_id if (empty($group_id)) { $group_id = bp_get_new_group_id(); } return $this->edit_screen_save($group_id); }
/** * bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '') * * This function is called from the template and initiates the blog creation. */ function bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '') { global $current_user, $current_site, $groupblog_create_screen; global $bp, $filtered_results; if (!is_wp_error($errors)) { $errors = new WP_Error(); } // allow definition of default variables $filtered_results = apply_filters('signup_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors)); $blogname = $filtered_results['blogname']; $blog_title = $filtered_results['blog_title']; $errors = $filtered_results['errors']; if (!isset($groupblog_create_screen)) { $groupblog_create_screen = false; } // Get the group id, which is fetched differently depending on whether this is a group // Create or Edit screen $group_id = bp_is_group_create() ? bp_get_new_group_id() : bp_get_current_group_id(); $disabled = !bp_groupblog_silent_add($group_id) || !bp_groupblog_is_blog_enabled($group_id) ? ' disabled="true" ' : ''; if (!$groupblog_create_screen) { ?> <h2><?php _e('Group Blog', 'groupblog'); ?> </h2> <form id="setupform" method="post" action="<?php bp_groupblog_admin_form_action('group-blog'); ?> "> <input type="hidden" name="stage" value="gimmeanotherblog" /> <?php do_action("signup_hidden_fields"); ?> <?php } ?> <div class="checkbox"> <label><input type="checkbox" name="groupblog-enable-blog" id="groupblog-enable-blog" value="1"<?php bp_groupblog_show_enabled($group_id); ?> /> <?php _e('Enable group blog', 'groupblog'); ?> </label> </div> <?php bp_groupblog_show_blog_form($blogname, $blog_title, $errors); ?> <br /> <div id="groupblog-member-options"> <h3><?php _e('Member Options', 'groupblog'); ?> </h3> <p><?php _e('Enable blog posting to allow adding of group members to the blog with the roles set below.', 'groupblog'); ?> <br /><?php _e('When disabled, all members will temporarily be set to subscribers, disabling posting.', 'groupblog'); ?> </p> <div class="checkbox"> <label><input<?php if (!bp_groupblog_is_blog_enabled($group_id)) { ?> disabled="true"<?php } ?> type="checkbox" name="groupblog-silent-add" id="groupblog-silent-add" value="1"<?php if (bp_groupblog_silent_add($group_id)) { ?> checked="checked"<?php } ?> /> <?php _e('Enable member blog posting', 'groupblog'); ?> </label> </div> <?php // Assign our default roles to variables. // If nothing has been saved in the groupmeta yet, then we assign our own defalt values. if (!($groupblog_default_admin_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_admin_role'))) { $groupblog_default_admin_role = $bp->groupblog->default_admin_role; } if (!($groupblog_default_mod_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_mod_role'))) { $groupblog_default_mod_role = $bp->groupblog->default_mod_role; } if (!($groupblog_default_member_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_member_role'))) { $groupblog_default_member_role = $bp->groupblog->default_member_role; } ?> <label><strong><?php _e('Default Administrator Role:', 'groupblog'); ?> </strong></label> <input type="radio" <?php checked($groupblog_default_admin_role, 'administrator'); ?> value="administrator" name="default-administrator"<?php echo $disabled; ?> /><span> <?php _e('Administrator', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_admin_role, 'editor'); ?> value="editor" name="default-administrator"<?php echo $disabled; ?> /><span> <?php _e('Editor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_admin_role, 'author'); ?> value="author" name="default-administrator"<?php echo $disabled; ?> /><span> <?php _e('Author', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_admin_role, 'contributor'); ?> value="contributor" name="default-administrator"<?php echo $disabled; ?> /><span> <?php _e('Contributor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_admin_role, 'subscriber'); ?> value="subscriber" name="default-administrator"<?php echo $disabled; ?> /><span> <?php _e('Subscriber', 'groupblog'); ?> </span> <label><strong><?php _e('Default Moderator Role:', 'groupblog'); ?> </strong></label> <input type="radio" <?php checked($groupblog_default_mod_role, 'administrator'); ?> value="administrator" name="default-moderator"<?php echo $disabled; ?> /><span> <?php _e('Administrator', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_mod_role, 'editor'); ?> value="editor" name="default-moderator"<?php echo $disabled; ?> /><span> <?php _e('Editor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_mod_role, 'author'); ?> value="author" name="default-moderator"<?php echo $disabled; ?> /><span> <?php _e('Author', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_mod_role, 'contributor'); ?> value="contributor" name="default-moderator"<?php echo $disabled; ?> /><span> <?php _e('Contributor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_mod_role, 'subscriber'); ?> value="subscriber" name="default-moderator"<?php echo $disabled; ?> /><span> <?php _e('Subscriber', 'groupblog'); ?> </span> <label><strong><?php _e('Default Member Role:', 'groupblog'); ?> </strong></label> <input type="radio" <?php checked($groupblog_default_member_role, 'administrator'); ?> value="administrator" name="default-member"<?php echo $disabled; ?> /><span> <?php _e('Administrator', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_member_role, 'editor'); ?> value="editor" name="default-member"<?php echo $disabled; ?> /><span> <?php _e('Editor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_member_role, 'author'); ?> value="author" name="default-member"<?php echo $disabled; ?> /><span> <?php _e('Author', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_member_role, 'contributor'); ?> value="contributor" name="default-member"<?php echo $disabled; ?> /><span> <?php _e('Contributor', 'groupblog'); ?> </span> <input type="radio" <?php checked($groupblog_default_member_role, 'subscriber'); ?> value="subscriber" name="default-member"<?php echo $disabled; ?> /><span> <?php _e('Subscriber', 'groupblog'); ?> </span> <div id="groupblog-member-roles"> <label><strong><?php _e('A bit about WordPress member roles:', 'groupblog'); ?> </strong></label> <ul id="groupblog-members"> <li><?php _e('Administrator', 'groupblog'); ?> - <?php _e("Somebody who has access to all the administration features.", 'groupblog'); ?> </li> <li><?php _e('Editor', 'groupblog'); ?> - <?php _e("Somebody who can publish posts, manage posts as well as manage other people's posts, etc.", 'groupblog'); ?> </li> <li><?php _e('Author', 'groupblog'); ?> - <?php _e("Somebody who can publish and manage their own posts.", 'groupblog'); ?> </li> <li><?php _e('Contributor', 'groupblog'); ?> - <?php _e("Somebody who can write and manage their posts but not publish posts.", 'groupblog'); ?> </li> <li><?php _e('Subscriber', 'groupblog'); ?> - <?php _e("Somebody who can read comments/comment/receive news letters, etc.", 'groupblog'); ?> </li> </ul> </div> </div> <br /> <?php if (bp_groupblog_allow_group_admin_layout()) { ?> <?php if (!($page_template_layout = groups_get_groupmeta($bp->groups->current_group->id, 'page_template_layout'))) { $page_template_layout = groupblog_get_page_template_layout(); } ?> <div id="groupblog-layout-options"> <h3><?php _e('Select Layout', 'groupblog'); ?> </h3> <p class="enabled"><?php _e('Please select a Layout which you would like to use for your Group Blog.', 'groupblog'); ?> </p> <table class="enabled" id="availablethemes" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="available-theme top left"> <?php echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-mag.png">'; ?> <br /><br /> <input<?php if (!bp_groupblog_is_blog_enabled($group_id)) { ?> disabled="true"<?php } ?> name="page_template_layout" id="page_template_layout" value="magazine" type="radio" <?php if ($page_template_layout == 'magazine') { echo 'checked="checked"'; } ?> /><label style="display:inline;"> <?php _e('Magazine', 'groupblog'); ?> </label> <p class="description"><?php _e('Balanced template for groups with diverse postings.', 'groupblog'); ?> </p> </td> <td class="available-theme top"> <?php echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-micro.png">'; ?> <br /><br /> <input<?php if (!bp_groupblog_is_blog_enabled($group_id)) { ?> disabled="true"<?php } ?> name="page_template_layout" id="page_template_layout" value="microblog" type="radio" <?php if ($page_template_layout == 'microblog') { echo 'checked="checked"'; } ?> /><label style="display:inline;"> <?php _e('Microblog', 'groupblog'); ?> </label> <p class="description"><?php _e('Great for simple listing of posts in a chronological order.', 'groupblog'); ?> </p> </td> </tr> </tbody> </table> </div> <br /> <?php } ?> <?php if (!$groupblog_create_screen) { ?> <p> <input id="save" type="submit" name="save" class="submit" value="<?php _e('Save Changes »', 'groupblog'); ?> "/> </p> </form> <?php } }
/** * Save the Group Forum data on create * * @since bbPress (r3465) */ public function create_screen_save($group_id = 0) { // Nonce check if (!bbp_verify_nonce_request('groups_create_save_' . $this->slug)) { bbp_add_error('bbp_create_group_forum_screen_save', __('<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress')); return; } // Check for possibly empty group_id if (empty($group_id)) { $group_id = bp_get_new_group_id(); } $create_forum = !empty($_POST['bbp-create-group-forum']) ? true : false; $forum_id = 0; $forum_ids = bbp_get_group_forum_ids($group_id); if (!empty($forum_ids)) { $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids; } // Create a forum, or not switch ($create_forum) { case true: // Bail if initial content was already created if (!empty($forum_id)) { return; } // Set the default forum status switch (bp_get_new_group_status()) { case 'hidden': $status = bbp_get_hidden_status_id(); break; case 'private': $status = bbp_get_private_status_id(); break; case 'public': default: $status = bbp_get_public_status_id(); break; } // Create the initial forum $forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status)); // Run the BP-specific functions for new groups $this->new_forum(array('forum_id' => $forum_id)); // Update forum active groups_update_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true); // Toggle forum on $this->toggle_group_forum(bp_get_new_group_id(), true); break; case false: // Forum was created but is now being undone if (!empty($forum_id)) { // Delete the forum wp_delete_post($forum_id, true); // Delete meta values groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id'); groups_delete_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id); // Toggle forum off $this->toggle_group_forum(bp_get_new_group_id(), false); } break; } }
public function create_screen_save_notab($group_id = 0) { // No nonce check, since there's no tab // Check for possibly empty group_id if (empty($group_id)) { $group_id = bp_get_new_group_id(); } // We always set this true, because we always create a forum (the user doesn't get to choose whether they want it or not anymore) $create_forum = true; //!empty( $_POST['bbp-create-group-forum'] ) ? true : false; $forum_id = 0; $forum_ids = bbp_get_group_forum_ids($group_id); if (!empty($forum_ids)) { $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids; } // Create a forum, or not switch ($create_forum) { case true: // Bail if initial content was already created if (!empty($forum_id)) { return; } // Set the default forum status switch (bp_get_new_group_status()) { case 'hidden': $status = bbp_get_hidden_status_id(); break; case 'private': $status = bbp_get_private_status_id(); break; case 'public': default: $status = bbp_get_public_status_id(); break; } // Create the initial forum $forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status)); // Run the BP-specific functions for new groups $this->new_forum(array('forum_id' => $forum_id)); // Update forum active groups_update_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true); // Toggle forum on $this->toggle_group_forum(bp_get_new_group_id(), true); break; case false: // Forum was created but is now being undone if (!empty($forum_id)) { // Delete the forum wp_delete_post($forum_id, true); // Delete meta values groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id'); groups_delete_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id); // Toggle forum off $this->toggle_group_forum(bp_get_new_group_id(), false); } break; } }
function invite_anyone_create_screen_content($event) { if (function_exists('bp_post_get_permalink')) { // ugly ugly ugly hack to check for pre-1.2 versions of BP add_action('wp_footer', 'invite_anyone_add_old_css'); ?> <?php if (bp_has_groups()) { while (bp_groups()) { bp_the_group(); ?> <?php do_action('bp_before_group_send_invites_content'); ?> <?php if ($event != 'create') { ?> <form action="<?php bp_group_send_invite_form_action(); ?> " method="post" id="send-invite-form"> <?php } ?> <div class="left-menu"> <p><?php _e("Search for members to invite:", 'bp-invite-anyone'); ?> <span class="ajax-loader"></span></p> <ul class="first acfb-holder"> <li> <input type="text" name="send-to-input" class="send-to-input" id="send-to-input" /> </li> </ul> <p><?php _e('Select members from the directory:', 'bp-invite-anyone'); ?> <span class="ajax-loader"></span></p> <div id="invite-anyone-member-list"> <ul> <?php bp_new_group_invite_member_list(); ?> </ul> <?php wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user'); ?> </div> </div> <div class="main-column"> <div id="message" class="info"> <p><?php _e('Select people to invite.', 'bp-invite-anyone'); ?> </p> </div> <?php do_action('bp_before_group_send_invites_list'); ?> <?php /* The ID 'friend-list' is important for AJAX support. */ ?> <ul id="invite-anyone-invite-list" class="item-list"> <?php if (bp_group_has_invites()) { ?> <?php while (bp_group_invites()) { bp_group_the_invite(); ?> <li id="<?php bp_group_invite_item_id(); ?> "> <?php bp_group_invite_user_avatar(); ?> <h4><?php bp_group_invite_user_link(); ?> </h4> <span class="activity"><?php bp_group_invite_user_last_active(); ?> </span> <?php do_action('bp_group_send_invites_item'); ?> <div class="action"> <a class="remove" href="<?php bp_group_invite_user_remove_invite_url(); ?> " id="<?php bp_group_invite_item_id(); ?> "><?php _e('Remove Invite', 'buddypress'); ?> </a> <?php do_action('bp_group_send_invites_item_action'); ?> </div> </li> <?php } ?> <?php } ?> </ul> <?php do_action('bp_after_group_send_invites_list'); ?> </div> <div class="clear"></div> <?php if ($event != 'create') { ?> <p class="clear"><input type="submit" name="submit" id="submit" value="<?php _e('Send Invites', 'buddypress'); ?> " /></p> <?php wp_nonce_field('groups_send_invites', '_wpnonce_send_invites'); ?> <?php } ?> <input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id(); ?> " /> <?php if ($event != 'create') { ?> </form> <?php } ?> <?php do_action('bp_before_group_send_invites_content'); ?> <?php } } } else { // Begin BP 1.2 code ?> <?php do_action('bp_before_group_send_invites_content'); ?> <?php if (invite_anyone_access_test() && !bp_is_group_create()) { ?> <p><?php _e('Want to invite someone to the group who is not yet a member of the site?', 'bp-invite-anyone'); ?> <a href="<?php echo bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . '/invite-new-members/group-invites/' . bp_get_group_id(); ?> "><?php _e('Send invitations by email.', 'bp-invite-anyone'); ?> </a></p> <?php } ?> <?php if ($event != 'create') { ?> <form action="send" method="post" id="send-invite-form"> <?php } ?> <div class="left-menu"> <p><?php _e("Search for members to invite:", 'bp-invite-anyone'); ?> <span class="ajax-loader"></span></p> <ul class="first acfb-holder"> <li> <input type="text" name="send-to-input" class="send-to-input" id="send-to-input" /> </li> </ul> <p><?php _e('Select members from the directory:', 'bp-invite-anyone'); ?> <span class="ajax-loader"></span></p> <div id="invite-anyone-member-list"> <ul> <?php bp_new_group_invite_member_list(); ?> </ul> <?php wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user'); ?> </div> </div> <div class="main-column"> <div id="message" class="info"> <p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?> </p> </div> <?php do_action('bp_before_group_send_invites_list'); ?> <?php /* The ID 'friend-list' is important for AJAX support. */ ?> <ul id="invite-anyone-invite-list" class="item-list"> <?php if (bp_group_has_invites()) { ?> <?php while (bp_group_invites()) { bp_group_the_invite(); ?> <li id="<?php bp_group_invite_item_id(); ?> "> <?php bp_group_invite_user_avatar(); ?> <h4><?php bp_group_invite_user_link(); ?> </h4> <span class="activity"><?php bp_group_invite_user_last_active(); ?> </span> <?php do_action('bp_group_send_invites_item'); ?> <div class="action"> <a class="remove" href="<?php bp_group_invite_user_remove_invite_url(); ?> " id="<?php bp_group_invite_item_id(); ?> "><?php _e('Remove Invite', 'buddypress'); ?> </a> <?php do_action('bp_group_send_invites_item_action'); ?> </div> </li> <?php } ?> <?php } ?> </ul> <?php do_action('bp_after_group_send_invites_list'); ?> </div> <div class="clear"></div> <?php if ($event != 'create') { ?> <div class="submit"> <input type="submit" name="submit" id="submit" value="<?php _e('Send Invites', 'buddypress'); ?> " /> </div> <?php } ?> <?php wp_nonce_field('groups_send_invites', '_wpnonce_send_invites'); ?> <!-- Don't leave out this sweet field --> <?php if (!bp_get_new_group_id()) { ?> <input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id(); ?> " /><?php } else { ?> <input type="hidden" name="group_id" id="group_id" value="<?php bp_new_group_id(); ?> " /><?php } ?> <?php if ($event != 'create') { ?> </form> <?php } ?> <?php do_action('bp_after_group_send_invites_content'); ?> <?php } }
/** * Save the Group Forum data on create * * @since bbPress (r3465) */ public function create_screen_save() { check_admin_referer('groups_create_save_' . $this->slug); $create_forum = !empty($_POST['bbp-create-group-forum']) ? true : false; $forum_id = 0; $forum_ids = bbp_get_group_forum_ids(bp_get_new_group_id()); if (!empty($forum_ids)) { $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids; } // Create a forum, or not switch ($create_forum) { case true: // Bail if initial content was already created if (!empty($forum_id)) { return; } // Set the default forum status switch (bp_get_new_group_status()) { case 'hidden': $status = bbp_get_hidden_status_id(); break; case 'private': $status = bbp_get_private_status_id(); break; case 'public': default: $status = bbp_get_public_status_id(); break; } // Create the initial forum $forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status)); // Run the BP-specific functions for new groups $this->new_forum(array('forum_id' => $forum_id)); break; case false: // Forum was created but is now being undone if (!empty($forum_id)) { wp_delete_post($forum_id, true); groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id'); } break; } }