Intended for Drupal 6.x

This module will let a site administrator change the format of the Organic Groups-generated 'Groups' field on the User Registration form to:

  • Checkbox (default)
  • Select List
  • Autocomplete Textfield

I think that this module will be very helpful to OG users. There are a couple of issues requesting this functionality:
http://drupal.org/node/990094
http://drupal.org/node/1214796

This module is working but needs peer review. I'd appreciate the advice of the community on a number of development decisions:

  • I'm currently using Form API's #validate to both validate field values and also change field values before final submission. Is this a bad practice? If so, is there a better way to change the value of a field before final submission but after validation?
  • I'm setting the key value of an autocomplete field in the pattern of: "Node Title [id:123]" and then using a regex to grab the node id and validate the value. Is there a better way to do this with Form API?
  • I copied a snippet from og.module that queries the database for group names. It seems to violate one of the coder module's rules about safe SQL (line 76 & line 82). I'm not sure if there's a good reason that OG is set up this way. Any comments would be welcome.

Any input would be welcome.

Sandbox link: http://drupal.org/sandbox/madmatter23/1287462
Git clone: git clone http://git.drupal.org/sandbox/madmatter23/1287462.git og_registration_format

Comments

grasmash’s picture

Issue summary: View changes

added more information

grasmash’s picture

Issue summary: View changes

adding more information

greggles’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security

This looks like a super handy module. Thanks for your work on it!

Please take a moment to make your project page follow tips for a great project page.

This should be wrapped in st() (since it's during install) and be formatted for translation:

drupal_set_message('Please visit the ' . l('Organic Groups configuration page', 'admin/og/og') . ' to set the Organic Groups registration format.');

vs.

drupal_set_message(st('Please visit the <a href="!link">Organic Groups configuration page</a> to set the Organic Groups registration format.', array("!link" => 'admin/og/og');

This query should be wrapped in db_rewrite_sql to make sure you only show nodes they can actually see. og_register should theoretically help with that, but you have to make sure. Also, this should use db_query_range to make sure it will handle large sites.

$result = db_query("SELECT n.nid, n.title FROM {node} n, {og} o WHERE n.status = 1 AND o.og_register = 1 AND o.nid = n.nid AND n.title LIKE '%s%%'", $string);
jthorson’s picture

Status: Needs work » Closed (duplicate)

It appears that you have successfully completed the application process with a different application, and been granted the 'create full projects' permission:

OG Configurable Details Block: http://drupal.org/node/1231900

Once their first application has been successfully approved, then an applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue.

With this in mind, I have marked your other applications as 'closed(duplicate)'. If this is incorrect, and you do not yet have the ability to create full projects, then please feel free to re-open this application.

Thanks in advance for your patience and understanding!

pierredvumali’s picture

this sandbox project is critical to my site. I have used it before in Drupal 6 and it worked perfectly, I'm now intending on migrating to Drupal 7 but I need to know if this is available for Drupal 7. Thanks in advance for any response!

jthorson’s picture

I belive madmatter23 has the ability to promote this to a full project at their own discretion ... perhaps try opening a ticket in the project issue queue (as opposed to here, which is a closed 'project application' ticket, used to apply for the 'create full projects' permission).

jthorson’s picture

Issue summary: View changes

these are required bits of data

avpaderno’s picture

Title: Organic Groups Registration Format » [D6] Organic Groups Registration Format
Related issues: +#1231900: [D6] OG Configurable Details Block