Hello all!

I have a new issue I am SURE someone out there will be able to assist me with. I have a snippet of php that I am using in Rules that essentially looks like this:

$fnam = $node->field_picture['und'][0]['filename'];
print $fnam;

Trouble is, it doesn't seem to work properly. That piece of code is a test to see if drupal is finding the variable, so it only prints if it is successful. It won't work for me when I am running a rule that fires when a node is updated. If I create a rule that runs this code when a specific node is viewed, then it works.

What could I be doing wrong? Any help would be aprpeciatd, please feel free to ask for clarification as well. Thank you!


mahesh85’s picture

In your rule trigger first try to print $node object whether its getting called or not ,then try debugging .U can also use hook_node_ update to trigger any action on updating the node .

 * Implementation of hook_node_update().
function hook_node_update($node) {
  if (
$node->type == 'your_content_type') {
$fnam = $node->field_picture['und'][0]['filename'];