if ( $wgUser->getID() == $this->user_id_to ) {
This should use the type-sensitive comparison instead. If an un-logged in user tries to give a gift to the admin, they'll get the warning g-error-message-to-yourself.