Hi Everyone,

Newbie here. I am having a problem with the simplenews module, and I'm hoping someone out there can help.

If I configure (Administer >> Access Control) to give the user "administer taxonomy" access, everything works fine: When the user goes to mysite/newsletter/subscriptions, a checkbox list of the different newsletters is displayed along with a "subscribe" button.

However, if I turn off "administer taxonomy" access for the user, the checkbox list of newsletters is not displayed.

Here is the relevant function from simplenews.module. Is it possible that taxonomy_get_tree(), in the 5th line of the function, is not returning anything if the user does not have "administer taxonomy" access? Is there a workaround, other than giving my users "administer taxonomy" access?

/**
 * Helper function to build subscription manager form, also used in user edit.
 */
function _simplenews_subscription_manager_form($subscription) {
  global $user;
  $form = array();
  $form['#base'] = 'simplenews_subscription_manager_form';
  $options = array();
  foreach (taxonomy_get_tree(_simplenews_get_vid()) as $newsletter) {
    $options[$newsletter->tid] = $newsletter->name;
  }
  $form['subscriptions'] = array('#type' => 'fieldset', '#description' => t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'));
  $form['subscriptions']['newsletters'] = array('#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $subscription->tids,
  );
  
  
  // If current user is an authenticated, just display e-mail. Anonymous users
  // see an e-mail box and will receive confirmations
  if ($user->uid) {
    $form['subscriptions']['#title'] = t('Subscriptions for %mail', array('%mail' => $subscription->mail));
    $form['subscriptions']['mail'] = array('#type' => 'value', '#value' => $subscription->mail);
    $form['update'] = array('#type' => 'submit',
      '#value' => t('Update'),
      '#weight' => 20,
    );
  }
  else {
    $form['subscriptions']['#title'] = t('Manage your newsletter subscriptions');
    $form['subscriptions']['mail'] = array('#type' => 'textfield',
      '#title' => t('E-mail'),
      '#size' => 20,
      '#maxlength' => 128,
      '#weight' => 10,
      '#required' => TRUE,
    );
    $form['subscribe'] = array('#type' => 'submit',
      '#value' => t('Subscribe'),
      '#weight' => 20,
    );
    $form['unsubscribe'] = array('#type' => 'submit',
      '#value' => t('Unsubscribe'),
      '#weight' => 30,
    );
  }
  return $form;
}

Thanks for your help!!
Mindy

Comments

kobnim’s picture

Another clue to the puzzle ...
When I disable the "Taxonomy Access Control" module, the above problem goes away, i.e. the list of newsletters is properly displayed on the subscription page.

So I now have two half-solutions to my problem, neither of which is acceptable. If I want users to be able to view the list of newsletters on the subscription page I can either:
a) disable Taxonomy Access or
b) give everyone "administer taxonomy" access.

I'm wondering if perhaps the Taxonomy Access Control and Simplenews modules are just incompatible? I'm hoping that's not the case, I really need both.

Again, any suggestions would be tremendously appreciated. I've been struggling with this for days.

kobnim’s picture

In case anyone is experiencing a similar problem ...
Looks like it wasn't a Simplenews problem, but a more general problem with node access. I'm not sure how node access got screwed up, perhaps because I installed both Taxonomy Access and Organic Groups.

To resolve the problem, I installed a fresh version of Drupal, and then reinstalled all the modules. It's now working fine.

kaimuki’s picture

Hi,
Do you have both Organic Groups and Taxonomy Access Module installed?

I read elsewhere those two were incompatible... but it would be great if I could use both.

Matthieu’s picture

Hi,

I have exactly the same problem on my Drupal 5x installation.
However, I don't have Organic Groups installed, only Taxonomy Access and Simplenews.

Does anyone knows how to fix that ?
I cannot do a fresh install of the site ...

Thank you.
Matthieu