Comment rediriger une inscription réussie vers un modèle de page?
-
-
vérifier lesplugins disponiblespour desexemples de codecheck the available plugins for code samples
- 0
- 2011-06-10
- kaiser
-
@kaiser quelgenre deplugins?@kaiser what kind of plugins?
- 0
- 2011-06-10
- janoChen
-
[Redirect Plugins] (http://wordpress.org/extend/plugins/search.php?q=redirect&sort=) - Vos clients l'aimeront.[Redirect Plugins](http://wordpress.org/extend/plugins/search.php?q=redirect&sort=) - Your clients will like it.
- 0
- 2011-06-10
- kaiser
-
4 réponses
- votes
-
- 2011-06-10
Vouspouvez utiliser lefiltre
registration_redirect
pour renvoyer votrepropre URL,parexemple;function wpse_19692_registration_redirect() { return home_url( '/my-page' ); } add_filter( 'registration_redirect', 'wpse_19692_registration_redirect' );
Déposez-le dans votre
functions.php
ou dans unplugin :)You can use the filter
registration_redirect
to pass back your own URL, for example;function wpse_19692_registration_redirect() { return home_url( '/my-page' ); } add_filter( 'registration_redirect', 'wpse_19692_registration_redirect' );
Drop it in your
functions.php
or a plugin :)-
Mercipour la réponsemaisje suistoujours redirigé vers leback-end wp-login: ((jetravaille sur localhost LAMP,maisje nepensepas que ce soit la raison).Thanks for the answer but I'm still being redirected to the wp-login back-end :( (I'm working on localhost LAMP, but I don't think that's the reason).
- 0
- 2011-06-10
- janoChen
-
Êtes-vous sûr que lethème avec le codeest actif?Et quelle version de WP utilisez-vous?Cela abien fonctionnépourmoi (testétout à l'heure,3.1.3).Are you sure the theme with the code is active? And which version of WP are you running? It worked fine for me (tested just now, 3.1.3).
- 0
- 2011-06-10
- TheDeadMedic
-
OK,cela afonctionné après avoir désactivébbPress.Merci!OK it worked after I deactivated bbPress I guess there is a conflict with the plugin. Thanks!
- 1
- 2011-06-10
- janoChen
-
@TheDeadMedic J'ai une question similairemaisje m'inscris àpartir d'unepage avec unmodèlepersonnalisé qui comprend unformulaire d'inscription.La redirectionne fonctionnepas,elleme ramène à lapage d'inscriptionprincipale avec unmessagepour vérifiermone-mailpour lemot depasse.Pouvez-vousjeter un oeil àma question s'il vousplaît.http://wordpress.stackexchange.com/questions/130560/redirect-to-custom-url-after-registering-from-a-page-with-registration-form@TheDeadMedic I have a similar question but i'm registering from a page with a custom template that includes a registration form. The redirect isn't working it's taking me back to the main registration page with message to check my email for the password. Can you take a look at my question please. http://wordpress.stackexchange.com/questions/130560/redirect-to-custom-url-after-registering-from-a-page-with-registration-form
- 0
- 2014-01-20
- Anagio
-
- 2012-09-04
C'est ce quej'utilise
<form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> <input type="text" name="user_login" value="Username" id="user_login" class="input" /> <input type="text" name="user_email" value="E-Mail" id="user_email" class="input" /> <?php do_action('register_form'); ?> <input type="submit" value="Register" id="register" /> <input type="hidden" name="redirect_to" value="/success"/> <p class="statement">A password will be e-mailed to you.</p> </form>
This is what i use
<form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> <input type="text" name="user_login" value="Username" id="user_login" class="input" /> <input type="text" name="user_email" value="E-Mail" id="user_email" class="input" /> <?php do_action('register_form'); ?> <input type="submit" value="Register" id="register" /> <input type="hidden" name="redirect_to" value="/success"/> <p class="statement">A password will be e-mailed to you.</p> </form>
-
- 2015-12-08
Si commemoi,vous utilisez unplugin comme ProfilePress pourpower/create votreformulaire d'inscription WordPress,le code suivant se connectera automatiquementet redirigera les utilisateursenregistrés vers unepage d'accueil.
add_action( 'pp_after_registration', 'pp_redirect_after_registration', 10, 3 ); function pp_redirect_after_registration( $form_id, $user_data, $user_id ) { wp_set_auth_cookie( $user_id ); wp_set_current_user( $user_id ); $custom_page_url = 'http://example.com/welcome/'; wp_redirect( $custom_page_url ); exit; }
Remarque:j'utilise leplugingratuit ( https://wordpress.org/support/plugin/ppress )et le code ci-dessusfonctionnent à lafoisen versiongratuiteet en version PRO.
If like me, you use a plugin like ProfilePress to power/create your WordPress registration form, the following code will automatically log in and redirect registered users to a welcome page.
add_action( 'pp_after_registration', 'pp_redirect_after_registration', 10, 3 ); function pp_redirect_after_registration( $form_id, $user_data, $user_id ) { wp_set_auth_cookie( $user_id ); wp_set_current_user( $user_id ); $custom_page_url = 'http://example.com/welcome/'; wp_redirect( $custom_page_url ); exit; }
Note: I use the free plugin (https://wordpress.org/support/plugin/ppress) version and the above code work both in free and the PRO version.
-
- 2016-09-13
J'ai développé unpluginpour ceproblème. Voustrouverez également ci-dessous le codebrut d'une redirection sansplugin.
/** * Rediriger les utilisateurs vers une URLpersonnaliséeen fonction de leur rôle après la connexion **/ function wp_woo_custom_redirect ($ redirect,$ user) { //Récupère lepremier detous les rôles attribués à l'utilisateur $ role=$ utilisateur-> rôles [0]; $ dashboard=admin_url (); $mon compte=get_permalink (wc_get_page_id ('mon-compte')); if ($ role=='administrateur') { //Redirige les administrateurs vers letableau debord $ admin_redirect=get_option ('admin_redirect'); $ redirect=$ admin_redirect; }elseif ($ role=='shop-manager') { //Redirige les responsables demagasin vers letableau debord $ shop_manager_redirect=get_option ('shop_manager_redirect'); $ redirect=$ shop_manager_redirect; }elseif ($ role=='client'|| $ role=='abonné') { //Redirige les clientset abonnés vers lapage "Mon compte" $ customer_redirect=get_option ('customer_redirect'); $ redirect=$ customer_redirect; } autre { //Redirigetout autre rôle vers lapage visitéeprécédente ou,s'iln'estpas disponible,vers l'accueil $ redirect=wp_get_referer ()? wp_get_referer (): home_url (); } return $ redirect; } add_filter ('woocommerce_login_redirect','wp_woo_custom_redirect',10,2);
Si vous vous sentez à l'aise detravailler avec unplugin ou sans code? Vouspouveztéléchargeret installermonplugin " WP WooCommerce Redirect "
I have developed a plugin for this issue. Also given below is the raw code for a redirect without any plugin.
/** * Redirect users to custom URL based on their role after login **/ function wp_woo_custom_redirect( $redirect, $user ) { // Get the first of all the roles assigned to the user $role = $user->roles[0]; $dashboard = admin_url(); $myaccount = get_permalink( wc_get_page_id( 'my-account' ) ); if( $role == 'administrator' ) { //Redirect administrators to the dashboard $admin_redirect = get_option('admin_redirect'); $redirect = $admin_redirect; } elseif ( $role == 'shop-manager' ) { //Redirect shop managers to the dashboard $shop_manager_redirect = get_option('shop_manager_redirect'); $redirect = $shop_manager_redirect; } elseif ( $role == 'customer' || $role == 'subscriber' ) { //Redirect customers and subscribers to the "My Account" page $customer_redirect = get_option('customer_redirect'); $redirect = $customer_redirect; } else { //Redirect any other role to the previous visited page or, if not available, to the home $redirect = wp_get_referer() ? wp_get_referer() : home_url(); } return $redirect; } add_filter( 'woocommerce_login_redirect', 'wp_woo_custom_redirect', 10, 2 );
If you feel comfortable working with plugin or without code? You can download and install my plugin "WP WooCommerce Redirect"
Chaquefois queje m'inscris,je me retrouve dans lapage wp-login (back-end):
Existe-t-il unmoyen de rediriger les utilisateurs qui s'inscrivent vers unmodèle depage (front-end)?