Hi again,
So I've build this CCK node with various fields, some of them are userreferences. I want to access some values from PHP (in a custom CCK computedfield), but it doesn't seem to work:
- I can access e.g. the date from my field_date using $node->field_date[0]['value'];
- If I try to access a user from field_proprio, I get nothing. I tried $node->field_proprio[0]['value'] and $node->field_proprio_uid[0]['value'] but none of them work.
Could anyone tell me how I can access a user, or which bit of the copious Drupal doc I should look at ?
Thanks, Xav
On Fri, 2010-05-07 at 16:24 +0200, Xavier Bestel wrote:
Hi again,
So I've build this CCK node with various fields, some of them are userreferences. I want to access some values from PHP (in a custom CCK computedfield), but it doesn't seem to work:
- I can access e.g. the date from my field_date using
$node->field_date[0]['value'];
- If I try to access a user from field_proprio, I get nothing. I tried
$node->field_proprio[0]['value'] and $node->field_proprio_uid[0]['value'] but none of them work.
Could anyone tell me how I can access a user, or which bit of the copious Drupal doc I should look at ?
Sorry for wasting your time reading these two emails, I finally googled successfully for an answer. For those interested: $node->field_proprio[0]['uid']
I'm sure there are many other veery interesting things in Drupal. As I have a little problem to read big docs on-screen, does anyone have a good book recommandation for people who know want to do advanced things (like module creation) with Drupal ?
Thanks,
Xav
Drupal Pro Development is a must have. http://www.drupalbook.com/
On Fri, May 7, 2010 at 5:30 PM, Xavier Bestel xavier.bestel@free.fr wrote:
On Fri, 2010-05-07 at 16:24 +0200, Xavier Bestel wrote:
Hi again,
So I've build this CCK node with various fields, some of them are userreferences. I want to access some values from PHP (in a custom CCK computedfield), but it doesn't seem to work:
- I can access e.g. the date from my field_date using
$node->field_date[0]['value'];
- If I try to access a user from field_proprio, I get nothing. I tried
$node->field_proprio[0]['value'] and $node->field_proprio_uid[0]['value'] but none of them work.
Could anyone tell me how I can access a user, or which bit of the copious Drupal doc I should look at ?
Sorry for wasting your time reading these two emails, I finally googled successfully for an answer. For those interested: $node->field_proprio[0]['uid']
I'm sure there are many other veery interesting things in Drupal. As I have a little problem to read big docs on-screen, does anyone have a good book recommandation for people who know want to do advanced things (like module creation) with Drupal ?
Thanks,
Xav-- [ Drupal support list | http://lists.drupal.org/ ]
On Fri, 2010-05-07 at 17:48 +0200, Damien Cirotteau wrote:
Drupal Pro Development is a must have. http://www.drupalbook.com/
Yes, I'm very late to answer. I just got and started reading the book (D7 version). Really nice. Thanks !
Xav
I have a webform that is pretty long. Been working just fine. I pressed the cron update (manual) button today from the reports link on one of the admin screens in drupal.
Suddenly my web form (node/3) was displaying the page not found error messsage.
Looked in the tables and it seem to be there (node and web form component tables) .
As a work around, I created a new webform (node/6) then basically just copied over all my records from nid 3 to nid 6 and the new form was good to go so thankfully I did not loose any work.
But still I wonder what is wrong. I see node 3 in the node table, I see the node 3 web from info and it seems ok because when I copied the components to node 6, node 6 is displaying just fine.
Why would it say page can't be found for node 3 when I see node 3 in the node table?
Everything else seems fine. Just not sure how to proceed to debug this. I did do a google search but not much that seemed to fit my situation. My plan now is to be happy as is and don't press the manual cron job link until I'm finished using this form since this is one day use form to gather some info (survey) at a conference.
Pat
Well I got the page back up. After reading thru several blogs and logs, found one fellow that mentioned that the UID (user id) on a node did not have a corresponding record in the USER table. I checked and sure enough the UID in the NODE table did not have a USER record. So I change to my UID for the node having problems and sure enough I got my form back.
Of course the $64 question is why did it change? Why would running a drupal cron job either remove a user record (assuming that is what happened) or change the UID on a node records? ... Still working on that one.
Pat
On 2/21/2011 12:49 PM, Pat Newberry wrote:
I have a webform that is pretty long. Been working just fine. I pressed the cron update (manual) button today from the reports link on one of the admin screens in drupal.
Suddenly my web form (node/3) was displaying the page not found error messsage.
<snip>
Pat
It's hard to say what exactly happened. Perhaps you have some odd custom module which caused the problem on hook_cron?
In Drupal 6, when users are deleted using user_delete(), any nodes authored by that user are set to be authored by "Anonymous" (user uid=0). See http://api.drupal.org/api/drupal/modules--node--node.module/function/node_us...
On Wed, Feb 23, 2011 at 10:21 AM, Pat Newberry drupal@gypsyfarm.com wrote:
Well I got the page back up. After reading thru several blogs and logs, found one fellow that mentioned that the UID (user id) on a node did not have a corresponding record in the USER table. I checked and sure enough the UID in the NODE table did not have a USER record. So I change to my UID for the node having problems and sure enough I got my form back.
Of course the $64 question is why did it change? Why would running a drupal cron job either remove a user record (assuming that is what happened) or change the UID on a node records? … Still working on that one.
Pat
On 2/21/2011 12:49 PM, Pat Newberry wrote:
I have a webform that is pretty long. Been working just fine. I pressed the cron update (manual) button today from the reports link on one of the admin screens in drupal.
Suddenly my web form (node/3) was displaying the page not found error messsage.
<snip>
Pat
-- [ Drupal support list | http://lists.drupal.org/ ]
Not entirely sure what you're looking at there, but first take a look at the $node object to see what you have available for those fields. There would presumably be a UID or somesuch you could use to load a user object if you need to grab more details.
On Fri, May 7, 2010 at 8:24 AM, Xavier Bestel xavier.bestel@free.fr wrote:
Hi again,
So I've build this CCK node with various fields, some of them are userreferences. I want to access some values from PHP (in a custom CCK computedfield), but it doesn't seem to work:
- I can access e.g. the date from my field_date using
$node->field_date[0]['value'];
- If I try to access a user from field_proprio, I get nothing. I tried
$node->field_proprio[0]['value'] and $node->field_proprio_uid[0]['value'] but none of them work.
Could anyone tell me how I can access a user, or which bit of the copious Drupal doc I should look at ?
Thanks, Xav
-- [ Drupal support list | http://lists.drupal.org/ ]