Contact creator - update contact after user update

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
Elting
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Dec 14, 2009 9:58 am

Contact creator - update contact after user update

Post by Elting » Mon Jan 14, 2013 5:10 pm

Question: How to trigger contact creator?

Background: A client needs
* user (=member) registration in front end
* extra user profile fields
* list of members

Almost working now by using standard Joomla code:
1) User creates new user account (default login module)
2) User fills user profile (default user profile plugin)
3) A new contacts is created (default contact creator)
4) Member can be listed in front end (default contact list)
5) By clicking a member user details are provided (default contacts). Contact form can be submitted.
6) After login user can edit own user profile (default login module)

Re. 3: After a little hacking more user profile data is transferred to the contact. You can do so by editing the file plugins/user/contactcreator/contactcreator.php (found no way to override this plugin file). Around line 81 insert new code:

Code: Select all

  //Original code
  $contact->name = $user['name'];
  $contact->user_id = $user_id;
  $contact->email_to = $user['email'];
  $contact->catid = $category;
  //New code
  $contact->address = ($user['profile']['address1']);
  $contact->postcode = ($user['profile']['postal_code']);
  $contact->suburb = ($user['profile']['city']);
  $contact->country = ($user['profile']['country']);
  $contact->telephone = ($user['profile']['phone']);
  $contact->webpage = ($user['profile']['website']);
Now a user can create a new account with exteded profile details and a new contact will be created with these details.

BUT: When user later edits his user profile, the contact details are not updated. How to make this happen?

Locked

Return to “Administration Joomla! 2.5”