Closed (fixed)
Project:
Role Weights
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 Jun 2006 at 18:09 UTC
Updated:
12 Feb 2007 at 20:31 UTC
Jump to comment: Most recent file
From the TODO:
* Form alter - get the weights into the roles table/form somehow?
Attached patch does this. It required a bit of fancy work to fix the issue that user.module isn't fully Forms API compliant (bypasses drupal_submit_form). As well as improving the interface, this patch has the added advantage of enabling cleanup of obsolete data when a role is deleted. It also provides other role-related modules a base to work from, i.e., they can require role_weights and then form_alter the role admin forms to add their own fields.
Also includes some minor code cleanup, e.g., use of {tablename}.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | role_weights_formalternamefieldbug.patch | 1.57 KB | pfaocle |
| #4 | role_weights.patch | 994 bytes | nedjo |
| #1 | role_weights-form_alter_0.patch | 9.03 KB | nedjo |
| role_weights-form_alter.patch | 8.85 KB | nedjo |
Comments
Comment #1
nedjoMinor tweaks: add description to weight field, set save button lower weight than delete (it was floating to bottom in some cases).
Comment #2
pfaocleTested and applied to cvs - thanks nedjo.
Will port all recent changes to 4.7 branch once I've taken a look at the other issues.
Comment #3
(not verified) commentedComment #4
nedjoMy previous patch passed the anonymous user and authenticated user names as type '#markup'. This leads to the error that the values are lost when the form is submitted--the role names become empty strings.
To solve this, we need to pass the role names as type '#value' instead. This patch does so and also retains the current label, e.g.,
anonymous user (locked)
by passing it as a form prefix.
I've tested this and it successfully resolves the bug.
Comment #5
pfaocleThanks nedjo! I'm working through the code now trying to get a decent 4.7 branch together before I look at 5.0. However, I'm having trouble with some of your code from this (previous) patch. I'm convinced it used to work, but now with the module enabled I can't add roles.
Removing the theme_role_weights_admin_new_role() theme function sorts it, and its probably around line 92:
$rows[] = array(form_render($form['name']), form_render($form['submit']));
Somehow the new role name isn't being passed and I'm getting a "You must specify a valid role name." error.
Can you shed any light on this?
Comment #6
pfaocleTentatively fixed - we needed to render the rest of the form? See modified patch attached - committed to 4.7 (HEAD updates to follow).
Comment #7
pfaocleTentatively fixed - we needed to render the rest of the form? See modified patch attached - committed to 4.7 (HEAD updates to follow).
Comment #8
nedjoThanks for fixing this. I believe the error comes from the changes to forms that require a token to be passed. Rendering the full form includes the token.
Comment #9
(not verified) commented