Redirect to registration, not to the login page during verification of UberCart in Drupal?

Currently, if the user is not logged in, they are redirected to the login page when checking in UberCart. I need them to be redirected to the registration page as soon as possible.

In other words:

Go here: user/register
NOT here: user

The key point here is getting it to work with UberCart. I know that you can use hosting for registration and other tricks to do it normally, but I can not get it to work with UberCart?

UPDATE

I still do not have a decent solution, so I added generosity for this. Currently, if you have "anonymous verification" disabled, ubertcart will automatically add these messages:

  • You must be logged in before you can proceed to checkout.
  • If you do not already have an account, register now.

It is also a problem that it makes no sense to display them if you go to the user’s page. Thus, even my hard hacking is to forward the user to / user / register, when he encounters "user? Destination = cart / checkout" and the user does not register, forwarding them to "user / register? Destination = cart / checkout" is not good work.

Any ideas?

UPDATE 2

The magic happens here: line 94, uc_cart.pages.inc

// Send anonymous users to login page when anonymous checkout is disabled.
if (!$user->uid && !variable_get('uc_checkout_anonymous', TRUE)) {
    drupal_set_message(t('You must login before you can proceed to checkout.'));
    if (variable_get('user_register', 1) != 0) {
    drupal_set_message(t('If you do not have an account yet, you should <a href="!url">register now</a>.', array('!url' => url('user/register', array('query' => drupal_get_destination())))));
  }
  drupal_goto('user', array('query' => drupal_get_destination()));
}

So basically I need a way to override this behavior? (i.e. without cracking the kernel?)

+3
source share
1 answer

. , , TOKEN. , .

+2

Source: https://habr.com/ru/post/1790483/


All Articles