It seems that Profile2 7.x-1.2+ uses the following URL patterns for profile edit pages:
user/1/edit/alternate

This is as opposed to the pattern that PCP currently expects:
profile-alternate/1/edit

CommentFileSizeAuthor
#7 pcp-version-1414468.patch513 bytesjoelpittet

Comments

grasmash’s picture

Issue summary: View changes

more specific version numbers added

grasmash’s picture

Status: Active » Fixed

Version check has been added to dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

liban’s picture

Status: Closed (fixed) » Active

The links to my Profile2 fields have the following pattern.

"field-collection/field-XXXXXXXXX/4/edit&destination=profile-XXXXXXXXX/3"

And I'm unable to get PCP to work; the PCP block links just send me to a blank page. Any help please.

Thank you.

grasmash’s picture

liban, what version of profile2 are you using?

liban’s picture

Hey Madmatter23,

I'm using Profile2 7.x-1.2. And the recruiter installation (I don't know if that changes anything).

thanks for any help.

BarisW’s picture

Status: Active » Fixed

No response in a month. Confirmed that it works with the latest version of Profile2. If this is still an issue, please re-open.

joelpittet’s picture

StatusFileSize
new513 bytes

Here is a patch that allows the profile2 to catch the dev version checker as well.

version 7.x-1.2+5-dev

grabbing the 1.2 out of the middle.

joelpittet’s picture

Status: Fixed » Needs review
joelpittet’s picture

On a second look, where are you getting this new path structure from?

I have looked at 1.2 and 1.2-dev and both have the old structure.

http://drupalcode.org/project/profile2.git/blob/e176532f8b10568e42485237...

http://drupalcode.org/project/profile2.git/blob/e176532f8b10568e42485237...

nbchip’s picture

Im using profile2 1.2

PCP sends me to:
http://localhost/www/user/17/edit/athlete#edit-profile-athlete-field-per...
Correct Path , using profile2 1.2 should be:
http://localhost/www/profile-athlete/17/edit#edit-profile-athlete-field-...

So it seems that profile2 1.2 still uses old path. After overriding version check in pcp.module everything works.

BarisW’s picture

Status: Needs review » Postponed (maintainer needs more info)

Ehm, I just tried with Profile2 1.2 and I'm certain it works. Can you please double-check the version you are using?

chrbak’s picture

The problem relies on a certain setting that there is in every edit page of a profile type (profile2 version 1.2). If the 'Provide a separate page for editing profiles.' setting is checked then the link of the next empty field to complete is wrong, sending the user to a none existing page.
I think the line 438 (pcp.module file) needs to be changed to something like the code bellow :

if (is_numeric($profile2_version) && $profile2_version <= 1.1) {
	$profile_edit_path = $old_profile_edit_path;
} else {
	$profile_type = profile2_get_types($bundle);
	if ($profile_type->data['use_page'] == '0') {
		$profile_edit_path = $new_profile_edit_path;
	} else {
		$profile_edit_path = $old_profile_edit_path;
	}
}

If the $profile_type->data['use_page'] is set to 0 (not checked) the profile2 uses the new path, in the opposite case the profile2 uses the old path.

scottsawyer’s picture

This is exactly what I need. My question is:
I am currently using 7.x-1.3 release April 28, 2012.
I see the Dev version was updated July 30, 2012. I looked in pcp.module, and it appears this recommendation has been applied, is that correct?

Follow up question: I want to stick with 7.x-1.3 until a new release comes out. If I manually apply this "patch", are there any other dependencies I need to be aware of? Meaning, if I change this function, are there any other changes I need to make?

Thanks for the great work on this module, if I get it working as my customer expects, I will be in great shape.

scottsawyer’s picture

Ok, I checked out the code for 7.x-1.x-dev July 30, 2012 and it does not contain the suggestion in #12. I compared the function in this dev to the 7.x-1.3 April 28, 2012 and the they appeared identical.

So, I made the suggested edit and things seem to be working perfectly.

To recap:
With Profile2 setting Provide separate page for editing profiles selected, the PCP link pointing to a suggested field to increase completion percentage points to the wrong location. (basically, it was always pointing to user/*/edit*, I need it to point to profile-[type]/edit)

Applying the suggestion, when I have a separate Profile2 edit page, the link produced by PCP points to the correct profile location.

Have not yet tested when I have multiple profile2 types. I will check and report back.

Thanks for everyone's input on this.

chrbak’s picture

I am using code #12 with 9 profile types and i don't have any problem until now..

grasmash’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for all of the input.

I've found a simpler solution to this:

      // Determine correct 'edit path' for profile2 profile type.
      $old_profile_edit_path = 'profile-' . $bundle . '/' . $variables['uid'] . '/edit';
      $new_profile_edit_path = 'user/' . $variables['uid'] . '/edit/' . $bundle;
      $profile_edit_path = drupal_valid_path($old_profile_edit_path) ? $old_profile_edit_path : $new_profile_edit_path;

Committed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

fixed url example