I tried the insert the simplenews block's content with function module_invoke with no results.

The blocks of other modules work with this method, but the block of simplenews simply doesn't work.

What can be the cause?

PS
I tried to create a block that contains a picture and the content of simplenews block.
Is there any other possibility to do this?

the code from the custom block i tried to create is:

print '<img src="'.base_path().'files/logo.jpg" />';
$block = module_invoke('simplenews', 'block', 'view',0);
print $block['content'];

Comments

sutharsan’s picture

Your almost there. This works on HEAD and no doubt it will work on 5.x-1.x-dev too:

<?php
  $block = module_invoke('simplenews', 'block', 'view', 'newsletter-1');
  return $block['content'];
?>

The last parameter of the function call must be newsletter-tid where 'tid' is the term id of the applicable newsletter group.

mishhh’s picture

dmitrig01 from #drupal-themes mirc channel kindly found the solution:)

you have to do as such:

1. go to administer->site building->blocks and click "configure" on newsletter block. You look at the url. The last portion of it is something like "newsletter-xx", where xx is the taxonomy id (tid) of the newsletter i guess.

2. write some php code wherever you want to put the content of the block

$block = module_invoke('simplenews', 'block', 'view','newsletter-xx');
print $block['content'];

It should work now:)

sutharsan’s picture

Status: Active » Closed (fixed)