1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Contact form with no "View" permission

Discussion in 'XenForo Development Discussions' started by Valhalla, Oct 22, 2014.

  1. Valhalla

    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.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    It would require custom development/an add-on.
     
  3. Valhalla

    Valhalla Well-Known Member

    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: Oct 22, 2014

Share This Page