CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCampaign (Moderators: Kiran Jagtap, xavier) »
  • Help with simple redirect hook for petition signature?
Pages: [1]

Author Topic: Help with simple redirect hook for petition signature?  (Read 583 times)

lesliejmatthews

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: drupal 7
  • MySQL version: 5.5.31
  • PHP version: 5.3.1
Help with simple redirect hook for petition signature?
October 06, 2013, 10:14:34 am
Hi - hope this is the correct forum for this question - if not advice on where to post would be appreciated.

I'm trying to write a postProcess hook to redirect to a custom thank you page when a petition signature is submitted.  (I'm very new to this, so please be forgiving!).  I've done this successfully for event registration but can't get it to work for petition signature.

Here's my code:

function vwchooks_civicrm_postProcess( $formName, &$form ) {
if ( is_a( $form, 'CRM_Campaign_Form_Petition_Signature' ) ) {
        $surveyid = $form->getVar( '_surveyId' );   
        if ( $surveyid == 15 ) {
        CRM_Utils_System::redirect('http://example.org');
      }
   }
}

Nothing happens when I implement this in my hooks module on my site.

Can anyone help?  I'm guessing have the correct variable for selecting the correct ID or something, but I'm not at all sure???

Thanks so much!

Leslie

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Help with simple redirect hook for petition signature?
October 06, 2013, 01:27:04 pm

1. what version of civicrm?

2. what page does the petition get redirected to when someone clicks submit

3. Can you put a debug statement and exit after the is_a statement and see if the code gets there

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCampaign (Moderators: Kiran Jagtap, xavier) »
  • Help with simple redirect hook for petition signature?

This forum was archived on 2017-11-26.