I am having serious issue with Registration codes module and searching for solution to fix it. It is described here: http://drupal.org/node/797602

There is a patch to the issue, but author of the code stated that it may be "serious regression and borked a bunch of other modules, like simplenews and profile, anything that expects data to be in $edit."

That patch is very simple:

-  regcode_user('insert', $edit, $account);
+  user_save($account,$edit);

Module works well when used in normal mode, but in "voucher" mode, it does not apply role to user who submits it. To greater misfortune, the rule that this module came with, which could help do it another way, is also broken.

I think this module is not actively maintained as i do not recieve response for about an month on series of my request.

I would be very grateful if someone knows what approach i could take to resolve the issue, knowing how to rewrite patch to avoid harm to other modules functionality.

Thanks for clues!

  • 1
    That patch is outdated - the relevant part in the module has been rewritten. If you post clear steps how to reproduce the bug (starting from a fresh Drupal 7 install) I will take a look at it and see if I can figure anything out. Additionally, if the issue you linked to is not describing your exact problem it would help if you add information about yours here (otherwise it will do as the summary is easy to follow).
    – Madis
    Sep 19, 2012 at 19:14
  • Dooshta - thanks, so you are in some way involved in the matter ? That sounds comforting. :) My problem is that applaying registration code post-registration (voucher mode)does not assign role, while applaying it in normal mode assigns role. I am using most recent version of the module, i am interested in rewritten part you are talking about. So, basically, the module does everything fine even in voucher mode (code is claimed to the user), bz does not apply role. Do you suspect it is inner conflict in my Drupal setup (other modules) and not Regcode error ? Thanx for your effort!
    – NenadP
    Sep 20, 2012 at 20:24
  • 1
    Actually I'm not involved at all (never even used the module) =p Just saying that the patch wont help you in it's current state (checked the relevant code). I could try to help more if you'd post some instructions of how (what modules should be installed, where/what to do to possibly hit the bug and such).
    – Madis
    Sep 23, 2012 at 14:43

1 Answer 1


This is more of an advice than a clean solution to the problem: hack the module and apply the patch if it works for you without interfering with other modules.

As you said, the module isn't maintained well and it is not updated recently (last commit was almost a year ago). If you don't have enough time to go over everything yourself, it is better to just fork it than hope that the maintainer will fix it.

Create a new folder under "sites/all/modules" called "fork" and move the module there. This will make sense later on for you or anybody else working on the site.

  • Thanks for advice, I am afraid i will have to fix it one way or another because 40.000 codes are in the database and associated with module, waiting for subscribers (and they are coming every day to claim their codes). I am afraid to apply patch as i am warned it will spoil simplenews and profile module, and i am highly need for those too! I guess i will have to ponder deeply into module myself and see why it is not working....
    – NenadP
    Sep 17, 2012 at 18:26
  • 1
    Just in case, make a complete backup (code and the database) before you do that. Honestly I'd try one more thing: what about having both lines there? I haven't checked the code of the module thoroughly but if the user_save() is expected only to update the user and not save a new one - it should work. Try this on a dev site and post back what you find out. Hope this helps. Also, thanks for the bounty points :) Sep 17, 2012 at 18:40
  • Ivanhoe, no problem, well deserved, really. I appreciate someone takes in cosideradion wasting time helping others stuck in the code, even for bounty :D . I will do as you say, thanks for additional help. Atm, server is on full user pressure and secondary is being necromanced...
    – NenadP
    Sep 18, 2012 at 19:17
  • 1
    You're welcome :) glad if my comments helped Sep 18, 2012 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.