An Inefficiency in the PHP Source Code?

Corey Pennycuff's picture

I was browsing through the PHP source code the other day when two things struck me. First, I must be weird for being curious enough to look up the source code. Second, I found an inefficiency in a seemingly straightforward function that I would like to discuss here.

In the PHP source code for quote_print.c, the first function is php_hex2int(), which I will provide here:

Users Creating Users in Drupal

Corey Pennycuff's picture

One of the biggest mistakes that I feel that Drupal has made is that it is difficult for non-administrators to create accounts for other users.  While at first blush this seems appropriate, there are many, many valid reasons that users should be able to create accounts on behalf of other people.  The problem is that, in all versions of Drupal (at least 5-8) there is a call to drupal_goto() inside the form generation function that is executed unless the user has the "administer users" permission.

This is bad!  I actually feel that this is a defect, in that the code should not perform a redirect when generating a form!  Returning nothing would be much preferred!

That being said, I have had 3 sites in as many months that needed the functionality of one individual (not an administrator) creating an account for another user.  The general method presented here is not without difficulty, as you may have to do other altering of the form in order to get it to do everything that you want it to, but the code shown here will provide the basic functionality.


Subscribe to CS Crunch RSS