save_mailinglist
4.4.3Tag {save_mailinglist} allows to save the mailinglist subscriptions.
Parameters
- user - user ID who's subscription is saved. Default value is the logged in user ID.
- fields - array of section ID values which can be subscribed to
First display the subscribable sections
<form action="POST">
{init_mailinglist name="list"}
{if $list_count > 0}
{********** TITLE **********}
<h1>{sysword word="mailinglists" type="saurus4"}</h1>
<table>
{********** PRINT CHECKBOXES AND SECTION NAMES **********}
{foreach from=$list item=section}
<tr>
<td>
<input type="checkbox" name="mailinglist_sections[]" value="{$section->id}" {if $section->user_subscribed == 1} checked="checked"{/if}>
<a href="?id={$section->id}" target="_blank">{$section->title}</a>
</td>
</tr>
{/foreach}
</table>
{/if}
<input type="submit" value="Subscribe">
</form>
Then save the posted values:
{save_mailinglist fields=$smarty.post.mailinglist_sections}
RSS