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 Profiles (Moderator: Dave Greenberg) »
  • Variables on redirect
Pages: [1]

Author Topic: Variables on redirect  (Read 2965 times)

andrewbelcher

  • Guest
Variables on redirect
June 15, 2009, 03:18:24 pm
Hi,

I'm trying to set up a profile for creating a new user which then needs to redirect to a page for setting up memberships. Is there a way I can pass some or all of the variables from the submitted form to the 'redirect url' when it is completed? All I need is the contact id, and I don't mind if it's done using POST or GET vars... I'm hoping it's not a hack, but if it is, what file(s) would I be looking at editting to implement it?

Thanks,
Andrew

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Variables on redirect
June 16, 2009, 05:25:54 am
Andrew:

- For profile in Advanced Settings: Redirect URL >> You can specify redirect url, but I don't think you will be able send any parameter via GET or POST without hacking core files.

- Second option would be using post hooks to redirect to specific url with required get params.

Ping us on #civicrm irc if you need any help implementing hook..

HTh

Kurund
Found this reply helpful? Support CiviCRM

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Variables on redirect
June 16, 2009, 01:04:14 pm
Note my request/suggestion that Admin is able to specify whether or not a Profile is used to create a Session so some persistence is possible in order to let users step through from one profile to another inc Event/Member registration pages
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

ccowens

  • Guest
Re: Variables on redirect
July 07, 2009, 05:47:58 pm
A more general use case or pattern...

I'd like  a profile to send the user "back to wherever you came from" on success or cancel.

I believe the correct way to do do this is to set up a pre hook that does a pushUserContext, and somehow stuff that into CancelURL and SuccessURL? 

More generally, what is the canonical way to do "back" within CiviCRM?

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: Variables on redirect
July 07, 2009, 06:12:45 pm

You can implement the below by redirecting the user in the postProcess hook to "where they came from"

in general the pattern internal to civicrm is to redirect the user to where they came from. For the public pages we give the admin control of where they want the user to goto at the end of the "transaction"

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

ccowens

  • Guest
Re: Variables on redirect
July 07, 2009, 08:05:42 pm
Quote from: Donald Lobo on July 07, 2009, 06:12:45 pm

You can implement the below by redirecting the user in the postProcess hook to "where they came from"

in general the pattern internal to civicrm is to redirect the user to where they came from. For the public pages we give the admin control of where they want the user to goto at the end of the "transaction"

lobo


What is the civicrm way of knowing "wher they came from"? In the case of a profile, can we assume that the system pushed a context frame, or do we need to do it explicitly in a preprocess hook?

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: Variables on redirect
July 07, 2009, 08:17:13 pm

argh

u'll need to implement two hooks. a buildForm hook to remember where the user originally came from (and be careful not to overwrite it when the hook is called again on submit) and then a redirect in the postProcess hook

alternatively doing a pushUserContext might work. Depends on when we set it up for that profile page

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

ccowens

  • Guest
Re: Variables on redirect
July 08, 2009, 06:52:15 am
Quote from: Donald Lobo on July 07, 2009, 08:17:13 pm

argh

u'll need to implement two hooks. a buildForm hook to remember where the user originally came from (and be careful not to overwrite it when the hook is called again on submit) and then a redirect in the postProcess hook

alternatively doing a pushUserContext might work. Depends on when we set it up for that profile page

lobo


Thanks for the help.   I'm doing this with custom profiles, so I have a blank slate to do it right. Could you point me to some portion of the civicrm code that properly reflects your current architectural thinking about the best / cleanest / most consistent with the overall thinking way to do this?


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Variables on redirect

This forum was archived on 2017-11-26.