bp_groupblog_show_blog_form

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

Description

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

Displays the blog signup form and takes the privacy settings from the group privacy settings, where private & hidden equal private..

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_show_blog_form' ) ) { 
  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_show_blog_form($blogname, $blog_title, $errors); 
  15.  

Defined (1)

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

/bp-groupblog.php  
  1. function bp_groupblog_show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { 
  2. global $bp, $groupblog_create_screen, $current_site; 
  3.  
  4. // Get the group id, which is fetched differently depending on whether this is a group 
  5. // Create or Edit screen 
  6. $group_id = bp_is_group_create() ? bp_get_new_group_id() : bp_get_current_group_id(); 
  7.  
  8. $blog_id = get_groupblog_blog_id(); 
  9.  
  10. ?> 
  11.  
  12. <div id="blog-details-fields"> 
  13.  
  14. <?php if ( !$groupblog_create_screen && $blog_id != '' ) : ?> 
  15. <?php /** We're showing the admin form */ ?> 
  16. <?php $blog_details = get_blog_details( get_groupblog_blog_id(), true ); ?> 
  17. <label for="blog_title"><strong><?php _e( 'Blog Title:', 'groupblog' ) ?></strong></label> 
  18. <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> 
  19. <p class="error"><?php echo $errmsg ?></p> 
  20. <?php } ?> 
  21. <p><?php echo $blog_details->blogname; ?></p> 
  22. <input name="blog_title" type="hidden" id="blog_title" value="<?php echo $blog_details->blogname; ?>" /> 
  23.  
  24. <label for="blogname"><strong><?php _e( 'Blog Address:', 'groupblog' ) ?></strong></label> 
  25. <?php if ( $errmsg = $errors->get_error_message('blogname') ) : ?> 
  26. <p class="error"><?php echo $errmsg ?></p> 
  27. <?php endif ?> 
  28.  
  29. <p><em><?php echo $blog_details->siteurl; ?> </em></p> 
  30. <input name="blogname" type="hidden" id="blogname" value="<?php echo $blog_details->siteurl; ?>" maxlength="50" /> 
  31.  
  32. <div id="uncouple-blog"> 
  33. <label for="uncouple"><?php printf( __( 'Uncouple the blog "%1$s" from the group "%2$s":', 'groupblog' ), $blog_details->blogname, $bp->groups->current_group->name ) ?></label> 
  34.  
  35. <p class="description"><?php printf( __( '<strong>Note:</strong> Uncoupling will remove the blog from your group’s navigation and prevent future synchronization of group members and blog authors, but it will not remove change blog permissions for any current member. Visit <a href="%1$s">the Users panel</a> if you’d like to remove users from the blog.', 'groupblog' ), $blog_details->siteurl . '/wp-admin/users.php' ) ?></p> 
  36.  
  37. <a class="button" href="<?php echo wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . 'admin/group-blog/uncouple', 'groupblog-uncouple' ) ?>"><?php _e( 'Uncouple', 'groupblog' ); ?></a> 
  38.  
  39. </div> 
  40.  
  41. <?php $bp->groups->current_group->status == 'public' ? $group_public = '1' : $group_public = '0'; ?> 
  42. <input type="hidden" id="blog_public" name="blog_public" value="<?php echo $group_public ?>" /> 
  43. <input type="hidden" id="groupblog_create_screen" name="groupblog_create_screen" value="<?php echo $groupblog_create_screen; ?>" /> 
  44.  
  45. <?php else : ?> 
  46. <?php /** Showing the create screen form */ ?> 
  47.  
  48. <p><?php _e( 'Choose either one of your existing blogs or create a new one all together with the details displayed below.', 'groupblog' ); ?><br /><?php _e('Take care as you can only choose once. Later you may still disable or enable the blog, but your choice is set.', 'groupblog' ); ?></p> 
  49.  
  50. <p> 
  51. <input type="radio" value="no" name="groupblog-create-new" /><span> <?php _e( 'Use one of your own available blogs:', 'groupblog' ); ?> </span> 
  52.  
  53. <?php $user_blogs = get_blogs_of_user( get_current_user_id() ) ?> 
  54.  
  55. <select name="groupblog-blogid" id="groupblog-blogid"> 
  56. <option value="0"><?php _e( 'choose a blog', 'groupblog' ) ?></option> 
  57. <?php 
  58.  
  59. foreach( (array)$user_blogs as $user_blog ) { 
  60. if ( !get_groupblog_group_id( $user_blog->userblog_id ) ) : ?> 
  61. <option value="<?php echo $user_blog->userblog_id; ?>"><?php echo $user_blog->blogname; ?></option> 
  62. <?php 
  63. endif; 
  64. } ?> 
  65. </select> 
  66. </p> 
  67.  
  68. <p> 
  69. <input type="radio" value="yes" name="groupblog-create-new" checked="checked" /><span> <?php _e( 'Or, create a new blog', 'groupblog' ); ?></span> 
  70. </p> 
  71.  
  72. <ul id="groupblog-details"> 
  73. <li> 
  74. <label class="groupblog-label" for="blog_title"><strong><?php _e( 'Blog Title:', 'groupblog' ) ?></strong></label> 
  75.  
  76. <?php if ( $errmsg = $errors->get_error_message('blog_title') ) : ?> 
  77. <span class="error"><?php echo $errmsg ?></span> 
  78. <?php endif ?> 
  79.  
  80. <?php $blog_title = isset( $_GET['invalid_name'] ) ? urldecode( $_GET['invalid_name'] ) : $bp->groups->current_group->name ?> 
  81.  
  82. <span class="gbd-value"> 
  83. <input name="blog_title" type="text" id="blog_title" value="<?php echo $blog_title ?>" /> 
  84. </span> 
  85. </li> 
  86.  
  87. <li> 
  88. <label class="groupblog-label" for="blogname"><strong><?php _e( 'Blog Address:', 'groupblog' ) ?></strong></label> 
  89. <?php if ( $errmsg = $errors->get_error_message('blogname') ) : ?> 
  90. <span class="error"><?php echo $errmsg ?></span> 
  91. <?php endif ?> 
  92.  
  93. <?php $blog_address = isset( $_GET['invalid_address'] ) ? urldecode( $_GET['invalid_address'] ) : bp_groupblog_sanitize_blog_name( $bp->groups->current_group->slug ) ?> 
  94.  
  95. <?php 
  96. // Don't suggest a subdomain if it's really long,  
  97. // since subdomains longer than 63 chars won't work. 
  98. if (strlen($blog_address > 50)) $blog_address = ""; 
  99. ?> 
  100.  
  101. <?php if (is_subdomain_install()) : ?> 
  102. <span class="gbd-value"><em>http://</em><input name="blogname" type="text" id="blogname" value="<?php echo $blog_address; ?>" maxlength="50" /><em><?php echo $current_site->domain . $current_site->path ?></em></span> 
  103. <?php else : ?> 
  104. <span class="gbd-value"><em>http://<?php echo $current_site->domain . $current_site->path ?></em><input name="blogname" type="text" id="blogname" value="<?php echo $blog_address; ?>" maxlength="50" /></span> 
  105. <?php endif ?> 
  106.  
  107. </li> 
  108. </ul> 
  109.  
  110. <?php $bp->groups->current_group->status == 'public' ? $group_public = '1' : $group_public = '0'; ?> 
  111. <input type="hidden" id="blog_public" name="blog_public" value="<?php echo $group_public ?>" /> 
  112. <input type="hidden" id="groupblog_create_screen" name="groupblog_create_screen" value="<?php echo $groupblog_create_screen; ?>" /> 
  113.  
  114. <?php endif ?> 
  115.  
  116. </div> 
  117. <?php 
  118.  
  119. do_action( 'signup_blogform', $errors );