clearMetadata('roles'); $user->clearMetadata('subjects'); $user->clearMetadata('can_moderate_tools'); $user->clearMetadata('can_add_external_groups'); } if ($roles == 'moderator') { /*translation:Moderator*/ $role_text = elgg_echo("koolielu:user_role_moderator"); $user->roles = $roles; $user->subjects = $subjects; if (!empty($can_moderate_tools)) { $user->can_moderate_tools = 'true'; } else { $user->clearMetadata('can_moderate_tools'); } if (!empty($can_add_external_groups)) { $user->can_add_external_groups = 'true'; } else { $user->clearMetadata('can_add_external_groups'); } } if ($roles == 'editor') { /*translation:Editor*/ $role_text = elgg_echo("koolielu:user_role_editor"); $user->roles = $roles; $user->clearMetadata('subjects'); $user->clearMetadata('can_moderate_tools'); $user->clearMetadata('can_add_external_groups'); } if (!$roles) { /*translation:No roles given.*/ register_error(elgg_echo("koolielu:error_no_roles_given")); } else { /*translation:User role has been set to: %s*/ system_message(sprintf(elgg_echo("koolielu:user_role_has_been_set_to"), $role_text)); } } else { /*translation:No user entity provided.*/ register_error(elgg_echo('koolielu:error_no_user_entity_provided')); } forward($_SERVER['HTTP_REFERER']); ?>