WooCommerce 社交登录重定向 [英] WooCommerce Social Login Redirect

查看:37
本文介绍了WooCommerce 社交登录重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 woocommerce myaccount 页面上使用了社交登录插件,但是该插件为我的 wp-admin 提供了社交登录.这不是正确的方式.如何修复重定向到我的帐户.

I used social login plugin for woocommerce myaccount page, but the plugin providing social login to my wp-admin.this not correct way. How to fix redirect to my account.

推荐答案

如果您正在使用 WooCommerce 社交登录 在您的页面和帖子上的短代码,执行以下操作应该可以让您将客户重定向到任何页面.

In case you're using WooCommerce Social Login shortcode on your pages and posts, doing as follows should allow you to redirect your customers to any page.

例如:对于已注销的用户,这将要求他们登录.对于已登录的用户,他们可以将帐户链接到他们的站点帐户.

e.g: For logged out users, this will ask them to sign in. For logged-in users, they can link accounts to their site account.

[woocommerce_social_login_buttons return_url="https://mystore.com/my-account"]

只需更改 return_url 属性的链接即可.return_url 属性是客户登录成功后重定向到的页面.

Simple change the link for the return_url attribute. The return_url attribute is the page to which customers will be redirected after signing in successfully.

如果您正在编辑主题的 .php 模板以放置按钮,请改用可用函数:

If you're editing your theme's .php templates for putting the buttons in place, use the available function instead:

<?php
// If user is logged in, allows sign in, else, allows social account linking 

if ( is_user_logged_in() ) {

    // Outputs "link account" buttons only to logged-in users

    woocommerce_social_login_link_account_buttons( $return_url = null );

} else {

    // Outputs "create account" buttons only to non-logged-in users

    woocommerce_social_login_buttons( $return_url = null );

}
?>

再次,相应地编辑 $return_url 变量,以便在成功登录或链接帐户后将用户重定向到任何页面.

Again, edit $return_url variable accordingly in order to redirect the user to any page after signing in or linking accounts successfully.

例如 $return_url = 'members-area',其中members-area"是您将用户重定向到的页面的永久链接.

e.g $return_url = 'members-area', where "members-area" is the permalink of the page you're redirecting users to.

这篇关于WooCommerce 社交登录重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆