CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Disable Drupals "Create New Account" page. allow only register from Contribution
Pages: [1]

Author Topic: Disable Drupals "Create New Account" page. allow only register from Contribution  (Read 6163 times)

Cid.chad

  • Guest
Disable Drupals "Create New Account" page. allow only register from Contribution
November 02, 2009, 07:17:53 am
Hi Guys,

I have created a few membership types and have used the membership types in a contribution page.

Also created a Profile which will be used in both User Registration and Editing.

Users should only be able to Register from the contribution page, since they can select the "Membership Type" and pay for that.

Now I'm facing a new problem, some users via "Forgot Password" feature of the Drupal, get access to the "Create New Account" page!!!! of Drupal and since the profile is included in this page, they try to register from here instead of using the designated "Contribution page" which is breaking the membership in turn.

One option is to Disable  the "Create New Account" page but I do not know how, I also am not sure of the implications of this on contribution pages.

Any thought?
P.S:
Don't want to use: "User settings->Public registrations set to "Only site administrators..." in Drupal since I want all users registering from Contribution page to have their Drupal account automatically created.

« Last Edit: November 02, 2009, 07:26:51 am by Cid.chad »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
November 02, 2009, 07:48:19 am

i suspect the easiest way might be to use a hook_form_alter hook (or some other drupal hook) to redirect the create new account page to the designated "Contribution" page

if you get the above working, please publish your code so others can benefit

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Cid.chad

  • Guest
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
November 03, 2009, 10:08:36 pm
I was thinking of using a drupal redirect module to redirect http://DOMAIN/user/register to contribution page.

http://drupal.org/project/path_redirect

Have not tried that yet. will update you if it worked,

Cid.chad

  • Guest
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
November 05, 2009, 02:36:04 am
Didn't work with path_direct module. seems that module is mostly use for moved and do not allow to redirect an already existing path.

JulieR

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 5
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
December 01, 2009, 10:01:07 am
Did you find a solution to this?  I am grappling with exactly the same problem.  I tried exploring Lobo's suggestion (have you noticed how hard it is to find basic info about something on the Drupal site: what are hooks, for example?!) but this is the most promising thing I've found so far http://drupal.org/node/483324 and would need some adaptation.  The learning curve just seems a bit overwhelming, and I can't convince myself this is the right way - do I really need to write a new module, albeit a simple one?  Surely this is a problem loads of people have solved?

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: Disable Drupals "Create New Account" page. allow only register from Contribu
December 02, 2009, 06:35:29 pm
You don't need to write any code.

If you're using Apache and you have mod_rewrite enabled, just include the following in your .htaccess:

RewriteEngine on
Redirect /user/register /civicrm/contribute/transact?reset=1&id=2

Replace the id=2 with the id of your contribution page.
http://dharmatech.org
oss@dharmatech.org
801.541.8671

JulieR

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 5
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
December 03, 2009, 02:17:52 am
Thanks, that's a useful idea.

I also found this suggestion, to add the following to your template.php
if (arg(0)=='user' && arg(1)=="register") drupal_goto("[domain]/civicrm/contribute/transact?reset=1&id=2");
This works for me.

Of course both options redirect the 'create new account' tab rather than removing it as per cid.chad's original question.  Removing it would be cleaner, but for me this is good enough for now.

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: Disable Drupals "Create New Account" page. allow only register from Contribu
December 03, 2009, 09:10:13 pm
Might be better to leave the tab and use http://drupal.org/project/stringoverrides to change the text from "Create New Account" to "Become a Member" or "Sign up" or whatever.  SO is a great module for cleanly modifying strings in Drupal.
http://dharmatech.org
oss@dharmatech.org
801.541.8671

JulieR

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 5
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
December 04, 2009, 08:38:20 am
Thanks, that's a great idea.

Cid.chad

  • Guest
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
December 12, 2009, 07:11:59 pm
Hi
Just wanted to let you know that I both "String Overrides" and JulieR "(arg(0)=='user' && arg(1)=="register") drupal_goto("[domain]/civicrm/contribute/transact?reset=1&id=2");" suggestion worked perfectly for me.

It is so simple and no need to use a hook or something, however, as it is a very common use case for folks using Civicrm for Membership Registration, it sounds like a good idea for a custom module to Drupal.

It can also be used for any other use cases using a different page for registration than the standard module in Drupal.

I guess all suggestions are good, and good to be added to Civi documentation.
(both Apache and Template base solutions)

Thank ya'all


bijama1

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
Re: Disable Drupals "Create New Account" page. allow only register from Contribution
December 23, 2009, 04:36:27 am
Hi!

What I did ....

* To remove the "Create new account" feature in the User Login box I removed in user.module the lines:

if (variable_get('user_register', 1)) {
  $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
}

(see http://www.drupalcenter.de/node/10348)

* Then I created a new contribution page and linked to it with an menu entry.
   PUT Captcha/reCaptcha on it to avoid tons of fake registrations!!

And there is still one loophole left ... the orignal regisration page can still be accessed via ..../user/register still causing many fake entries.

With reCaptcha installed go to the Administer - User Management - Captcha and activate it for user_register. No need to go into detailed configuration, if someone hits the user/register page (which I dont want to be active) only an error message is displayed, avoiding fake registrations.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Disable Drupals "Create New Account" page. allow only register from Contribution

This forum was archived on 2017-11-26.