roryg / ElementHelper

Element Helper is a MODx Revolution plugin for automatically creating elements from static files without the MODx manager.
27 stars 10 forks source link

Update plugin.elementhelper.php #5

Closed exside closed 11 years ago

exside commented 11 years ago

Added ability to specify usergroups and only run the plugin when the logged in user is member of one of the specified groups. Helps me to not slow down the page for editors, while I'm developing and have the plugin on...also created a new system setting elementhelper.usergroups, which takes a comma-delimited String of usergroups

roryg commented 11 years ago

Hi exside,

Thanks! this seems like a good idea. To make things a little easier to merge could you submit this again with the default.inc.php changes? Since they're related it makes more sense to merge them together as one rather than separately.

I'd also like to keep the code style consistent e.g. things like if block braces should be on their own lines, variables shouldn't sit on top of if blocks and there shouldn't be spaces around parenthesis. So this:

$usergroups = explode(',', $modx->getOption('elementhelper.usergroups'));
if ( $modx->user->isMember($usergroups) ) {

would change to this:

$usergroups = explode(',', $modx->getOption('elementhelper.usergroups'));

if ($modx->user->isMember($usergroups))
{

Hopefully that makes sense!

exside commented 11 years ago

done =), thanks for considering them for integration! keep it up!