I'm trying my first plug-in; it's to automatically create an entry in a section when a user belonging to a specific user group is activated. However I'm not that hot at PHP and I can't figure out how I would check that the user being activated belongs to a given user group. Here's my basic code from in the main plugin file's init() function:
public function init() {
craft()->on('users.onActivateUser', function(Event $event) {
// check the user being activated belongs to the user group 'artist'
// ???
// now save an entry on their behalf
$entry = new EntryModel();
...
$success = craft()->entries->saveEntry($entry);
if (!$success)
{
Craft::log('Couldn’t save the entry "'.$entry->title.'"', LogLevel::Error);
}
}
}