开发者

Redirect to registration and not login page during UberCart checkout in Drupal?

Currently if a user is not logged in, they are redirected to the "login page" when checking out in UberCart. I need them to rather be redirected to the "registration" page.

In other words:

Go here: user/register
NOT here: user

The key here is to get it to work with UberCart. I know you can use login toboggan and other tricks to do it normally, but I can't get it to work with UberCart?

UPDATE

I still don't have a decent solution so I added bounty for this. Currently, if you have "anonymous checkout" disabled, ubertcart automatically add these messages:

  1. You must login before you can proceed to checkout.
  2. If you do not have an account yet, you should register now.

This is also a problem in that it doesn't make sense showing them if you go to the user page. So even my hard hack of forwarding the user to /user/register whenever it encounters "user?destination=cart/checkout" and the user is not logged, to forward them to "user/register?destination=cart/checkout" does not work that well.

Any ideas?

UPDATE 2

This is where the magic happens: 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_mes开发者_运维百科sage(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 that behaviour? (i.e. without hacking core?)


You should look into the rules and token module. You will create a rule when a user logs in to redirect to the the TOKEN. Make sure you enable the token actions module as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜