modxcms/revolution — pull request #11364 by exside (2014-05-12 19:15:59+00:00)
Title: Enhancement: Added isMember() method to modResource

This method is the equivalent of isMember() for modUser but for modResource. With this it can be checked if a resource is member of one or multiple resource groups as it can be done with a user for user groups.

This is handy for example when having a plugin automatically joining resources to resource groups OnDocFormSave. Right now, there is no elegant way (basically you have to implement this method yourself or I'm not aware of how to do this in a one liner =D) to check if a resource is already member of a resource group and if so don't try to join the resource group (which then throws an error to the log each time the plugin is running)...like that:

```
$robj = $modx->getObject('modResource', array('alias' => 'somepage'));

if (!$robj->isMember('resourcegroupname') && $robj->joinGroup('resourcegroupname')) {
echo 'added resource to resource group "resourcegroupname"';
}
```