Search Results

Search found 2 results on 1 pages for 'volocuga'.

Page 1/1 | 1 

  • Add comment programmatically in Drupal 7

    - by volocuga
    trying to create a comment in own module. $comment = new stdClass(); $comment->nid = 555; // Node Id the comment will attached to $comment->cid = 0; $comment->pid = 0; $comment->uid = 1; $comment->mail = '[email protected]'; $comment->name = 'admin'; $comment->is_anonymous = 0; $comment->homepage = ''; $comment->status = COMMENT_PUBLISHED; $comment->language = LANGUAGE_NONE; $comment->subject = 'Comment subject'; $comment->comment_body[$comment->language][0]['value'] = 'Comment body text'; $comment->comment_body[$comment->language][0]['format'] = 'filtered_html'; comment_submit($comment); comment_save($comment); The code causes the following error: Fatal error: Call to undefined function node_load() in BLA/BLA/comment.module on line 1455 node_load() function is in node module which, of course, enabled. How to fix it? Thanks!

    Read the article

  • How to properly override Drupal imagecache presets

    - by volocuga
    Say I need to override defaul presets, provided by Ubercart module. This is what I wrote: function config_imagecache() { $presets = array( array( 'presetname' => 'product', 'actions' => array( array( 'action' => 'imagecache_crop', 'data' => array('width' => 300, 'height' => ''), 'weight' => 0, 'module' => 'imagecache', ), array( 'action' => 'canvasactions_canvas2file', 'data' => array('xpos' => 'center', 'ypos' => 'center', 'path' => 'actions/pad_300_300.gif', 'dimensions' => 'background',), 'weight' => 1, 'module' => 'imagecache_canvasactions', ), ), ), array( 'presetname' => 'uc_thumbnail', 'actions' => array( array( 'action' => 'imagecache_scale', 'data' => array('width' => 55, 'height' => 55, 'upscale' => 0), 'weight' => 0, 'module' => 'imagecache', ), array( 'action' => 'canvasactions_canvas2file', 'data' => array('xpos' => 'center','ypos' => 'center', 'path' => 'actions/pad_60_60.gif','dimensions' => 'background'), 'weight' => 1, 'module' => 'imagecache_canvasactions', ), ), ), array( 'presetname' => 'product_full', 'actions' => array( array( 'action' => 'imagecache_scale', 'data' => array('width' => 600, 'height' => 600, 'upscale' => 0), 'weight' => 0, 'module' => 'imagecache', ), ), ), array( 'presetname' => 'product_list', 'actions' => array( array( 'action' => 'imagecache_scale', 'data' => array('width' => 100, 'height' => 100, 'upscale' => 0), 'weight' => 0, 'module' => 'imagecache', ), array( 'action' => 'canvasactions_canvas2file', 'data' => array('xpos' => 'center', 'ypos' => 'center', 'path' => 'actions/pad_100_100.jpg','dimensions' => 'background',), 'weight' => 1, 'module' => 'imagecache_canvasactions', ), ), ), array( 'presetname' => 'uc_category', 'actions' => array( array( 'action' => 'imagecache_scale', 'data' => array('width' => 100, 'height' => 100, 'upscale' => 0), 'weight' => 0, 'module' => 'imagecache', ), array( 'action' => 'canvasactions_canvas2file', 'data' => array('xpos' => 'center', 'ypos' => 'center', 'path' => 'actions/pad_100_100.gif', 'dimensions' => 'background',), 'weight' => 1, 'module' => 'imagecache_canvasactions', ), ), ), array( 'presetname' => 'cart', 'actions' => array( array( 'action' => 'imagecache_scale', 'data' => array('width' => 50, 'height' => 50, 'upscale' => 0), 'weight' => 0, 'module' => 'imagecache', ), array( 'action' => 'canvasactions_canvas2file', 'data' => array('xpos' => 'center', 'ypos' => 'center', 'path' => 'actions/pad_60_60.gif', 'dimensions' => 'background',), 'weight' => 1, 'module' => 'imagecache_canvasactions', ), ), ), ); foreach ($presets as $preset) { drupal_write_record('imagecache_preset', $preset); foreach ($preset['actions'] as $action) { $action['presetid'] = $preset['presetid']; drupal_write_record('imagecache_action', $action); } } imagecache_presets(true); cache_clear_all('imagecache:presets', 'cache'); } I can see in imagecache UI the settings was applied, but really images disappeared at all. Nothing works now. Where is the mistake?

    Read the article

1