Skip to content

Instantly share code, notes, and snippets.

@umidjons
Created June 28, 2013 05:11
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 umidjons/5882601 to your computer and use it in GitHub Desktop.
Save umidjons/5882601 to your computer and use it in GitHub Desktop.
BX: Retrieves active users list in specified groups.
<?
/**
* Callback to use in array_filter function, which filters only active users.
* @param $userID int id of the user
* @return bool true if user is active, otherwise false
*/
function IsActive( $userID )
{
$rsUser = CUser::GetByID( $userID );
$user = $rsUser->Fetch();
return ( $user[ 'ACTIVE' ] == "Y" );
}
/* Gets users in groups 1 and 36, merges them. */
$list = array_merge( CGroup::GetGroupUser( 1 ), CGroup::GetGroupUser( 36 ) );
$list = array_filter( $list, 'IsActive' ); // list of active users
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment