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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How to set error in session, so that it displays when user is redirected?
Pages: [1]

Author Topic: How to set error in session, so that it displays when user is redirected?  (Read 674 times)

simonium

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
How to set error in session, so that it displays when user is redirected?
November 13, 2012, 06:09:28 am
Hi there,

I'm creating payment processor extension.  It uses the redirect method.  The payment gateway don't like 'Location: ' headers, so I have to redirect the user to the thank you page / card declined page using a meta refresh tag.

I need to display an error to the user when the transaction has failed. Is there a way set a error in the session so that it will be displayed when the user is redirected?

I tried using the pageRun hook, but I can't get hooks to fire in my extension.


Thanks for you help...


Simon.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: How to set error in session, so that it displays when user is redirected?
November 13, 2012, 10:22:12 am
Try using the
Code: [Select]
CRM_Core_Error::createError($yourerrormessage);
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

simonium

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
Re: How to set error in session, so that it displays when user is redirected?
November 14, 2012, 02:26:27 am
Hi Erik,


Thanks the advice.  I tried using:

CRM_Core_Error::createError("Card Declined by Bank");

I also tried using :

CRM_Core_Session::setStatus("There was a problem with your payment.", "Card Declined by Provider", "error");

But still no error was displayed on the page I redirected the user to.  Surely there is a way to enqueue a message in the system.


Simon.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: How to set error in session, so that it displays when user is redirected?
November 14, 2012, 02:39:09 am
I would expect so, and I would expect both of the things that you tried to work. What CiviCRM version are you on? And try to get some help on the CiviCRM IRC room?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • How to set error in session, so that it displays when user is redirected?

This forum was archived on 2017-11-26.