Remove User from NRU Group via Package
Closed this issue ยท 7 comments
In Manage packages
> Either Create subscription package
or Edit subscription package
> fieldset
of Package groups
> Add Remove from "Newly registered users" groups
:
Where Select one or more groups to remove subscribers from.
My(my friends forum) case scenario :
Remove user from Newly registered users
which has all the Never
permissions...
When user subscribe's to one of the package , remove that user from Newly registered users
.
Others case scenario :
Remove user from any groups ({that may have Never
permissions}), When user subscribe's to the package.
Of-course it should not display Pre-defined groups
just like in Package groups
,
exception to Newly registered users
group.
Exceptional case scenario , where due to human error , people might select same groups in Package groups
& Remove form groups
,
Then ignore those groups from Remove from groups
.
Hoping that you consider this feature & see it realized. ๐
Thanking you , Best regards ๐
It sounds like it would be complicated to implement.
What happens when the subscription ends? Do they get added back to the groups?
For now, let's keep it simple...
So once removed then it will stay as it is... Won't get added back to removed group.
In future you may add an option for admin to select :
- Permanently remove from group.
- Temporary remove till subscription last.
For my information, can I know how you manage package data of which group to add & then remove them after subscription ends...
I think the future scope 2nd option should do the opposite of package group addition.
Thanking you, best regards ๐
I'll give you a better flow 2moro... Let me think on it...
I might get a simple solution ... Which will get simpler for you...
Give me some time....
Best regards ๐
I think @stevotvr , this will be better :
So 1st preference will be the currently implemented one by you. ({I coined as Temporary Add Groups
}).
2nd by the Temporary Remove Groups
({You can coin that as whatever you want}) in which subscriber will be removed from till the subscription is active.
3rd by the Permanent Remove Groups
({You can coin that as whatever you want}) in which subscriber will be removed from forever.
BONUS: If you want , you can add Permanent Add Groups
but this will have 1st preference than the "currently implemented one" , in which subscriber will be added to forever.
How to handle if there are 1 or more group(s) ({That is their ID(s)}) common to all the above sets of Groups....???
Well !! let us use array_diff ( array $array1 , array $array2 [, array $... ] )
Compares array1 against one or more other arrays and returns the values in array1 that are not present in any of the other arrays.
source : https://www.php.net/manual/en/function.array-diff.php
So I see at line : https://github.com/stevotvr/phpbb-groupsub/blob/master/controller/acp_pkgs_controller.php#L285
$group_ids = $this->request->variable('pkg_groups', array(0));
This is how you get Group ID(s)...
Similarly we will get for other sets of Groups :
$temp_remove_group_ids = $this->request->variable('pkg_temp_remove_groups', array(0));
$permnt_remove_group_ids = $this->request->variable('pkg_permnt_remove_groups', array(0));
Then use array_diff()
:
$temp_remove_group_ids = array_diff($temp_remove_group_ids, $group_ids);
$permnt_remove_group_ids = array_diff($permnt_remove_group_ids, $temp_remove_group_ids);
Now all the values will be Unique across all the sets of Groups.
I hope you understand the above explanation & it's pseudo code.
Thanking you, best regards ๐