bp_groupblog_signup_blog

Bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '').

Description

bp_groupblog_signup_blog( (string) $blogname = '', (string) $blog_title = '', (string) $errors = '' ); 

This function is called from the template and initiates the blog creation.

Parameters (3)

0. $blogname — Optional. (string) => ''
The blogname.
1. $blog_title — Optional. (string) => ''
The blog title.
2. $errors — Optional. (string) => ''
The errors.

Usage

  1. if ( !function_exists( 'bp_groupblog_signup_blog' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/bp-groupblog.php'; 
  3.  
  4. // The blogname. 
  5. $blogname = ''; 
  6.  
  7. // The blog title. 
  8. $blog_title = ''; 
  9.  
  10. // The errors. 
  11. $errors = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_groupblog_signup_blog($blogname, $blog_title, $errors); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bp-groupblog.php  
  1. function bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '') { 
  2. global $current_user, $current_site, $groupblog_create_screen; 
  3. global $bp, $filtered_results; 
  4.  
  5. if ( ! is_wp_error($errors) ) { 
  6. $errors = new WP_Error(); 
  7.  
  8. // allow definition of default variables 
  9. $filtered_results = apply_filters('signup_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors )); 
  10. $blogname = $filtered_results['blogname']; 
  11. $blog_title = $filtered_results['blog_title']; 
  12. $errors = $filtered_results['errors']; 
  13.  
  14. if ( !isset ( $groupblog_create_screen ) ) { 
  15. $groupblog_create_screen = false; 
  16.  
  17. // Get the group id, which is fetched differently depending on whether this is a group 
  18. // Create or Edit screen 
  19. $group_id = bp_is_group_create() ? bp_get_new_group_id() : bp_get_current_group_id(); 
  20.  
  21. ?> 
  22. <h2><?php _e( 'Group Blog', 'groupblog' ) ?></h2> 
  23. <?php 
  24.  
  25. if ( !$groupblog_create_screen ) { ?> 
  26. <input type="hidden" name="stage" value="gimmeanotherblog" /> 
  27. <?php do_action( "signup_hidden_fields" ); ?> 
  28. <?php } ?> 
  29.  
  30. <div class="checkbox"> 
  31. <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> 
  32. </div> 
  33.  
  34. <?php bp_groupblog_show_blog_form($blogname, $blog_title, $errors); ?> 
  35.  
  36. <br /> 
  37.  
  38. <div id="groupblog-member-options"> 
  39.  
  40. <h3><?php _e( 'Member Options', 'groupblog' ) ?></h3> 
  41.  
  42. <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> 
  43.  
  44. <div class="checkbox"> 
  45. <label><input 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> 
  46. </div> 
  47.  
  48. <?php 
  49. // Assign our default roles to variables. 
  50. // If nothing has been saved in the groupmeta yet, then we assign our own defalt values. 
  51. if ( !( $groupblog_default_admin_role = groups_get_groupmeta ( $bp->groups->current_group->id, 'groupblog_default_admin_role' ) ) ) { 
  52. $groupblog_default_admin_role = $bp->groupblog->default_admin_role; 
  53. if ( !( $groupblog_default_mod_role = groups_get_groupmeta ( $bp->groups->current_group->id, 'groupblog_default_mod_role' ) ) ) { 
  54. $groupblog_default_mod_role = $bp->groupblog->default_mod_role; 
  55. if ( !( $groupblog_default_member_role = groups_get_groupmeta ( $bp->groups->current_group->id, 'groupblog_default_member_role' ) ) ) { 
  56. $groupblog_default_member_role = $bp->groupblog->default_member_role; 
  57. ?> 
  58.  
  59. <label><strong><?php _e( 'Default Administrator Role:', 'groupblog' ); ?></strong></label> 
  60. <input type="radio" <?php checked( $groupblog_default_admin_role, 'administrator' ) ?> value="administrator" name="default-administrator" /><span> <?php _e( 'Administrator', 'groupblog' ); ?>  </span> 
  61. <input type="radio" <?php checked( $groupblog_default_admin_role, 'editor' ) ?> value="editor" name="default-administrator" /><span> <?php _e( 'Editor', 'groupblog' ); ?>  </span> 
  62. <input type="radio" <?php checked( $groupblog_default_admin_role, 'author' ) ?> value="author" name="default-administrator" /><span> <?php _e( 'Author', 'groupblog' ); ?>  </span> 
  63. <input type="radio" <?php checked( $groupblog_default_admin_role, 'contributor' ) ?> value="contributor" name="default-administrator" /><span> <?php _e( 'Contributor', 'groupblog' ); ?>  </span> 
  64. <input type="radio" <?php checked( $groupblog_default_admin_role, 'subscriber' ) ?> value="subscriber" name="default-administrator" /><span> <?php _e( 'Subscriber', 'groupblog' ); ?>  </span> 
  65.  
  66. <label><strong><?php _e( 'Default Moderator Role:', 'groupblog' ); ?></strong></label> 
  67. <input type="radio" <?php checked( $groupblog_default_mod_role, 'administrator' ) ?> value="administrator" name="default-moderator" /><span> <?php _e( 'Administrator', 'groupblog' ); ?>  </span> 
  68. <input type="radio" <?php checked( $groupblog_default_mod_role, 'editor' ) ?> value="editor" name="default-moderator" /><span> <?php _e( 'Editor', 'groupblog' ); ?>  </span> 
  69. <input type="radio" <?php checked( $groupblog_default_mod_role, 'author' ) ?> value="author" name="default-moderator" /><span> <?php _e( 'Author', 'groupblog' ); ?>  </span> 
  70. <input type="radio" <?php checked( $groupblog_default_mod_role, 'contributor' ) ?> value="contributor" name="default-moderator" /><span> <?php _e( 'Contributor', 'groupblog' ); ?>  </span> 
  71. <input type="radio" <?php checked( $groupblog_default_mod_role, 'subscriber' ) ?> value="subscriber" name="default-moderator" /><span> <?php _e( 'Subscriber', 'groupblog' ); ?>  </span> 
  72.  
  73. <label><strong><?php _e( 'Default Member Role:', 'groupblog' ); ?></strong></label> 
  74. <input type="radio" <?php checked( $groupblog_default_member_role, 'administrator' ) ?> value="administrator" name="default-member" /><span> <?php _e( 'Administrator', 'groupblog' ); ?>  </span> 
  75. <input type="radio" <?php checked( $groupblog_default_member_role, 'editor' ) ?> value="editor" name="default-member" /><span> <?php _e( 'Editor', 'groupblog' ); ?>  </span> 
  76. <input type="radio" <?php checked( $groupblog_default_member_role, 'author' ) ?> value="author" name="default-member" /><span> <?php _e( 'Author', 'groupblog' ); ?>  </span> 
  77. <input type="radio" <?php checked( $groupblog_default_member_role, 'contributor' ) ?> value="contributor" name="default-member" /><span> <?php _e( 'Contributor', 'groupblog' ); ?>  </span> 
  78. <input type="radio" <?php checked( $groupblog_default_member_role, 'subscriber' ) ?> value="subscriber" name="default-member" /><span> <?php _e( 'Subscriber', 'groupblog' ); ?>  </span> 
  79.  
  80. <div id="groupblog-member-roles"> 
  81. <label><strong><?php _e( 'A bit about WordPress member roles:', 'groupblog' ); ?></strong></label> 
  82. <ul id="groupblog-members"> 
  83. <li><?php _e( 'Administrator', 'groupblog' ); ?> - <?php _e( "Somebody who has access to all the administration features.", 'groupblog' ); ?></li> 
  84. <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> 
  85. <li><?php _e( 'Author', 'groupblog' ); ?> - <?php _e( "Somebody who can publish and manage their own posts.", 'groupblog' ); ?></li> 
  86. <li><?php _e( 'Contributor', 'groupblog' ); ?> - <?php _e( "Somebody who can write and manage their posts but not publish posts.", 'groupblog' ); ?></li> 
  87. <li><?php _e( 'Subscriber', 'groupblog' ); ?> - <?php _e( "Somebody who can read comments/comment/receive news letters, etc.", 'groupblog' ); ?></li> 
  88. </ul> 
  89. </div> 
  90.  
  91. </div> 
  92.  
  93. <br /> 
  94.  
  95.  
  96. <?php 
  97. if ( !( $page_template_layout = groups_get_groupmeta ( $bp->groups->current_group->id, 'page_template_layout' ) ) ) 
  98. $page_template_layout = groupblog_get_page_template_layout(); 
  99. ?> 
  100.  
  101. <div id="groupblog-layout-options"> 
  102.  
  103. <h3><?php _e( 'Select Layout', 'groupblog' ) ?></h3> 
  104.  
  105. <p class="enabled"><?php _e( 'Please select a Layout which you would like to use for your Group Blog.', 'groupblog' ) ?></p> 
  106.  
  107. <table class="enabled" id="availablethemes" cellspacing="0" cellpadding="0"> 
  108. <tbody> 
  109. <tr> 
  110. <td class="available-theme top left"> 
  111. <?php echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-mag.png">';?> 
  112. <br /><br /> 
  113. <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> 
  114. <p class="description"><?php _e( 'Balanced template for groups with diverse postings.', 'groupblog' ) ?></p> 
  115. </td> 
  116. <td class="available-theme top"> 
  117. <?php echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-micro.png">';?> 
  118. <br /><br /> 
  119. <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> 
  120. <p class="description"><?php _e( 'Great for simple listing of posts in a chronological order.', 'groupblog' ) ?></p> 
  121. </td> 
  122. </tr> 
  123. </tbody> 
  124. </table> 
  125.  
  126. </div> 
  127.  
  128. <br /> 
  129.  
  130. <?php endif; ?> 
  131.  
  132. <?php if ( !$groupblog_create_screen ) : ?> 
  133. <p> 
  134. <input id="save" type="submit" name="save" class="submit" value="<?php _e('Save Changes »', 'groupblog') ?>"/> 
  135. </p> 
  136. <?php endif;