Role updater plugin for Admidio

Version 1.0 - Compatible with Admidio version 3.1

With the help of this plugin you can easily create mailing lists from
checkbox fields in the user data.

Licensed under the MIT License (MIT)

Copyright (c) 2016 - Matthias Jentsch - info@matthias-jentsch.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Purpose:

If you want to have a mailing list you can create a role and assign certain
users to this role. But sometimes you have the role assignment also in the
user data. Example: User A wants to get the newsletter and also general
infomations. User B wants only the newsletter. And user C doesn't want any
information. For storing the information what information which user want
receive you can have two checkbox fields in the user data. So you can have the
fields "Newsletter" and "General information". Additionally you create the two
roles "Newsletter" and "General information". If you don't want to manually
assign users to the roles you can use this plugin.

Workflow of the plugin:

If the plugin is called it looks for all roles that are in the category
"Mailinglisten". The category name is configurable in the config.php file. For
all roles that are categories under the "Mailinglisten" it looks what users
have the field which have the same name as the role name set to 1. These users 
will be assinged to the role. All other users which have the field not set to
1 are removed from the role. The field has to be of type checkbox.

Installation:

Copy the folder role_updater to the adm_plugins folder. In the config.php file
you can configure in which category your mailing lists are. If you like to
create a menu entry add something like this to the my_body_bottom.php in the
folder adm_themes/modern
$moduleMenu->addItem(
	'roleupdater',
	'/adm_plugins/role_updater/role_updater.php',
	'Update mailing lists',
	'/../../adm_plugins/role_updater/role_updater.png');

Configuring mailing lists:

First create the role category which is mentioned in the config.php. To create
this category goto Role administration -> Manage categories -> Create category.
For each mailing list for which you have a checkbox field in the user data you
should create a role. Goto Role administration -> Create role. The name of the
role should be the checkbox field name. The category should be the configured
category (see config.php).

After you have configured your mailing lists call the plugin and get your users
automatically assigned to the roles. With the help of the roles you can now
send all users that are members of a certain role an Email.

Have fun and drop me a line to
info@matthias-jentsch.de
if you have any questions!