wordpress - Redirect after login in custom login page WP -
first sorry english
i have problem of redirect user when connected , make on custom login page (modal)
when put submit
i call code in connexion.php
<?php define('wp_use_themes', false); require_once('../../../../wp-load.php'); global $qode_options_theme16; global $wp_query; global $wpdb; // using ldap bind $ldaprdn = "cn=gazano,dc=cerpweb,dc=local"; // ldap rdn or dn $ldappass = "test"; // associated password // connect ldap server $ldapconn = ldap_connect("192.168.209.7","389") or die("could not connect ldap server."); ldap_set_option($ldapconn, ldap_opt_protocol_version, 3); if ($ldapconn) { // binding ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "ldap bind successful..."; $mdp = wp_hash_password('cerpcerp'); $wpdb->query("insert wp_users (user_login,user_pass, user_nicename, user_email, user_url, user_activation_key, user_status,display_name) values ('hjhjh', '$mdp','e51511','dsfdsf@live.be','15d15','ertre','0','jhjh')"); $user=wp_authenticate('hjhjh', 'cerpcerp'); $ie=wp_redirect(home_url()); my_login_redirect( $ie,' ', '1' ); } else { echo "ldap bind failed..."; } } ?>
my ldap works correctly , insert works , wp_authenticate('hjhjh', 'cerpcerp'); works also,
but problem in my_login_redirect( $ie,' ', '1' )
the redirect in home works correctly without connexion ...
and in header.php put 1
global $current_user; $current_user = wp_get_current_user();
someone can me
thank in advance
as far remember need exit() right after wp_redirect
.
you have filter it
add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
Comments
Post a Comment