Posted by hefox on October 14, 2010 at 8:57pm
3 followers
| Project: | Content Profile |
| Version: | 6.x-1.0 |
| Component: | Base module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
<?php
function content_profile_page_edit($type, $account) {
....
if (!$node) {
$node = array('uid' => $account->uid, 'name' => (isset($account->name) ? $account->name : ''), 'type' => $type, 'language' => '');
}
?><?php
function node_object_prepare(&$node) {
...
if (!isset($node->nid)) {
...
$node->uid = $user->uid; // eeeekkkkkkkk
$node->created = time();
?>http://api.drupal.org/api/function/node_object_prepare/6
I have a sinking feeling this is a duplicate but couldn't find it, sorry if that's the case.
Patch resets the uid based on name in prepare.
| Attachment | Size |
|---|---|
| content_profile_uid.patch | 697 bytes |
Comments
#1
Right, if statement above will sometimes invalidate if statement below.
#2
Updated patch, haven't tested other than passing validation, but using similar code elsewhere.
#3
subscribing
#4
That user_load should likely be
<?php$uid = db_result(db_query("SELECT uid from {users} where name = '%s'", $node->name));
?>
user_load isn't cached.
However, the patch is still valid, it could benefit more from being reviewed.
#5
The patch worked great =)
Anyone else able to review?
#6
I found that I also needed to set the form value for name and uid during form alter, depending on how you are passing the other user's uid in the URL.
I guess that also has to do with the fact that there are different URLs for the same thing in this module. I attached a patch that includes my additions as well.