This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

variable_get returns all values from form instead of what was selected?

So I've been developing a module, which automatically-assigns roles based on taxonomy terms in user profiles. I can do that fine - but I wanted to add a settings page to the module that allows you to choose which vocabularies to assign roles for.

In the _settings hook, there is this code:


$vocabularies = array();
foreach (module_invoke('taxonomy', 'get_vocabularies') as $vocabulary) {
  $vocabularies[$vocabulary->vid] = $vocabulary->name;
}
$form['autorole_vocab_select'] = array('#type' => 'checkboxes', 
																				     '#title' => t('Vocabularies to auto-generate roles for'),
																					 '#default_value' => variable_get('autorole_vocab_select', 1),
																					 '#options' => $vocabularies,
																					 '#description' => t('Which vocabularies to auto-generate roles for'));
}

If I understand correctly, variable_get['autorole_vocab_select'] should contain the values that were selected in the settings page (and the database table variables reflects this correctly as well).

in the function that assigns the roles, this code is present:

 $allowed = variable_get('autorole_vocab_select', 'none');
 
 foreach($allowed as $vocab) {
 	$terms[] = module_invoke('taxonomy','taxonomy_get_tree', $vocab->vid);
 	}

It then checks that the field type the function got passed is a vocabulary, and checks that the name of it is in $terms - which should contain the vocab terms under the vocabularies that were selected, however if any vocabulary terms were selected, it acts as if all of them were selected. If none are selected it works as would be expected. Since the variable in the database table "variables" is correct, I assume that the problem must be in the $allowed = variable_get('autorole_vocab_select', 'none');call.

Will tip for assistance - Widget Inventory on User Account Page + Search

Hello, I'm working on a new Drupal site and I need some help.

I've been searching around and learning about the CCK and Flexinode, as well as the Views module, but I think I need a hand with implementation to do what I'm trying to do here.

Here is what I need:

Submit module to patch queue?

I created this module -> http://drupal.org/node/71555 and I was just wondering how to get it into the queue for someone to review?

cheers
alynner

CCK -- how to I add submitted by information?! It's not just a simple option?

I just installed the cvs version of cck. (dated June 13th, 2006). The 4.7 version has the same date and time.

I am surprised that there seems to have no option to have the usual "submitted by" information.

I tried turning on userreference, but that simply meant I could associate the node with any user on the site, not just myself.

I tried adding the "author/maintainer" field that comes prepackaged. That me a blank field that I can add anything to (any word, not just a username) It also returned errors.

Offline dev documentation

Hi,

I'm going off-line for a couple of weeks and was hoping to be able to do some module development - but I can't seem to find any version of the development documentation usable on a standalone machine (windows xp).

Does such a thing exist?

Yours
TC

Comment form in node instead of separate URL

Just curious, is it possible to place comments and the comment form in the same page as the content node instead of on a separate comment/reply URL?

I saw a site that uses drupal that have the ability to do so: http://performancing.com.

Moreover, I am concerned about having two copies (duplicate content) of the same page for every node. That sounds like counter intuitive, not to mention about usability issue.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions