benedmunds/CodeIgniter-Ion-Auth — pull request #219 by Militis (2012-05-05 17:54:40+00:00)
Title: Optimize default group logic for registration.

I'm not sure if that was the intended behavior or not. Based on the following cases, it didn't seem to make sense.

Registering new user, no groups set. Should be true. (Add the user to the default group.)
```php
id = 50;
$groups = array();
//old
var_dump(isset($default_group->id) && isset($groups) && !empty($groups) && !in_array($default_group->id, $groups) || !isset($groups) || empty($groups));
//new
var_dump((isset($default_group->id) && !isset($groups)) || (empty($groups) && !in_array($default_group->id, $groups)));
```
Result: http://codepad.org/FBdqywDX#output

Registering new user, group set to default group. Should be false. (Default group provided, don't need to do it twice.)
```php
id = 50;
$groups = array(50);
//old
var_dump(isset($default_group->id) && isset($groups) && !empty($groups) && !in_array($default_group->id, $groups) || !isset($groups) || empty($groups));
//new
var_dump((isset($default_group->id) && !isset($groups)) || (empty($groups) && !in_array($default_group->id, $groups)));
```
Result: http://codepad.org/KOxMa0cW#output

Registering new user, group set - NOT to the default. Should be false. (Supplying a different group from the default.) //Here's where it's a bit muddy. The old way adds the user to the group supplied as well as the default group. Intended behavior?
```php
id = 50;
$groups = array(10);
//old
var_dump(isset($default_group->id) && isset($groups) && !empty($groups) && !in_array($default_group->id, $groups) || !isset($groups) || empty($groups));
//new
var_dump((isset($default_group->id) && !isset($groups)) || (empty($groups) && !in_array($default_group->id, $groups)));
```
Result: http://codepad.org/Bl0Q7KP1#output