Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

custom error page / redirect wich accepts parameters?

  • achstil
  • achstil's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #173269 by achstil
For a specific survey I would like a custom error page.


When a user request a survey with a token that has zero uses left, limesurvey presents the errorpage: "This invitation has already been used".

I would like the user to instead be redirected to a custom url, with the token passed as a parameter.

Eg. token "abc" tries to access surveyID = "123". Instead of the errorpage I would like to redirect to www.example.com/my_customerror_page?token=abc&surveyid=123


What is the best way to make that possible? Maybe with a custom theme page with a html redirect ind the header?

Sincerely
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #173273 by tpartner
You can modify layout_errors.twig. Maybe something like this:

Code:
{% if aError.type == 'survey-notstart' %}
  <!-- Redirect code here... -->
{% else %}
  <!-- Core error article here... -->
  <article id="block_error">
    <div>
      {% if aError.error %}
        <h1>{{ aError.error }}</h1>
      {% endif %}
      <h2>{{ aError.title }}</h2>
      <p>
        {{ aError.message }}
      </p>
      <p>
        {% if aError.contact %}
          {{ aError.contact }}
        {% else %}
          {{gT("For further information please contact %s:")|format (aSurveyInfo.adminname)}}
          {% if aSurveyInfo.adminemail %}
            <br>
            <a href='mailto:{{ aSurveyInfo.adminemail }}'>{{ aSurveyInfo.adminemail }}</a>
          {% endif %}
        {% endif %}
      </p>
    </div>
  </article>
{% endif %}


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose