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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Drupal user registration/login via CiviContribute form
Pages: [1]

Author Topic: Drupal user registration/login via CiviContribute form  (Read 5898 times)

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Drupal user registration/login via CiviContribute form
April 12, 2009, 05:22:21 pm
I've got a contribution form to enable anonymous users to sign up for membership. Drupal user account creation/login is required in the profile I'm using in the form.
When I point to the form as an anonymous user I see the helpful alert about providing a username or logging in, which is great. but the "login here" link points not to http://mysite.com/user, as I might expect, but just to http://mysite.com.
I'm guessing (and hopeful) that I have simply not fully configured a setting somewhere. Can anyone point me to my oversight?
Regards
Graham

Graham Mitchell
http://mc3.coop

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Drupal user registration/login via CiviContribute form
April 12, 2009, 09:58:07 pm
Graham,

It's a bug filed and fixed: http://issues.civicrm.org/jira/browse/CRM-4366:

Quote
Index: CRM/Core/BAO/CMSUser.php
===================================================================
--- CRM/Core/BAO/CMSUser.php   (revision 20603)
+++ CRM/Core/BAO/CMSUser.php   (working copy)
@@ -228,6 +228,8 @@
         if ( $isJoomla ) {
             $loginUrl  = str_replace( 'administrator/', '', $loginUrl );
             $loginUrl .= 'index.php?option=com_user&view=login';
+        } elseif ( $isDrupal ) {
+            $loginUrl .= 'user';
         }
         $form->assign( 'loginUrl', $loginUrl );
         $form->assign( 'showCMS', $showCMS );

HTh

Kurund
« Last Edit: April 13, 2009, 12:35:28 pm by Kurund Jalmi »
Found this reply helpful? Support CiviCRM

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Drupal user registration/login via CiviContribute form
April 13, 2009, 05:03:59 am
Nice one.
Thanks.
Graham
Graham Mitchell
http://mc3.coop

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Drupal user registration/login via CiviContribute form
April 13, 2009, 03:26:25 pm
This works, but it is still somewhat clumsy. If I have an account I'm going to click the login link, which now takes me to the login screen.

It would be even better if, on submitting the login form I am the taken back to the civiContribute form. So I tried putting:
 
Code: [Select]
} elseif ( $isDrupal ) {
            $loginUrl .= 'user?destination=civicrm/contribute/transact?reset=1&id=1';

on the assumption that this would do just that. But no. Instead I get:

"Sorry. A non-recoverable error has occurred.
This contribution has already been submitted. Click here if you want to make another contribution.
Return to home page."

The "click here" link is of course the page i wanted to get to in the first place.
Any idea as to where I'm going wrong most welcome.


Graham Mitchell
http://mc3.coop

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Drupal user registration/login via CiviContribute form
April 13, 2009, 04:07:16 pm
Quote
"Sorry. A non-recoverable error has occurred.
This contribution has already been submitted. Click here if you want to make another contribution.
Return to home page."

You get this error since drupal strips
Quote
?reset=1&id=1
from url. 

IMO its more of a drupal issue.

Kurund
Found this reply helpful? Support CiviCRM

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Drupal user registration/login via CiviContribute form
April 16, 2009, 05:10:02 am
Hmmm

That is a blow. I've raised it as a forum post on drupal.org (http://drupal.org/node/433842), but I'm not hopeful of a response/resolution anytime soon.

As a possible workaround has anyone had experience of using the Login Destination module (http://drupal.org/project/login_destination)?
I'll give it a spin and see if it can resolve this issue.

Regards
Graham
Graham Mitchell
http://mc3.coop

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: Drupal user registration/login via CiviContribute form
April 16, 2009, 06:43:17 am
OK. so I have installed the Login Destination module (http://drupal.org/project/login_destination) and configured it so that when I login from my CiviContribute page (civicrm/contribute/transact?reset=1&id=1) I get taken back to the same page (civicrm/contribute/transact?reset=1&id=1) so that I can complete the membership sign up process.

Of course I have also had to set up my login block so that it appears on the CiviContribute page, unless I can work out how to get Login destination to take my user back to the contribution page in the case where it is the page before the page on which they logged in.

All I need to do now is modify the text that appears in the highlighted block on the signup page so that users are directed to login using the block rather than linking to mysite.com/user. Can anyone point me to that code? - I'm guessing it is tied to the profile that is used on the contribution page.

Thanks
Graham
Graham Mitchell
http://mc3.coop

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Drupal user registration/login via CiviContribute form
April 16, 2009, 05:53:06 pm
Graham,
You can fix it (hard-coded) in a custom version of the template:
templates/CRM/common/CMSUser.tpl

or change the way $loginUrl is constructed in CRM/Core/BAO/CMSUser.php
Protect your investment in CiviCRM by  becoming a Member!

prickeke

  • I post occasionally
  • **
  • Posts: 64
  • Karma: 4
Re: Drupal user registration/login via CiviContribute form
April 19, 2009, 10:54:30 pm
Graham,

Any progress on the redirect after login?  I'd like to know your solution when you arrive at one.  I have posted an additional comment to your request on the drupal forums also so they know it is wanted by more than one user.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Drupal user registration/login via CiviContribute form

This forum was archived on 2017-11-26.