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) »
  • How can a user update their own profile?
Pages: [1] 2 3

Author Topic: How can a user update their own profile?  (Read 21551 times)

taokrieger

  • Guest
How can a user update their own profile?
July 08, 2008, 08:10:59 am
I've setup a CiviContribute page where visitors to my website can become members of the organization.  How do these same users change their profile information at a later date?  Ie they registered with a certain phone number or email address and want to change it later?  I think I know how to create a link to edit the profile page - but it always requires the link to include the user-id which a) the user won't know and b) I don't know how to dynamically generate.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How can a user update their own profile?
July 08, 2008, 09:54:12 am
You can generate a mailing from within civicrm and generate custom link with the contact id.

you can add an extra token (cn ?) not sure about the name nor the syntax, but it basically generate a unique "password" and add it to the link.

This "password" is valid for only a week or saw, but it allows you to send a mailing (or single email ?)  please update your contact details within the next week, http://blabla/profile/...?cid=123&cn=GDON34T9VFOB4
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

tonyg

  • Guest
Re: How can a user update their own profile?
July 08, 2008, 01:10:06 pm
Hey Xavier. Do you or anyone else out there know what token you would use to do this? This is a feature i never knew about.

thanks

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: How can a user update their own profile?
July 08, 2008, 01:40:20 pm

the token is: contact.checksum and has a life of 7 days since it was generated

Its not documented very well, and hence u've not heard of it :)

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How can a user update their own profile?
July 08, 2008, 01:45:42 pm
Lobo documented it in this thread (nicely interlaced with a bunch of my stupid questions).

http://forum.civicrm.org/index.php/topic,2074.msg13688.html

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

tonyg

  • Guest
Re: How can a user update their own profile?
July 08, 2008, 01:55:01 pm
thanks Lobo and Xavier. Learn something new everyday!

updated the documentation here: http://wiki.civicrm.org/confluence/display/CRMDOC/Linking+Profiles
« Last Edit: July 09, 2008, 09:34:53 am by tonyg »

tonyg

  • Guest
Re: How can a user update their own profile?
July 09, 2008, 10:01:07 am
I did find a bug however when reading the CiviMail message in text only. Works great in HTML format.  Described and filed here:

http://issues.civicrm.org/jira/browse/CRM-3301

unclejustin

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
  • CiviCRM version: 4.3.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.3.6
Re: How can a user update their own profile?
July 18, 2008, 07:45:07 am
I don't know if you still need to, but I found a way to dynamically add a user id into a url with a module I'm working on. If you still do need something like this, let me know, and I'll post up here what I'm doing.
-justin

tonyg

  • Guest
Re: How can a user update their own profile?
July 18, 2008, 08:09:41 am
I definitely would be interested in hearing about what you're doing and how.  It would be great if you could post something. thanks!

tony

unclejustin

  • I post occasionally
  • **
  • Posts: 38
  • Karma: 2
  • CiviCRM version: 4.3.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.3.6
Re: How can a user update their own profile?
July 18, 2008, 09:32:42 am
Well in a nutshell I made a module that creates a menu item. The menu calls back a function that just uses drupal_goto to send the user on their way. It's certainly not prime time ready, but it gets the job done for what I'm doing with it.

Example:
I have a CiviCRM profile that I want to directly link to, but to do that you need the user id. like this "user/2/edit/My+Contact+Info". See I need to swap out "2" there.

So what I do is set my replace token, and url path in the admin form. These are swapped out when you call the callback function. This creates a menu item that you can now customize in the menu admin inside drupal. I put mine in the primary links.

so, $token = "[uid]" and $path = "user/[uid]/edit/My+Contact+Info" which gets passed into drupal_goto(str_replace($token, $user->uid, $path));

Like I said needs a lot of work to be prime time ready, but hopefully this little snippet will help somebody out.

I'm attaching the module file so you can see how I put mine together.
-justin

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: How can a user update their own profile?
July 18, 2008, 09:22:34 pm
Not sure I understand what folks are trying to do here - BUT - I wanted to clarify that you do NOT need to define a contact ID for Profile Editing IF the contact is logged in.

EXAMPLE: I'm a Drupal user with User ID = 10 and linked CiviCRM Contact ID = 42. If I log in and there's a menu item linking to the following URL - it will pickup my contact data and put those values in the profile fields (gid is the Profile ID):

http://<drupal site>/civicrm/profile/edit?gid=1&reset=1
Protect your investment in CiviCRM by  becoming a Member!

tonyg

  • Guest
Re: How can a user update their own profile?
July 18, 2008, 10:25:41 pm
I understand Dave. At least where I'm coming from is to allow non-logged in users to be able to update their contact info by temporarily accessing a profile filled in with their contact data. You're correct that there is no problem for logged in users but i'm concerned with how to make this work for anonymous users.

Sending a CiviMail mailing and using the contact ID and checksum tokens would be a great way to do this, but I'm still getting the issue i describe in the issue filed here  http://issues.civicrm.org/jira/browse/CRM-3301

thanks

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: How can a user update their own profile?
July 19, 2008, 08:34:10 am
Tony - Looking closely at Lobo's test and your test in the issue comments - I see that you included {contact.contact_id} in your URL and he did not. My recollection is that only the {contact.checksum} token is needed. Can you run a quick test in your environments using the same URL pattern as Lobo describes - and verify if the profile brings up the correct contact data...

thx
dave
Protect your investment in CiviCRM by  becoming a Member!

tonyg

  • Guest
Re: How can a user update their own profile?
July 21, 2008, 08:51:58 am
Hey Dave. I tested it with one token and while it does pull up the correct profile and creates a checksum, the anonymous user's contact info is not populated.  I assumed that you needed the contact ID token so it can know who the user is and what information to populate. 

Also, you mention here the URL path needed: http://forum.civicrm.org/index.php/topic,2074.msg13688.html

And, again, in an HTML formatted message, using both tokens (id & checksum) it works fine.

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: How can a user update their own profile?
July 21, 2008, 04:40:05 pm

So the bug is with having two tokens in a URL :(. It did not work for me in either html or text mode. The regex's there are a bit hairy and i'm punting the issue to 2.2

however for 2.1, i've expanded the {contact.checksum} token to include both the contact id and the checksum, since checksum needs the contact id.

the diff for 2.0 (or earlier is here)

Code: [Select]
bash-3.2$ svn diff -r PREV CRM/Utils/Token.php
Index: CRM/Utils/Token.php
===================================================================
--- CRM/Utils/Token.php (revision 15975)
+++ CRM/Utils/Token.php (working copy)
@@ -471,7 +471,7 @@
         } else if ( $token == 'checksum' ) {
             require_once 'CRM/Contact/BAO/Contact/Utils.php';
             $cs = CRM_Contact_BAO_Contact_Utils::generateChecksum( $contact['contact_id'] );
-            $value = "cs={$cs}";
+            $value = "id={$contact['contact_id']}&cs={$cs}";
         } else {
             $value = CRM_Utils_Array::retrieveValueRecursive($contact, $token);
         }

thanx for detecting this bug. i'll see if i can convince shane to fix for 2.1 :)

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] 2 3
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How can a user update their own profile?

This forum was archived on 2017-11-26.