/**
	 * Function to check if the user can create new gifts
	 * @return Boolean: true if user has 'giftadmin' permission, is
	 *			a member of the giftadmin group or if $wgMaxCustomUserGiftCount
	 *			has been defined, otherwise false
	 */
	function canUserCreateGift() {
		global $wgUser, $wgMaxCustomUserGiftCount;

		if ( $wgUser->isBlocked() ) {
			return false;
		}

		$createdCount = Gifts::getCustomCreatedGiftCount( $wgUser->getID() );
		if (
			$wgUser->isAllowed( 'giftadmin' ) ||
			in_array( 'giftadmin', ( $wgUser->getGroups() ) ) ||
			( $wgMaxCustomUserGiftCount > 0 && $createdCount < $wgMaxCustomUserGiftCount )
		)
		{
			return true;
		} else {
			return false;
		}
	}