/bp-themes/bp-default/groups/create.php

  1. <?php 
  2.  
  3. /** 
  4. * BuddyPress - Create Group 
  5. * 
  6. * @package BuddyPress 
  7. * @subpackage bp-default 
  8. */ 
  9.  
  10. get_header( 'buddypress' ); ?> 
  11.  
  12. <div id="content"> 
  13. <div class="padder"> 
  14.  
  15. <?php do_action( 'bp_before_create_group_content_template' ); ?> 
  16.  
  17. <form action="<?php bp_group_creation_form_action(); ?>" method="post" id="create-group-form" class="standard-form" enctype="multipart/form-data"> 
  18. <h3><?php _e( 'Create a Group', 'buddypress' ); ?>  <a class="button" href="<?php echo trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ); ?>"><?php _e( 'Groups Directory', 'buddypress' ); ?></a></h3> 
  19.  
  20. <?php do_action( 'bp_before_create_group' ); ?> 
  21.  
  22. <div class="item-list-tabs no-ajax" id="group-create-tabs" role="navigation"> 
  23. <ul> 
  24.  
  25. <?php bp_group_creation_tabs(); ?> 
  26.  
  27. </ul> 
  28. </div> 
  29.  
  30. <?php do_action( 'template_notices' ); ?> 
  31.  
  32. <div class="item-body" id="group-create-body"> 
  33.  
  34. <?php /** Group creation step 1: Basic group details */ ?> 
  35. <?php if ( bp_is_group_creation_step( 'group-details' ) ) : ?> 
  36.  
  37. <?php do_action( 'bp_before_group_details_creation_step' ); ?> 
  38.  
  39. <label for="group-name"><?php _e( 'Group Name (required)', 'buddypress' ); ?></label> 
  40. <input type="text" name="group-name" id="group-name" aria-required="true" value="<?php bp_new_group_name(); ?>" /> 
  41.  
  42. <label for="group-desc"><?php _e( 'Group Description (required)', 'buddypress' ); ?></label> 
  43. <textarea name="group-desc" id="group-desc" aria-required="true"><?php bp_new_group_description(); ?></textarea> 
  44.  
  45. <?php 
  46. do_action( 'bp_after_group_details_creation_step' ); 
  47. do_action( 'groups_custom_group_fields_editable' ); // @Deprecated 
  48.  
  49. wp_nonce_field( 'groups_create_save_group-details' ); ?> 
  50.  
  51. <?php endif; ?> 
  52.  
  53. <?php /** Group creation step 2: Group settings */ ?> 
  54. <?php if ( bp_is_group_creation_step( 'group-settings' ) ) : ?> 
  55.  
  56. <?php do_action( 'bp_before_group_settings_creation_step' ); ?> 
  57.  
  58. <h4><?php _e( 'Privacy Options', 'buddypress' ); ?></h4> 
  59.  
  60. <div class="radio"> 
  61. <label><input type="radio" name="group-status" value="public"<?php if ( 'public' == bp_get_new_group_status() || !bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> 
  62. <strong><?php _e( 'This is a public group', 'buddypress' ); ?></strong> 
  63. <ul> 
  64. <li><?php _e( 'Any site member can join this group.', 'buddypress' ); ?></li> 
  65. <li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ); ?></li> 
  66. <li><?php _e( 'Group content and activity will be visible to any site member.', 'buddypress' ); ?></li> 
  67. </ul> 
  68. </label> 
  69.  
  70. <label><input type="radio" name="group-status" value="private"<?php if ( 'private' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> 
  71. <strong><?php _e( 'This is a private group', 'buddypress' ); ?></strong> 
  72. <ul> 
  73. <li><?php _e( 'Only users who request membership and are accepted can join the group.', 'buddypress' ); ?></li> 
  74. <li><?php _e( 'This group will be listed in the groups directory and in search results.', 'buddypress' ); ?></li> 
  75. <li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ); ?></li> 
  76. </ul> 
  77. </label> 
  78.  
  79. <label><input type="radio" name="group-status" value="hidden"<?php if ( 'hidden' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> 
  80. <strong><?php _e('This is a hidden group', 'buddypress'); ?></strong> 
  81. <ul> 
  82. <li><?php _e( 'Only users who are invited can join the group.', 'buddypress' ); ?></li> 
  83. <li><?php _e( 'This group will not be listed in the groups directory or search results.', 'buddypress' ); ?></li> 
  84. <li><?php _e( 'Group content and activity will only be visible to members of the group.', 'buddypress' ); ?></li> 
  85. </ul> 
  86. </label> 
  87. </div> 
  88.  
  89. <h4><?php _e( 'Group Invitations', 'buddypress' ); ?></h4> 
  90.  
  91. <p><?php _e( 'Which members of this group are allowed to invite others?', 'buddypress' ); ?></p> 
  92.  
  93. <div class="radio"> 
  94. <label> 
  95. <input type="radio" name="group-invite-status" value="members"<?php bp_group_show_invite_status_setting( 'members' ); ?> /> 
  96. <strong><?php _e( 'All group members', 'buddypress' ); ?></strong> 
  97. </label> 
  98.  
  99. <label> 
  100. <input type="radio" name="group-invite-status" value="mods"<?php bp_group_show_invite_status_setting( 'mods' ); ?> /> 
  101. <strong><?php _e( 'Group admins and mods only', 'buddypress' ); ?></strong> 
  102. </label> 
  103.  
  104. <label> 
  105. <input type="radio" name="group-invite-status" value="admins"<?php bp_group_show_invite_status_setting( 'admins' ); ?> /> 
  106. <strong><?php _e( 'Group admins only', 'buddypress' ); ?></strong> 
  107. </label> 
  108. </div> 
  109.  
  110. <?php if ( bp_is_active( 'forums' ) ) : ?> 
  111.  
  112. <h4><?php _e( 'Group Forums', 'buddypress' ); ?></h4> 
  113.  
  114. <?php if ( bp_forums_is_installed_correctly() ) : ?> 
  115.  
  116. <p><?php _e( 'Should this group have a forum?', 'buddypress' ); ?></p> 
  117.  
  118. <div class="checkbox"> 
  119. <label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php checked( bp_get_new_group_enable_forum(), true, true ); ?> /> <?php _e( 'Enable discussion forum', 'buddypress' ); ?></label> 
  120. </div> 
  121. <?php elseif ( is_super_admin() ) : ?> 
  122.  
  123. <p><?php printf( __( '<strong>Attention Site Admin:</strong> Group forums require the <a href="%s">correct setup and configuration</a> of a bbPress installation.', 'buddypress' ), bp_core_do_network_admin() ? network_admin_url( 'settings.php?page=bb-forums-setup' ) : admin_url( 'admin.php?page=bb-forums-setup' ) ); ?></p> 
  124.  
  125. <?php endif; ?> 
  126.  
  127. <?php endif; ?> 
  128.  
  129. <?php do_action( 'bp_after_group_settings_creation_step' ); ?> 
  130.  
  131. <?php wp_nonce_field( 'groups_create_save_group-settings' ); ?> 
  132.  
  133. <?php endif; ?> 
  134.  
  135. <?php /** Group creation step 3: Avatar Uploads */ ?> 
  136. <?php if ( bp_is_group_creation_step( 'group-avatar' ) ) : ?> 
  137.  
  138. <?php do_action( 'bp_before_group_avatar_creation_step' ); ?> 
  139.  
  140. <?php if ( 'upload-image' == bp_get_avatar_admin_step() ) : ?> 
  141.  
  142. <div class="left-menu"> 
  143.  
  144. <?php bp_new_group_avatar(); ?> 
  145.  
  146. </div><!-- .left-menu --> 
  147.  
  148. <div class="main-column"> 
  149. <p><?php _e( "Upload an image to use as an avatar for this group. The image will be shown on the main group page, and in search results.", 'buddypress' ); ?></p> 
  150.  
  151. <p> 
  152. <input type="file" name="file" id="file" /> 
  153. <input type="submit" name="upload" id="upload" value="<?php esc_attr_e( 'Upload Image', 'buddypress' ); ?>" /> 
  154. <input type="hidden" name="action" id="action" value="bp_avatar_upload" /> 
  155. </p> 
  156.  
  157. <p><?php _e( 'To skip the avatar upload process, hit the "Next Step" button.', 'buddypress' ); ?></p> 
  158. </div><!-- .main-column --> 
  159.  
  160. <?php endif; ?> 
  161.  
  162. <?php if ( 'crop-image' == bp_get_avatar_admin_step() ) : ?> 
  163.  
  164. <h3><?php _e( 'Crop Group Avatar', 'buddypress' ); ?></h3> 
  165.  
  166. <img src="<?php bp_avatar_to_crop(); ?>" id="avatar-to-crop" class="avatar" alt="<?php esc_attr_e( 'Avatar to crop', 'buddypress' ); ?>" /> 
  167.  
  168. <div id="avatar-crop-pane"> 
  169. <img src="<?php bp_avatar_to_crop(); ?>" id="avatar-crop-preview" class="avatar" alt="<?php esc_attr_e( 'Avatar preview', 'buddypress' ); ?>" /> 
  170. </div> 
  171.  
  172. <input type="submit" name="avatar-crop-submit" id="avatar-crop-submit" value="<?php esc_attr_e( 'Crop Image', 'buddypress' ); ?>" /> 
  173.  
  174. <input type="hidden" name="image_src" id="image_src" value="<?php bp_avatar_to_crop_src(); ?>" /> 
  175. <input type="hidden" name="upload" id="upload" /> 
  176. <input type="hidden" id="x" name="x" /> 
  177. <input type="hidden" id="y" name="y" /> 
  178. <input type="hidden" id="w" name="w" /> 
  179. <input type="hidden" id="h" name="h" /> 
  180.  
  181. <?php endif; ?> 
  182.  
  183. <?php do_action( 'bp_after_group_avatar_creation_step' ); ?> 
  184.  
  185. <?php wp_nonce_field( 'groups_create_save_group-avatar' ); ?> 
  186.  
  187. <?php endif; ?> 
  188.  
  189. <?php /** Group creation step 4: Invite friends to group */ ?> 
  190. <?php if ( bp_is_group_creation_step( 'group-invites' ) ) : ?> 
  191.  
  192. <?php do_action( 'bp_before_group_invites_creation_step' ); ?> 
  193.  
  194. <?php if ( bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?> 
  195.  
  196. <div class="left-menu"> 
  197.  
  198. <div id="invite-list"> 
  199. <ul> 
  200. <?php bp_new_group_invite_friend_list(); ?> 
  201. </ul> 
  202.  
  203. <?php wp_nonce_field( 'groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user' ); ?> 
  204. </div> 
  205.  
  206. </div><!-- .left-menu --> 
  207.  
  208. <div class="main-column"> 
  209.  
  210. <div id="message" class="info"> 
  211. <p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p> 
  212. </div> 
  213.  
  214. <?php /** The ID 'friend-list' is important for AJAX support. */ ?> 
  215. <ul id="friend-list" class="item-list" role="main"> 
  216.  
  217. <?php if ( bp_group_has_invites() ) : ?> 
  218.  
  219. <?php while ( bp_group_invites() ) : bp_group_the_invite(); ?> 
  220.  
  221. <li id="<?php bp_group_invite_item_id(); ?>"> 
  222.  
  223. <?php bp_group_invite_user_avatar(); ?> 
  224.  
  225. <h4><?php bp_group_invite_user_link(); ?></h4> 
  226. <span class="activity"><?php bp_group_invite_user_last_active(); ?></span> 
  227.  
  228. <div class="action"> 
  229. <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> 
  230. </div> 
  231. </li> 
  232.  
  233. <?php endwhile; ?> 
  234.  
  235. <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ); ?> 
  236.  
  237. <?php endif; ?> 
  238.  
  239. </ul> 
  240.  
  241. </div><!-- .main-column --> 
  242.  
  243. <?php else : ?> 
  244.  
  245. <div id="message" class="info"> 
  246. <p><?php _e( 'Once you have built up friend connections you will be able to invite others to your group.', 'buddypress' ); ?></p> 
  247. </div> 
  248.  
  249. <?php endif; ?> 
  250.  
  251. <?php wp_nonce_field( 'groups_create_save_group-invites' ); ?> 
  252.  
  253. <?php do_action( 'bp_after_group_invites_creation_step' ); ?> 
  254.  
  255. <?php endif; ?> 
  256.  
  257. <?php do_action( 'groups_custom_create_steps' ); // Allow plugins to add custom group creation steps ?> 
  258.  
  259. <?php do_action( 'bp_before_group_creation_step_buttons' ); ?> 
  260.  
  261. <?php if ( 'crop-image' != bp_get_avatar_admin_step() ) : ?> 
  262.  
  263. <div class="submit" id="previous-next"> 
  264.  
  265. <?php /** Previous Button */ ?> 
  266. <?php if ( !bp_is_first_group_creation_step() ) : ?> 
  267.  
  268. <input type="button" value="<?php esc_attr_e( 'Back to Previous Step', 'buddypress' ); ?>" id="group-creation-previous" name="previous" onclick="location.href='<?php bp_group_creation_previous_link(); ?>'" /> 
  269.  
  270. <?php endif; ?> 
  271.  
  272. <?php /** Next Button */ ?> 
  273. <?php if ( !bp_is_last_group_creation_step() && !bp_is_first_group_creation_step() ) : ?> 
  274.  
  275. <input type="submit" value="<?php esc_attr_e( 'Next Step', 'buddypress' ); ?>" id="group-creation-next" name="save" /> 
  276.  
  277. <?php endif;?> 
  278.  
  279. <?php /** Create Button */ ?> 
  280. <?php if ( bp_is_first_group_creation_step() ) : ?> 
  281.  
  282. <input type="submit" value="<?php esc_attr_e( 'Create Group and Continue', 'buddypress' ); ?>" id="group-creation-create" name="save" /> 
  283.  
  284. <?php endif; ?> 
  285.  
  286. <?php /** Finish Button */ ?> 
  287. <?php if ( bp_is_last_group_creation_step() ) : ?> 
  288.  
  289. <input type="submit" value="<?php esc_attr_e( 'Finish', 'buddypress' ); ?>" id="group-creation-finish" name="save" /> 
  290.  
  291. <?php endif; ?> 
  292. </div> 
  293.  
  294. <?php endif;?> 
  295.  
  296. <?php do_action( 'bp_after_group_creation_step_buttons' ); ?> 
  297.  
  298. <?php /** Don't leave out this hidden field */ ?> 
  299. <input type="hidden" name="group_id" id="group_id" value="<?php bp_new_group_id(); ?>" /> 
  300.  
  301. <?php do_action( 'bp_directory_groups_content' ); ?> 
  302.  
  303. </div><!-- .item-body --> 
  304.  
  305. <?php do_action( 'bp_after_create_group' ); ?> 
  306.  
  307. </form> 
  308.  
  309. <?php do_action( 'bp_after_create_group_content_template' ); ?> 
  310.  
  311. </div><!-- .padder --> 
  312. </div><!-- #content --> 
  313.  
  314. <?php get_sidebar( 'buddypress' ); ?> 
  315. <?php get_footer( 'buddypress' ); ?> 
.