drupal-7

How can I check Drupal log files?

一世执手 提交于 2019-11-27 14:19:37
问题 How can I check Drupal log files? I'm using Ubuntu 10.10 + Apache2 + PHP 5.33 + MySQL and Drupal 7. 回答1: To view entries in Drupal's own internal log system (the watchdog database table), go to http://example.com/admin/reports/dblog. These can include Drupal-specific errors as well as general PHP or MySQL errors that have been thrown. Use the watchdog() function to add an entry to this log from your own custom module. When Drupal bootstraps it uses the PHP function set_error_handler() to set

How to create a Drupal rule to check (on cron) a date field and if passed set field “status” to “ended”?

孤街醉人 提交于 2019-11-27 14:10:15
问题 I'm trying to create a custom rule (using the Rules module) so that every time the cron runs, this rule checks a date field in a custom content type I created. If that date has passed then I want to set a list widget from active to ended . This is how far I get when trying to create this rule: Set React on event to Cron maintenance tasks are performed Add Condition > Set Select the condition to add to Data comparison > Continue Here is the issue: Data selectors only has site and no access to

How to display node/add/sometype form on another page?

我的未来我决定 提交于 2019-11-27 05:19:04
问题 The whole problem is following: Lets say we have Items, Items can have Bids, Items can have Questions and Question can have Answer. When an Item is displayed, all content associated with this Item should also be displayed. Additionally depending on roles, certain forms to make Bids, ask Questions and replay Answers should be display. How to achieve this? Should I have separate node type for each type? Or should I treat some subtypes like Questions and Answers as comments? Should I use some

Attaching image files to nodes programmatically in Drupal 7

筅森魡賤 提交于 2019-11-27 00:00:39
问题 Is it possible to add an image to a node programmatically? 回答1: Here is an example code using which you can use with node_save $filepath = drupal_realpath('misc/druplicon.png'); // Create managed File object and associate with Image field. $file = (object) array( 'uid' => 1, 'uri' => $filepath, 'filemime' => file_get_mimetype($filepath), 'status' => 1, ); // We save the file to the root of the files directory. $file = file_copy($file, 'public://'); $node->field_image[LANGUAGE_NONE][0] =

Able to see a variable in print_r()'s output, but not sure how to access it in code

偶尔善良 提交于 2019-11-25 22:58:43
问题 I googled, installed Devel, Drupal for Firebug, but I can\'t find it. I found what I want, I know where it is; I just don\'t know how to get it. I\'ll put this in code brackets, but Devel tells me the file name (which I want to stick into the .tpl.php file) is here: field_image (Object) stdClass handler (Object) views_handler_field_field view (Object) view result (Array, 2 elements) 0 (Object) stdClass _field_data (Array, 1 element) nid (Array, 2 elements) entity (Object) stdClass field_image