Contact form with no "View" permission

Valhalla

Well-known member
How might I enable the contact form to visitors with no "View" permission?

With no view permission, a visitor is shown an error with the login form. When they click on the "Contact Us" link, the overlay loads with the login form.

I wish to show the contact form as it would be shown to a user with the "View" permission.
 
I thought something like this.

../ControllerPublic/Abstract.php

PHP:
    protected function _assertViewingPermissions($action)
    {
        if ($action == 'contact')
        {
            return;
        }

        if (!XenForo_Visitor::getInstance()->hasPermission('general', 'view'))
        {
            throw $this->getNoPermissionResponseException();
        }
    }

EDIT: Perhaps it is not possible with the method above because the Contact Form is loaded as an overlay, and the action doesn't change from the page it has been requested on? I require the login page to be served as normal on the page, with the contact form in overlay as necessary.

EDIT: That's correct actually. I think it's not possible with the above method because the non-overlay (direct link) contact form *does* display with the above method - but not when generating an overlay (from a page with no permissions).
 
Last edited:
Back
Top Bottom