public static function getCommonGroups($uid, $pid)
	{
		// Get the groups the visiting user
		$xgroups = self::getGroups($uid, 'all', 1);

		$usersgroups = array();
		if (!empty($xgroups))
		{
			foreach ($xgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$usersgroups[] = $group->cn;
				}
			}
		}

		// Get the groups of the profile
		$pgroups = self::getGroups($pid, 'all', 1);

		// Get the groups the user has access to
		$profilesgroups = array();
		if (!empty($pgroups))
		{
			foreach ($pgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$profilesgroups[] = $group->cn;
				}
			}
		}

		// Find the common groups
		return array_intersect($usersgroups, $profilesgroups);
	}
public static function getCommonGroups($uid, $pid)
	{
		// Get the groups the visiting user
		$xgroups = self::getGroups($uid, 'all', 1);

		$usersgroups = array();
		if (!empty($xgroups))
		{
			foreach ($xgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$usersgroups[] = $group->cn;
				}
			}
		}

		// Get the groups of the profile
		$pgroups = self::getGroups($pid, 'all', 1);

		// Get the groups the user has access to
		$profilesgroups = array();
		if (!empty($pgroups))
		{
			foreach ($pgroups as $group)
			{
				if ($group->regconfirmed)
				{
					$profilesgroups[] = $group->cn;
				}
			}
		}

		// Find the common groups
		return array_intersect($usersgroups, $profilesgroups);
	}
public static function getCommonGroups ( $ uid , $ pid ) { // Get the groups the visiting user $ xgroups = self :: getGroups ( $ uid , 'all' , 1 ) ; $ usersgroups = array ( ) ; if ( ! empty ( $ xgroups ) ) { foreach ( $ xgroups as $ group ) { if ( $ group -> regconfirmed ) { $ usersgroups [ ] = $ group -> cn ; } } } // Get the groups of the profile $ pgroups = self :: getGroups ( $ pid , 'all' , 1 ) ; // Get the groups the user has access to $ profilesgroups = array ( ) ; if ( ! empty ( $ pgroups ) ) { foreach ( $ pgroups as $ group ) { if ( $ group -> regconfirmed ) { $ profilesgroups [ ] = $ group -> cn ; } } } // Find the common groups return array_intersect ( $ usersgroups , $ profilesgroups ) ; }
Get common groups between two users

@param   integer  $uid
@param   integer  $pid
@return  boolean
Get common groups between two users