Skip to content

Instantly share code, notes, and snippets.

@hailwood
Created February 25, 2015 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hailwood/dc667bc4e80e05c14b49 to your computer and use it in GitHub Desktop.
Save hailwood/dc667bc4e80e05c14b49 to your computer and use it in GitHub Desktop.
<?php
//Database results for groups: http://i.imgur.com/F6L8YJV.png
public function onAfterWrite() {
$customerGroup = Group::get()->Filter(array("Code" => 'shop-customers'))->First(); // group ID 3
if ($customerGroup) {
$existingMembers = $customerGroup->Members();
if ($existingMembers) {
$existingMembers->add($this->owner);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment