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) »
  • Wordpress edit profile - defaults and existing content missing.
Pages: [1]

Author Topic: Wordpress edit profile - defaults and existing content missing.  (Read 1342 times)

LenInkster

  • I’m new here
  • *
  • Posts: 10
  • Karma: 1
Wordpress edit profile - defaults and existing content missing.
May 16, 2014, 03:02:26 pm
Creating a page in Wordpress and using profile edit shortcut:

[civicrm component="profile" gid="14" mode="edit"]

Once the permissions are set the page displays OK to logged in users, but the Email and State entries have been blanked out.  The State default is set in the admin settings, but still shows the   -select-  option.

If someone can point me in the direction of the code that is called by the shortcode I'll attempt a fix and post back.

Wes Reimer

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: WordPress 3.9.x
  • MySQL version: 5.5.36-cll
  • PHP version: 5.3.27
Re: Wordpress edit profile - defaults and existing content missing.
June 05, 2014, 11:41:47 am
Same thing is happening to me, but what's actually happening is that Civi is creating a NEW contact instead of editing the existing one. In fact, it seems to create a new, duplicate contact every time you log in and access the profile (in my test, the Name and Address profile in edit mode). I would love some help solving this!

Wes Reimer

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: WordPress 3.9.x
  • MySQL version: 5.5.36-cll
  • PHP version: 5.3.27
Re: Wordpress edit profile - defaults and existing content missing.
June 05, 2014, 12:19:24 pm
I just found out that Synchronize Users to Contacts is also creating duplicate records. The "success" message erroneously states:

Quote
Synchronize Users to Contacts completed. Checked 355 user records. Found 355 matching contact records. Created 0 new contact records.

But it looks like it's actually creating 355 new records each time, using the info found in the WP users list (just name and email).

Both versions of this problem seem to be caused by the fact that the WP user ID in the Civi contact record does not match the actual WP user ID. This can be seen in the contact summary:

CiviCRM ID / User ID:  6802  / 260

The "260" in this example is a link that takes me to an error at wp-admin/user-edit.php?user_id=260: "Invalid user ID."

When I look at the WP user account, I can confirm from the URL that the ID is different: [...]wp-admin/user-edit.php?user_id=603&wp_http_referer=%2Fwp-admin%2Fusers.php

Oh, wait... this could be because I deleted my first WP bulk user import (due to errors in the data) and imported the same users again. So Civi must be assuming that if the ID doesn't match, it must be a new contact. Shouldn't it be comparing email addresses rather than ID's? Or some combination of both?

So, Is there a way to de-sync?
I'll do some more searching and testing.

andrewhunt

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 13
    • AGH Strategies
  • CiviCRM version: all of 'em
  • CMS version: Drupal, Joomla, and WordPress
Re: Wordpress edit profile - defaults and existing content missing.
June 05, 2014, 12:30:57 pm
If you're handy with MySQL, you should look in the civicrm_uf_match table.  That's where the CiviCRM contacts and the WordPress (or other CMS) users are matched up.  The field uf_id is the WP ID, and the field contact_id is the CiviCRM ID.  If you want to de-sync wholesale, just delete all the rows in that table, log out, and log back in.  It should then figure out who you are, and you can run the sync one last time to populate everyone else.

You can also just force it: find the row in civicrm_uf_match that matches your user ID and edit the contact ID to be your correct individual contact ID.  Then clean out all of your doppelgangers but leave the other users' rows.

This all assumes it's finding the correct users table.  If it's truly creating new contacts for everyone when you sync, even on the second or third sync, there may be some other problem.  If you moved CiviCRM from one site to another, for example, and you have table prefixes in WordPress, the users table that CiviCRM is looking for might be incorrect.  That's set at Administer / System Settings / CMS Database Integration.
You can find me at AGH Strategies.
Need help now?  Civi911 is your go-to for CiviCRM support.

Wes Reimer

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: WordPress 3.9.x
  • MySQL version: 5.5.36-cll
  • PHP version: 5.3.27
Re: Wordpress edit profile - defaults and existing content missing.
June 05, 2014, 03:18:52 pm
THANK YOU ANDREW!!! That saved me a lot of time.  :)

So I've confirmed that in fact was the problem. Now my users are sync'd properly (although I'm pretty sure the success message was still wrong: I think it said it matched 3 and created ~350 new ones when it actually matched all except one and created that one – I wish the message didn't disappear).

It looks like this was also causing the Role Sync plugin to fail, although it's still not working correctly (sets roles to "None" instead of new ones created via the Members plugin). But at least it's doing something now instead of nothing.

andrewhunt

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 13
    • AGH Strategies
  • CiviCRM version: all of 'em
  • CMS version: Drupal, Joomla, and WordPress
Re: Wordpress edit profile - defaults and existing content missing.
June 06, 2014, 08:05:18 am
Glad it worked! I'm no expert on the role sync, maybe others can help (particularly if you repost your problems in a forum for that plugin).
You can find me at AGH Strategies.
Need help now?  Civi911 is your go-to for CiviCRM support.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Wordpress edit profile - defaults and existing content missing.

This forum was archived on 2017-11-26.