Hi, thanks for reading.

I have a D7 install. I'm trying to use Rules to enter data into a field that is not a core field. The field is created by the Feeds Module, and it is the URL of the feed source.

In the Database, the table is called "feeds_source" and the field is called "source".

The Rule Type is "Execute PHP Code". I've confirmed in the debug that the rule is firing.

The non-working php code is as follows:

$entity->feeds_source->source = "http://example.com";

I'm a novice at php so I'm not sure if I have to enhance my code to be a function, do a db_query, or if my syntax is wrong.

Please help point me in the right direction. Thanks

Comments

ShawnNYC’s picture

bump

smira’s picture

try this
-install and enable the Devel module. this will allow you to see the structure of the arrays and objects that make out the node you are trying to override.
-replace your php code with

function template_preprocess_node(&$vars) {
  dsm($vars);
}

from here you will be able to see what your node is made out of
-adapt the following code to your specific use case

function template_preprocess_node(&$vars) {
 if ($vars['node']->type == 'my_feeds_feed') {
  $vars['node']->my_awseome_field['content'] = "http://example.com";
 }
}

... or something

ShawnNYC’s picture

Great thank you so much. I'll try it asap.