bp_groupblog_process_uncouple

Catches and processes a groupblog uncoupling.

Description

bp_groupblog_process_uncouple(); 

Usage

  1. if ( !function_exists( 'bp_groupblog_process_uncouple' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/bp-groupblog.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_groupblog_process_uncouple(); 
  7.  

Defined (1)

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

/bp-groupblog.php  
  1. function bp_groupblog_process_uncouple() { 
  2. if ( bp_is_group() && bp_is_current_action( 'admin' ) && bp_is_action_variable( 'group-blog', 0 ) && bp_is_action_variable( 'uncouple', 1 ) ) { 
  3. check_admin_referer( 'groupblog-uncouple' ); 
  4.  
  5. if ( !bp_group_is_admin() ) { 
  6. bp_core_add_message( __( 'You must be a group admin to perform this action.', 'groupblog' ), error ); 
  7. bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) ); 
  8.  
  9. $blog_id = get_groupblog_blog_id(); 
  10.  
  11. // If groupblog is enabled, disable it 
  12. groups_update_groupmeta( bp_get_current_group_id(), 'groupblog_enable_blog', 0 ); 
  13.  
  14. // Unset the groupblog ID 
  15. groups_update_groupmeta( bp_get_current_group_id(), 'groupblog_blog_id', '' ); 
  16.  
  17. bp_core_add_message( __( 'Blog uncoupled.', 'groupblog' ) ); 
  18.  
  19. // Redirect to the groupblog admin 
  20. bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) . 'admin/group-blog' );