groupblog_edit_base_settings

Groupblog_edit_base_settings().

Description

Updates the groupmeta with the blog_id, default roles and if it is enabled or not. Initiating member permissions loop on save - by Boone

Parameters (8)

0. $groupblog_enable_blog
The groupblog enable blog.
1. $groupblog_silent_add
The groupblog silent add.
2. $groupblog_default_admin_role
The groupblog default admin role.
3. $groupblog_default_mod_role
The groupblog default mod role.
4. $groupblog_default_member_role
The groupblog default member role.
5. $page_template_layout
The page template layout.
6. $group_id
The group id.
7. $groupblog_blog_id — Optional. (null) => null
The groupblog blog id.

Usage

  1. if ( !function_exists( 'groupblog_edit_base_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bp-groupblog/bp-groupblog.php'; 
  3.  
  4. // The groupblog enable blog. 
  5. $groupblog_enable_blog = null; 
  6.  
  7. // The groupblog silent add. 
  8. $groupblog_silent_add = null; 
  9.  
  10. // The groupblog default admin role. 
  11. $groupblog_default_admin_role = null; 
  12.  
  13. // The groupblog default mod role. 
  14. $groupblog_default_mod_role = null; 
  15.  
  16. // The groupblog default member role. 
  17. $groupblog_default_member_role = null; 
  18.  
  19. // The page template layout. 
  20. $page_template_layout = null; 
  21.  
  22. // The group id. 
  23. $group_id = null; 
  24.  
  25. // The groupblog blog id. 
  26. $groupblog_blog_id = null; 
  27.  
  28. // NOTICE! Understand what this does before running. 
  29. $result = groupblog_edit_base_settings($groupblog_enable_blog, $groupblog_silent_add, $groupblog_default_admin_role, $groupblog_default_mod_role, $groupblog_default_member_role, $page_template_layout, $group_id, $groupblog_blog_id); 
  30.  

Defined (1)

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

/bp-groupblog.php  
  1. function groupblog_edit_base_settings( $groupblog_enable_blog, $groupblog_silent_add = NULL, $groupblog_default_admin_role, $groupblog_default_mod_role, $groupblog_default_member_role, $page_template_layout, $group_id, $groupblog_blog_id = NULL ) { 
  2. global $bp; 
  3.  
  4. $group_id = (int)$group_id; 
  5.  
  6. if ( empty( $group_id ) ) 
  7. return false; 
  8.  
  9. $default_role_array = array( 'groupblog_default_admin_role' => $groupblog_default_admin_role, 'groupblog_default_mod_role' => $groupblog_default_mod_role, 'groupblog_default_member_role' => $groupblog_default_member_role ); 
  10.  
  11. $update_users = false; 
  12.  
  13. foreach ( $default_role_array as $role_name => $role ) { 
  14. $old_default_role = groups_get_groupmeta ( $group_id, $role_name ); 
  15. if ( $role != $old_default_role ) { 
  16. $update_users = true; 
  17. break; 
  18.  
  19. groups_update_groupmeta ( $group_id, 'groupblog_enable_blog', $groupblog_enable_blog ); 
  20. groups_update_groupmeta ( $group_id, 'groupblog_blog_id', $groupblog_blog_id ); 
  21. groups_update_groupmeta ( $group_id, 'groupblog_silent_add', $groupblog_silent_add ); 
  22.  
  23. groups_update_groupmeta ( $group_id, 'groupblog_default_admin_role', $groupblog_default_admin_role ); 
  24. groups_update_groupmeta ( $group_id, 'groupblog_default_mod_role', $groupblog_default_mod_role ); 
  25. groups_update_groupmeta ( $group_id, 'groupblog_default_member_role', $groupblog_default_member_role ); 
  26.  
  27. groups_update_groupmeta ( $group_id, 'page_template_layout', $page_template_layout ); 
  28.  
  29. if ( $update_users ) { 
  30. bp_groupblog_member_join( $group_id ); 
  31.  
  32. do_action( 'groups_details_updated', $group_id ); 
  33.  
  34. return true;