How it works

MM works by creating a series of actions (or "rules"), which can be applied to particular fields. Each rule can be applied to certain roles, certain templates or any combination or either.

For example, to rename a field for all templates and all users, you might use:

mm_renameField('pagetitle', 'Document title');

You could then restrict this only to users with a particular role by supplying a third parameter, which is an ID of one or more web user roles. You'll see a new tab when you're editing the plugin which tells you what these are.

To restrict the example above to only admin role 1, you could add:

mm_renameField('pagetitle', 'Document title', '1');

You can supply more than one role, as a comma separated list:

mm_renameField('pagetitle', 'Document title', '1,3,5');

If you want to make a rule which is "everything but" you can do this by prefixing the list with a "!". For example to apply a rule to everyone EXCEPT administrators, you could say:

mm_renameField('pagetitle', 'Document title', '!1');

Note: the exclaimation negates all the roles, you can't mix and match - for example:

mm_renameField('pagetitle', 'Document title', '!2,3');

Would apply the rule to users who are not in role 2 or 3.

Finally, if you leave the roles paramater blank, or miss it off, the rule will apply to ALL roles.

You can get further refinement to your rules, by restricting them to certain template IDs too. You can also supply template IDs using exactly the same format. For example:

mm_renameField('pagetitle', 'Document title', '', '3');

Will only apply the rule to documents with a template ID of 3.

mm_renameField('pagetitle', 'Document title', '!1', '3');

Will apply the rule to users who are not in role 1 when they edit a document with a templaye of 3.

Phew -- pretty powerful stuff, eh?

Applying it

You set the rules within the plugin code in the manager. Within the default plugin text is an indication of where they should go, along with some examples. Note that you can use PHP variables here to make things more legible -- for example to store template IDs.