Hi,

I added submit handler to role creation form. It would be nice to have the rid of newly created role in my handler.
So that I can identify the role and play with that.

I think it is the 'user_admin_role_submit' function in file user.admin.inc that needs to be changed. I believe it should be set in $form['values']['rid'].

Additionally I think it would be nice to do the same for all other creation forms.

-- Thanks

Comments

preventingchaos’s picture

You might be able to get the role rid in your own submit handler using the function db_last_insert_id($table, $field) function.

kamanashisroy’s picture

Thanks. I was using "SELECT LAST_INSERT_ID()" :-P. Your idea is better :) .

I have found that drupal_write_record($table, &$object, $update = array()) updates the serial ids . I think using that everywhere will make things even better. Although it has an disadvantage #227809: Fatal Error Cannot use object of type stdClass as array .

mdupont’s picture

Status: Active » Fixed

Marked as fixed as there is an easy solution.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.