Some clever functions to check current users, subscribe to organic group etc

I have been building a custom module that has Inviting users to a group feature in it. So there are this helper functions that are very useful.

user_load_by_mail($invitee_email)

will check if there is a user with specific mail, returning false if it is not, returning user object if there is one user with that email

global $user;
$account = clone($user);
og_is_member('node', $current_group->nid, 'user', $account)

will check if there is a user(user object) in a organic group, probably currently logged in user.

og_group('node',$current_group->nid, array('entity' => $account));

will add user, by user object to specific group.