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) »
  • Using checksums with permissioned relationship profile
Pages: [1]

Author Topic: Using checksums with permissioned relationship profile  (Read 2108 times)

grigs

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.0.9
  • PHP version: 5.2.14
Using checksums with permissioned relationship profile
January 08, 2012, 12:05:10 pm
We’ve got a profile working that allows someone with a permissioned relationship to edit information for their company. The link was constructed like:

[siteroot]/profile/edit?reset=1&gid=[Profile ID]&id=[Contact Id]

Where the contact id is the company that the person has the rights to edit via a defined relationship.

What I’d like to do now is send people to that url to edit their company’s information. Obviously, editing the company information cannot be anonymous which means I need to either log people in or use a checksum. Neither seem to have obvious solutions.

1. If the person doesn’t have access to the profile page, they get redirected to the home page of the site and the url is lost. This is unlike a Drupal page that a user doesn't have access to. In Drupal, the user would get told they don't have access and would be presented with a login screen. If they fill out the login successfully, they are then redirected to their original destination.

Is that possible with a CiviCRM Profile?

2. The alternate is to use a checksum. I can get the checksum into the email template, but I suspect the checksum isn't enough to give the user access to edit the company record via the permissioned relationship. The link looks like:

/civicrm/profile/edit?reset=1&gid=12&id={contact.current_employer_id}&{contact.checksum}

Am I right about this? Should this work?

3. Any other ideas on how to accomplish sending an email to people representing a company and asking them to update their company information via their permissioned relationship?

Thank You!

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: Using checksums with permissioned relationship profile
January 09, 2012, 04:20:50 pm

1. Dont think that is possible because the drupal redirection drops all GET arguments when it redirects. We'll need to move to some version of clean urls to enable it, a non-trivial project, IMO

2. This one is probably close, the checksum that needs to be generated is the checksum of the current employer (contact.checksum will not work). One potentail way to doing this is via a token hook, wherein u implement a token for empoyer_checksum.

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

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Using checksums with permissioned relationship profile
January 09, 2012, 04:57:05 pm
Another idea would be to use the webform_civicrm module, on which you could set contact 1 as the person, and contact 2 as the employer. Then construct your link like:
mysite.org/myform?cid1={contact.contact_id}&cid2={contact.current_employer_id}&{contact.checksum}

You don't actually need to expose any fields for contact 1 in order for this to work. So the form can remain entirely about the employer and the cid1 value just gets used to check permission.
Try asking your question on the new CiviCRM help site.

grigs

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.0.9
  • PHP version: 5.2.14
Re: Using checksums with permissioned relationship profile
January 10, 2012, 04:37:04 pm
Quote from: colemanw on January 09, 2012, 04:57:05 pm
Another idea would be to use the webform_civicrm module, on which you could set contact 1 as the person, and contact 2 as the employer. Then construct your link like:
mysite.org/myform?cid1={contact.contact_id}&cid2={contact.current_employer_id}&{contact.checksum}

You don't actually need to expose any fields for contact 1 in order for this to work. So the form can remain entirely about the employer and the cid1 value just gets used to check permission.

Interesting. I spent a bit of time exploring the webform module for a different area. It's got a lot more features than I expected. I'll give it a shot.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Using checksums with permissioned relationship profile
January 25, 2012, 04:10:27 pm
Quote
It's got a lot more features than I expected
Including the ability to now generate a checksum link upon webform submission (i.e. to link users back to the same form in case they want to change their submission, or to a different form).
Look for that feature in -dev (will be in 2.4)
Try asking your question on the new CiviCRM help site.

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Using checksums with permissioned relationship profile
February 08, 2012, 08:22:36 am
Quote from: colemanw on January 09, 2012, 04:57:05 pm
Another idea would be to use the webform_civicrm module, on which you could set contact 1 as the person, and contact 2 as the employer. Then construct your link like:
mysite.org/myform?cid1={contact.contact_id}&cid2={contact.current_employer_id}&{contact.checksum}

You don't actually need to expose any fields for contact 1 in order for this to work. So the form can remain entirely about the employer and the cid1 value just gets used to check permission.

So, this would work to allow an individual to update fields on an organization? What kind of relationship do they need to have, is it configurable? I have a relationship called "Head Of Organization". I'd like any contact, with that relationship, to be able to update their org. Would this still work?

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Using checksums with permissioned relationship profile
February 10, 2012, 07:59:54 pm
I haven't tried it, but I'm pretty sure the above link would work, as long as the relationship is permissioned.
Try asking your question on the new CiviCRM help site.

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Using checksums with permissioned relationship profile
February 13, 2012, 08:45:03 am
I got it to work! Btw,

One thing I am noticing is that in the scenario above, where I am an authenticated user, and I visit the form URL without any tokens, my form is auto-filled with data about my individual record, but not my organization fields I am an employee of.

Its great I can send a civimail with tokens (that does work!) so that can be updated. But what if I want authenticated users to be able to review/update what's there at any time via URL on the site. Could I set it up so they would have the org data pre-filled too?

Thanks!

Btw, first impression of module - EPIC.  :) :)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Using checksums with permissioned relationship profile
February 18, 2012, 07:20:06 pm
Are you sure you are using the "Current Employee" relationship rather than just "Employee"?

Glad you like the module, this is actually just the tip of the proverbial iceberg in terms of auto-filling contacts based on relationships. I plan to add much more to this in upcoming versions.
Try asking your question on the new CiviCRM help site.

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Using checksums with permissioned relationship profile
February 18, 2012, 08:03:03 pm
Quote from: colemanw on February 18, 2012, 07:20:06 pm
Are you sure you are using the "Current Employee" relationship rather than just "Employee"?

Glad you like the module, this is actually just the tip of the proverbial iceberg in terms of auto-filling contacts based on relationships. I plan to add much more to this in upcoming versions.

That fixed it for me, thanks.

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Using checksums with permissioned relationship profile
May 07, 2012, 08:44:15 am
For whatever reason, this has stopped working again. How can I debug why my form does not auto fill contact 2 data?

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Using checksums with permissioned relationship profile
May 10, 2012, 10:11:55 am
And you do have the current employer set for your user?
Try asking your question on the new CiviCRM help site.

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Using checksums with permissioned relationship profile
May 10, 2012, 10:15:30 am
oops I forgot to update this thread. The issue was logged here: http://drupal.org/node/1566008

I turned on "save as draft automatically" between pages, that broke the form. Disabled it, worked again.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Using checksums with permissioned relationship profile

This forum was archived on 2017-11-26.