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

Simple Access restricts unspecified node

I've been using the simple access module, but I've only just recently noticed a problem with it.

It states that any unticked nodes mean that the node is viewable by all, but this is not the case. Some of my nodes are being denied to anonymous users, unless I tick the relevant box.

Is there a mysql command that I can use that basically says 'tick all nodes that are not already specified as restricted'?

Has anyone else come across this?

Multiple Question Polls or Surveys

I have installed the Surveys module but am not happy with it. I love the core Poll function and the simple response graph. Ideally I am looking for a Multiple Question Poll that shows a repsonse graph for each question.

Any direction would be appreciated.

- Brad

setting block visibility within the .module file

I am writing a module that has a block that I want only visible to logged in users. I've found many ways of doing this by going to the configuration page of the block, but none describing how to hard code a default display into the .module file. Anyone know? I figure it's probably just an entry in the array that gets returned from hook_block, but I don't know what it's called.

Simple Spam Block

I have added a simple spam catcher by simply adding a form element with the question "What is 2 + 3?" and adding an additional validation point. I thought I would offer this to the group...

Now I am sure the best approach would be to create a separate module for this (so I can more easily upgrade without overriding my changes..) but I just don't have a full understanding of extending existing modules just yet. If anyone has a good handle on how to do that, I'd love to change this to use that.

Another possible feature enhancement would be to have it generate a random math equation (but nothing that would require a result > 9). I would add that if I could extend the existing module, but I am hesitant to do it with my current edits directly in comment.module.

Anyways... here is my implementation (based on 4.7):

In the comment_form function, add the following line of code right after the line that says $form['homepage'].... I found two instances. (This extra field is for anonymous posters only):

$form['spam_block'] = array(
  '#type' => 'textfield',
  '#title' => t('What is 2+3?'),
  '#maxlength' => 255,
  '#size' => 30,
  '#default_value' => '',
  '#description' => t('Just type the number 5 here.  This is to prevent spam.'),
  '#required' ==> TRUE
);

and then in the comment_validate function, within the if (!$user->uid || isset($edit['is_anonymous'])) block, add this line of code at the end:

if ( $edit['spam_block'] != '5' ) {
  form_set_error('spam_block', t('You have to enter the number 5 here.'));
}

And that's it! Hope this is useful to someone. Please test this out if planning on using in production, as I certainly haven't tried this with a ton of modules and scenarios, but it works for me... Also, if anyone has some thoughts on how this could be setup as an extension module (rather than editing core), please let me know.

Cheers!

There must be some decent email trackers around?

There must be some decent email trackers around? So the user gets notified when a new topic is created or when someone replies to their topic?

I've seen a 'comment mail' module but its not yet ported to v5....

Could anyone point me to a suitable one please?

hook_menu troubles - foo/bar/ and foo/ both points to foo/

I'm digging deeper into drupal now, and I'm currently stuck in a hook_menu issue:

I got these in my foo_menu():

Pages

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