[support] How to bypass permissions for node_save() ?

Xavier Bestel xavier.bestel at free.fr
Tue Mar 22 14:48:48 UTC 2011


Hi,

I need a custom field for my users. So I created a computed_field in
everyone's content_profile, so far so good.
Now the problem is when I want to recompute that field from another
user's action, it seems it fails because of the permissions.
Here's a part of the code:

foreach($comptes as $uid => $val) {
    $result = db_query("SELECT name from {users} where uid = '%d'",
$uid);
    $user = drupal_unpack(db_fetch_object($result));
    $profilnode = content_profile_load('profile', $uid);
    if($profilnode)
        node_save($profilnode); /* update the computed_field */
}

How can I bypass the permissions system to make node_save() work ?
I'm using Drupal 6.

Thanks,
	Xav



PS: please Cc: me on answers



More information about the support mailing list