rsvp_list_simplenews

Definition

rsvp_list_simplenews($rid)
rsvp/rsvp.module, line 1303

Description

Returns a list of members of newsletters created with Simplenews module.

Parameters

$rid int The RSVP ID.

Return value

string List of members.

Code

<?php
function rsvp_list_simplenews($rid) {
  if (module_exists('simplenews')) {
    $rsvp = rsvp_load($rid);
    $content = t('<h3>You may invite people subscribed to newsletters:</h3>');
    $rows = array();
    $header = array(t('Newsletter name'), array('data' => t('Operations')));

    foreach (taxonomy_get_tree(_simplenews_get_vid()) as $term) {
      $rows[] = array(
        $term->name,
        l(t('Add'), 'node/'. $rsvp->nid .'/rsvp/'. $rsvp->rid .'/attendees/simplenews/'. $term->tid, 
        array('onclick' => "$.get($(this).attr('href'), function(data){ $('#edit-invite-list').val(data); }); return false;")),
      );
    }

    if (count($rows) == 0) {
      $rows[] = array(array('data' => t('There are currently no newsletter series.'), 'colspan' => 2));
    }
    $content .= theme('table', $header, $rows);
    return $content;
  }
}
?>