I just installed the module and, it seems to me that on every pag load it created another vocabulary for itself.

I got up to about 80 before I noticed it :P.

I had a quick look at the code, found the function that was creating them, then commented it out (see code below). This is NOT the best solution, but you may want to start there.

Code That I commented out:

 function simplenews_get_vid() {
  $vid = variable_get('simplenews_vid', '');
  // Check to see if a vocabulary exists, else create one
  $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE vid = %d', $vid));
  if (!$vid) {
	  //taxonomy_save_vocabulary() returns $status, and not $edit[] in Drupal 4.6+
    $vocabulary = module_invoke('taxonomy', 'save_vocabulary', array('name' => t('Newsletter type'), 'multiple' => '0', 'required' => '0',
	  'hierarchy' => '0', 'relations' => '0', 'module' => 'simplenews', 'nodes' => array('simplenews')));
    $vid = $vocabulary['vid'];
		variable_set('simplenews_vid', $vid);
  }
  return $vid;
}

I don't really have the time to find th eproblem a post a patch, but I hope I have helped by making you aware of the problem.

Comments

DriesK’s picture

Version: » 7.x-1.x-dev

You are probably not running Drupal 4.6.x but HEAD? In that case your problem is related to this bug:
http://drupal.org/node/19621. I should have mentioned in the readme file that simplenews doesn't work with Drupal HEAD for the moment for that reason.

It is because taxonomy_save_term() does not return vid anymore. The problem can be solved if Dries applies the _p_19621_taxosaveobjs.patch patch.

So for the moment, Simplenews can only be installed on Drupal 4.6.x.

DriesK’s picture

I ment taxonomy_save_vocabulary() of course, not taxonomy_save_term()...

nathanwastaken’s picture

Thanks for that.

I actually did not read the 'read me' file, so even if you had satated it, I would still have done it.

Not a huge problem then. I will just apply the patch on my local version and see how I go from there.

DriesK’s picture

If you apply the patch, you also have to change this section in simplenews.module from

$vocabulary = module_invoke('taxonomy', 'save_vocabulary', array('name' => t('Newsletter type'), 'multiple' => '0', 'required' => '0',
      'hierarchy' => '0', 'relations' => '0', 'module' => 'simplenews', 'nodes' => array('simplenews')));
    $vid = $vocabulary['vid'];

into

list($status, $object) = array_values(module_invoke('taxonomy', 'save_vocabulary', array('name' => t('Newsletter type'), 'multiple' => '0', 'required' => '0', 'hierarchy' => '0', 'relations' => '0', 'module' => 'simplenews', 'nodes' => array('simplenews'))));
$vid = $object['vid'];
nathanwastaken’s picture

will do.... thanks for that.

dries’s picture

Committed patch #19621 to CVS HEAD (core).

nathanwastaken’s picture

GREAT...

Thanks Dries... Makes things easier.

DriesK’s picture

Assigned: Unassigned » DriesK
Status: Active » Fixed

Committed simplenews.module fix to CVS HEAD.

Anonymous’s picture

Anonymous’s picture

Tobias Maier’s picture

Anonymous’s picture

DriesK’s picture

Status: Fixed » Closed (fixed)

Closed because the automatic close feature in project module is broken, and the issue list is becoming cluttered.