Limit as textfield, instead of select list

comrax - June 3, 2009 - 10:14
Project:Invite
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

The current implementation suggests predefined (and not editable through the Web) values for "Invitation limit" for a role. The page is http://www.example.com/admin/user/invite/settings

This patch will make the select box as a regular input text field, and allow you to enter any number you like. Proper description has been given also to insert a value that indicates "unlimited" invitations.

I hope to see this being part of new releases.

AttachmentSize
invite_admin.patch1.04 KB

#1

Bevan - June 9, 2009 - 14:21
Status:active» needs work

#377858: limit as textfield, instead of select list, Drupal 5 is a request for a backport of this. #196250: Invitation limit should not be an input field raises an issue that needs consideration before this can be marked RTBC. The patch is clean and works.

#2

Bevan - June 10, 2009 - 13:10
Title:Patch to allow entering "Invitation limit" as a textfield, instead of drop-down box.» limit as textfield, instead of select list
Version:6.x-2.0-alpha1» 6.x-2.x-dev

Rerolling for dev branch. Still needs work due to issues raised in #196250: Invitation limit should not be an input field

AttachmentSize
480646.patch 1.28 KB

#3

Bevan - June 12, 2009 - 06:03
Assigned to:Anonymous» Bevan

#4

Bevan - June 12, 2009 - 06:13
Title:limit as textfield, instead of select list» Limit as textfield, instead of select list

#5

Bevan - June 15, 2009 - 13:29
Assigned to:Bevan» Anonymous
Status:needs work» needs review

This version of the patch addresses the issue raised in #196250: Invitation limit should not be an input field by validating the user input values for role limits. It needs review and some testing.

AttachmentSize
480646.patch 2.14 KB

#6

sun - June 17, 2009 - 01:08
Status:needs review» needs work

user_roles(0) looks scary. Why?

#7

Bevan - June 17, 2009 - 07:22

It is not using user_roles(0) to set any values, just to find keys of values in the form submission ($form_state['values']). I copied this iteration technique from:

<?php
function invite_settings() {
 
$roles = user_roles(0, 'send invitations');
 
// ...

 
foreach ($roles as $role) {
   
$role_no_space = str_replace(' ', '_', $role);
   
$form['role'][$role_no_space] = array(
     
'#type' => 'fieldset',
     
'#title' => t('@role settings', array('@role' => drupal_ucfirst($role))),
     
'#collapsible' => TRUE,
     
'#collapsed' => TRUE,
    );
   
// ...
 
}
 
// ...
}
?>

There are 5 other places in invite.module and invite.install that already use user_roles(0) in this way (and one that uses user_roles(1)).

Ideally they would use booleans FALSE and TRUE instead of integers, but that is a separate issue.

Also, in this case, passing any different parameters such as user_roles(1) would be an error, since users invited by anonymous users would not gain anonymous users' target role. Though implementing invite.module in this way would probably be an error of it's own (on the part of the configurator)!

#8

comrax - July 12, 2009 - 00:12

Are you going to integrate this into 2.x-DEV?

 
 

Drupal is a registered trademark of Dries Buytaert.