Hey

I've been looking all afternoon for this :s (checked the manual, the forum, the issues)

What code do I need to enter in my node body to make the simplenews subscription form appear?
I've tried several php-snippets already, but either they return an error or they simply don't show anything. If anyone could point me to the correct code, would be awesome!

I'm also using http://drupal.org/project/popup_message to make it appear as a pop-up on the frontpage.

Comments

Dragolin’s picture

Dragolin’s picture

I solved it via a little detour, I rendered the block instead of the form directly:

<?php
$block = module_invoke('simplenews', 'block', 'view', '1');
print $block['content'];
?>
Berdir’s picture

Status: Active » Fixed

The alternative would be to do what the our block implementation does, which is this:

theme(array('simplenews_block__' . $delta, 'simplenews_block'), array('tid' => $delta))

Than invokes the preprocess function for that theme (http://api7.worldempire.ch/api/simplenews/simplenews.module/function/tem...), where we actually display the form:

drupal_get_form('simplenews_block_form_' . $tid);

Depending on what you exactly want to display, you can either use the form directly or go through the block/theme function. The latter will also display certain additional things if configured to do so.

It would be great if you could document this, go to the simplenews project page, click on documentation on the right side and then add a "How-To: Embed subscription block" child page. Explain those two options and the difference. Thanks!

I would recommend against placing php code in nodes (see http://drupal.stackexchange.com/questions/2509/what-are-the-downsides-of...) but that doesn't change the PHP code that you actually use.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

stg11’s picture

Any chance someone could give better instructions on how to do this? I tried #2 with different values in the 4th argument, tried #3 both examples with different $delta values. First ref link in #3 gets page not found. When I use any of the examples I get no subscription form generated on the page.

Since I am already using the subscription block in the sidebar, I can't also use it at content bottom, and the multi-subscribe block is not ideally suited for my purpose which I am using in content bottom right now.

Is $delta in #3 the block id or the relative newsletter number or ?

stg11’s picture

Status: Closed (fixed) » Active

(reactivating issue)

miro_dietiker’s picture

Issue summary: View changes
Status: Active » Fixed

Closing old support requests.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.