Commit 91ef78d0 authored by Christian Wach's avatar Christian Wach
Browse files

Add users to main site when adding to Groups groups in CLE block

parent f2a20bee
......@@ -102,6 +102,14 @@ class CRM_CiviNetworkGroups_Form_Inline_CiviNetworkGroups extends CRM_Contact_Fo
// Init error checker.
$errors = array();
// Switch to main site.
civicrm_network_groups()->hooks->switch_to_main_site( true );
// Maybe add user.
if ( ! is_user_member_of_blog( $user_id, get_main_site_id() ) ) {
add_user_to_blog( get_main_site_id(), $user_id, get_option( 'default_role' ) );
}
// Parse our groups and data.
foreach ($values['network_groups'] as $group_id => $is_member) {
......@@ -131,6 +139,9 @@ class CRM_CiviNetworkGroups_Form_Inline_CiviNetworkGroups extends CRM_Contact_Fo
}
// Switch back.
civicrm_network_groups()->hooks->switch_back( true );
// Show a message.
if (empty($errors)) {
CRM_Core_Session::setStatus(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment