1

Commerce/Ubercart require account creation to buy product. That's fine - I want that.

But I do not want user/register open to the public. Efforts to use Honeypot/Captcha/Mollom are still letting in lots of spam user registration.

What is a hook_form_alter I could use in a module to entirely remove the user/register form and make user/register page blank, without disabling open registration for Ubercart/Commerce? I would then add a block to this page instructing humans to buy a product to create an account.

Make sense? Please advise on the code. THANKS!

1
  • 1
    Try using hook_menu_alter to unregister the user/register callback.
    – Letharion
    Sep 29, 2014 at 13:20

3 Answers 3

1

Basically you can keep user registration functionality, notification emails etc.. and prevent access to the user register page by either altering the registration form, or better yet, the page callback for the entire page.

e.g:

/** 
 * Implements hook_menu_alter
 **/
function MODULE_menu_alter(&$items) {
  // Deny all access to the user/register page.
  // Administrators can still create user accounts via admin > people
  // Notification emails etc.. are still operational
  // and Commerce / Ubercart can create user accounts following checkout etc..
  $items['user/register'] = array(
    'access callback' => FALSE,
  );
}
0
0

I think your way is not so good. Try this module "BOTCHA Spam Prevention"

1
  • Why is the idea not good? No one needs to use user/register on our site. The only people besides administrators are customers who create accounts via Commerce, not user/register.
    – user36617
    Sep 29, 2014 at 12:15
0

if you're using Drupal 7 and you don't want public registration available:

  • go to /admin/config/people/accounts

  • about half way down the page is :REGISTRATION AND CANCELLATION

  • here you can set the terms of registration - it sounds like you would want Administrators Only

As an alternative (in case that method prevents new registration under Commerce):

  • using Rules, set up a rule based on the current path to redirect to the front page. Since Rules is already installed for Commerce it doesn't require any new modules, and will appear as though that page doesn't exist

Your Answer

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

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