attached patch for 4.7 adds support for anonymous users to sign up to events via the signup module. enabling the 'allow signups' permission for anonymous users now injects a required email field into the signup form when an anonymous user visits a signup enabled node. anonymous users who sign up are uniquely identified by the email address they provide. admins have the ability to cancel anon signups. these users will also get confirmation and reminder emails if the node is enabled for those. anon users will not be able to cancel their own signups, use any of the features in the signup_conflicts contrib module, or get a listing of events they've signed up for. following is a summary of the code changes in this patch:

updated the INSTALL.txt and README.txt files to include notes for anon support. added notation to README.txt about signup_conflicts contrib module. removed completed items from TODO.txt. updated signup.install with db changes for anon signups. added conditional inclusion of the event_timezones.inc file (event module no longer includes this file with every page load). eliminated the 'signup' menu callback, and reworked the user signup and cancellation process to be more FAPI compliant. removed the 'email' field from the signup.theme example form--too confusing with the new injection of the anon signup field. reworked signup_conflicts contrib module to disallow support for anon signups.

Comments

pjdevries’s picture

Against which version of signup was this patch created? I'm getting quite a few hunks FAILED.

pjdevries’s picture

Patching against version 4.7 that is:)

webchick’s picture

Hm. Applies fine here. Not had a chance to test it very much yet though.

I'm using // $Id: signup.module,v 1.45.2.13 2006/06/10 03:01:30 dww Exp $ .. make sure you have the most up-to-date version of 4.7 signup module.

hunmonk’s picture

StatusFileSize
new35.5 KB

my sponsor found a bug in the existing signup code--there was an extra column listed in an INSERT INTO statement, left over from the removal of the permissions column in the signup table. i rolled that simple fix into the patch. he also requested that the anon email field appear at the bottom of the signup form instead of the top, so i've made that adjustment as well. patch attached

hunmonk’s picture

Assigned: hunmonk » Unassigned
StatusFileSize
new35.53 KB

more debugging by my sponsor. updated patch corrects:

  • email address could only be used for one signup node. validation was failing when the same email was being used for another signup node. fixed by restricting the validation to both the email addy and the node.
  • confirmation emails not being sent due a bad SQL query. corrected the syntax.
hunmonk’s picture

Assigned: Unassigned » hunmonk
StatusFileSize
new34.96 KB

keeping up w/ latest version of the module.

hunmonk’s picture

StatusFileSize
new34.24 KB

keeping up w/ latest 4.7, and made these changes to the feature as well:

  • included the anon emails in the node signups summary, which seems ok now that we've got an 'admin own signups' perm.
  • changed the anon_mail textfield title and description to be more clear.
hunmonk’s picture

StatusFileSize
new34.44 KB

touching up a couple of things required by the module maintainer...

dww’s picture

Status: Needs review » Needs work

along with all the stuff i've mentioned privately, a few more:

  1. this:
    $username = l($signed_up_user->name, "user/$signed_up_user->uid");
    

    should be:

    $username = theme('username', $signed_up_user);
    

    so long as $signed_up_user has both a 'name' and 'uid' field, it works great. this takes care of not presenting the link to users that don't have permission to view user profiles, and makes it easier to theme differently, etc.

  2. on the node/X/signups tab, i'm not sure the '(Anonymous)' next to each email address is all that helpful. it's not anonymous, we see their email right there. ;) plus, it's clear that we're looking at an email address, not a registered username. it also includes a hard-coded <br/>, which the themers don't like. i'd just take all that out, and leave the email address. maybe that email should be a mailto URL?
  3. signup_update_3() fails on pgsql:
    warning: pg_query(): Query failed: ERROR: syntax error at end of input at character 52 in /Users/wright/drupal/cvs/4.7/core-4.7.x/includes/database.pgsql.inc on line 84.
    user warning: query: ALTER TABLE signup_log ALTER anon_mail SET default in /Users/wright/drupal/cvs/4.7/core-4.7.x/includes/database.pgsql.inc on line 103.
    warning: pg_query(): Query failed: ERROR: syntax error at end of input at character 35 in /Users/wright/drupal/cvs/4.7/core-4.7.x/includes/database.pgsql.inc on line 84.
    user warning: query: UPDATE signup_log SET anon_mail = in /Users/wright/drupal/cvs/4.7/core-4.7.x/includes/database.pgsql.inc on line 103.
    
    ALTER TABLE {signup_log} ADD anon_mail text
    Failed: ALTER TABLE {signup_log} ALTER anon_mail SET default
    Failed: UPDATE {signup_log} SET anon_mail =
    ALTER TABLE {signup_log} ALTER anon_mail SET NOT NULL
    DROP INDEX {signup_log}_uid_nid_idx;
    CREATE INDEX {signup_log}_uid_idx ON {signup_log}(uid);
    CREATE INDEX {signup_log}_nid_idx ON {signup_log}(nid);
    

the stuff i mentioned in our latest YIM session should be fixed, too:

  1. renaming "signup_form_view" (i think i'd just take out the "_view" part, which seems out of place).
  2. removing the <p> from inside t()
  3. using $needs_signup_form = db_num_rows($result) == 0; for clarity
  4. clarifying that stray break;

i think that's it. ;)

i'll do a quick review of your (hopefully final) next patch whenever you post it. looking forward to marking it RTBC...

thanks for the good work, hunmonk!
-derek

dww’s picture

i learned the secret for db_add_column() working with NOT NULL varchar fields:

instead of this:

array('not null' => TRUE, 'default' => ''));

you want this:

array('not null' => TRUE, 'default' => "''"));

(note the extra quote marks for the value used in 'default'). then it all works like a charm.

enjoy,
-derek

dww’s picture

upon further consideration, my point #1 about

$username = theme('username', $signed_up_user);

shouldn't be fixed in this patch.

a) it was like that before
b) there are probably a bunch of other places in the code that don't use theme('username') like this.
c) i like to keep individual commits as small as possible.

so, the anon patch should stick to anon (even though it had to move around one of these user links), and we can clean up all the theme('username') stuff in a separate issue.

hunmonk’s picture

StatusFileSize
new34.65 KB

ok, attached patch should be the one!

hunmonk’s picture

StatusFileSize
new34.54 KB

had to make a few small adjustments to fix recent changes to 4.7. this should be it.

dww’s picture

Status: Needs work » Reviewed & tested by the community

looks great. nice work. thanks for putting up with me. ;)

hunmonk’s picture

Status: Reviewed & tested by the community » Fixed

applied to 4.7 and HEAD. excellent review work--thanks for putting up w/ me... :)

Anonymous’s picture

Status: Fixed » Closed (fixed)
limex67’s picture

Is there still no built-in anonymous signin possible? Do I still need this patch?