On the page /node/11144/edit (which is a content profile node), the user account fields are loaded into the page. However, it's loading the account details of the wrong user.

In account_profile_form_alter, it does the following:

case $profile . '_node_form':
/* integration with account form */
if (is_numeric(arg(1)) && $user = user_load(arg(1))) { // activate only on edit page (not on registration page)
module_load_include('pages.inc', 'user');
$account_form = user_profile_form(array(), $user);
?>

arg(1) is the Node ID, not the ID of the user who owns that node.

Comments

mrfelton’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Here is a patch.

robert castelo’s picture

patch above will break on account edit page, causing account fields not to display (Username, password,...).

Here's the code to fix issue on account edit page and content profile edit page. Will provide as a proper patch tomorrow:

      /* integration with account form */
      if (is_numeric(arg(1))) { // activate only on edit page (not on registration page) 

					if (arg(0) == 'user') { // on account edit page
						$user = user_load(arg(1));	
					}
					elseif (arg(0) == 'node') { // on content profile node edit page
						$node = node_load(arg(1));
						$user = user_load($node->uid);
					}
kenorb’s picture

Status: Needs review » Needs work
kenorb’s picture

robert castelo’s picture

#999980: Wrong user account data loaded has a knock on effect on #992894: Content profile node saved by anonymous because it gets the wrong user ID if on a profile edit page and then that gets used later on in the function.

robert castelo’s picture

StatusFileSize
new1.01 KB

patch attached.

robert castelo’s picture

Status: Needs work » Needs review
kenorb’s picture

StatusFileSize
new935 bytes

Patch against the latest git version.

kenorb’s picture

Status: Needs review » Fixed

Patch makes sense.
Committed.
http://drupalcode.org/project/account_profile.git/commit/bf367e4
Thank you for your work.

Status: Fixed » Closed (fixed)

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