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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Create URL for direct display of Contribution (in Drupal)?
Pages: [1]

Author Topic: Create URL for direct display of Contribution (in Drupal)?  (Read 1301 times)

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
Create URL for direct display of Contribution (in Drupal)?
February 27, 2008, 03:51:30 pm
I am creating Contributions programatically in Drupal, and attemping to redirect the user to view the newly-created Contribution record. This code produces a valid-looking URL:

  $pattern = 'reset=1&id=%d&cid=%d&selectedChild=contribute&action=view';
  $query   = sprintf( $pattern, $id_contact, $id_contribution );
  drupal_goto( 'civicrm/contact/view/contribution', $query );

But when it executes, I wind up at the CiviCRM dashboard looking at a "You do not have the necessary permission to view this contact" error. Is it possible to do what I am attempting? What have I missed?

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: Create URL for direct display of Contribution (in Drupal)?
February 27, 2008, 04:27:34 pm

1. does the user have permission to view contacts and contributions? You might want to login as the user and check if you can goto the url you generate

2. An easier option might be to send the user to the civicrm user dashboard page (http://drupal.demo.civicrm.org/civicrm/user?reset=1) which lists the user's current contributions etc

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

SteveM

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 3
    • OpenConcept Consulting, Inc.
Re: Create URL for direct display of Contribution (in Drupal)?
February 28, 2008, 08:30:10 am
Ha! The problem was that contact id and contribution id were reversed when I built the query string. So, if anyone else out there is also not paying close enough attention: id = contribution ID; cid = contact ID.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Create URL for direct display of Contribution (in Drupal)?

This forum was archived on 2017-11-26.