Changeset

4348:46fb40d7f65a

mod_invites_register: Add user to groups included in an invite
author Matthew Wild <mwild1@gmail.com>
date Sun, 17 Jan 2021 17:44:51 +0000
parents 4347:0ec482e617bb
children 4349:5ca36c36ab05
files mod_invites_register/mod_invites_register.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_invites_register/mod_invites_register.lua	Sun Jan 17 17:43:53 2021 +0000
+++ b/mod_invites_register/mod_invites_register.lua	Sun Jan 17 17:44:51 2021 +0000
@@ -143,6 +143,14 @@
 		if roles then
 			module:open_store("roles"):set(contact_username, roles);
 		end
+
+		local groups = validated_invite.additional_data.groups;
+		if groups then
+			module:log("Adding to groups...");
+			for _, group in ipairs(groups) do
+				module:open_store("groups", "map"):set(group, contact_username, true);
+			end
+		end
 	end
 end);