Jump to content

moein

New Members
  • Posts

    4
  • Joined

  • Last visited

moein's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. for security issue, use this $location = $_SERVER['HTTP_REFERER']; wp_safe_redirect($location);
  2. thanks for the reply I have no knowledge of programming, and with a great deal of effort I obtained these codes Yes it's about WordPress My theme uses a login pop-up Modal [this cod: mf_get_option('login_reg_popup')] , I use that pop-up instead of a redirect to the login page The following code is for displaying popup login templates when you click the checkout button <?php function woocommerce_button_proceed_to_checkout() { $checkout_url = WC()->cart->get_checkout_url(); ?> <div <?php echo mf_get_option( 'login_reg_popup' ) ? 'data-toggle="modal" data-target="#login-modal"' : null; ?>> <a class="checkout-button button alt wc-forward" href="<?php echo ! mf_get_option( 'login_reg_popup' ) ? wc_get_page_permalink( 'myaccount' ) : '#'; ?>" class="checkout-button button alt wc-forward"><?php _e( 'اقدام به پرداخت', 'woocommerce' ); ?></a> <?php } I would like the following terms to be done by user clicking on that checkout button 1. If not logged-in and it was in the cart page then display popup and login=> redirect to the checkout page 2. If logged-in and it was in the cart page then after clicking the checkout button=> redirect to the checkout page 3. Except cart page, the user logged in everywhere site => redirect to the current page user I hope you guide me
  3. Hello I use this code to display popup login when user to clicked on a "proceed to checkout" button in the cart page (woocomerce) <?php function woocommerce_button_proceed_to_checkout() { $checkout_url = WC()->cart->get_checkout_url(); ?> <div <?php echo mf_get_option( 'login_reg_popup' ) ? 'data-toggle="modal" data-target="#login-modal"' : null; ?>> <a class="checkout-button button alt wc-forward" href="<?php echo ! mf_get_option( 'login_reg_popup' ) ? wc_get_page_permalink( 'myaccount' ) : '#'; ?>" class="checkout-button button alt wc-forward"><?php _e( 'اقدام به پرداخت', 'woocommerce' ); ?></a> <?php } But after login, I want the user to be redirected to the "checkout" page if it is on the cart page Otherwise redirect to your current page wherever you are logged in I found the following code but I couldn't put it in the code above Thank you for helping me with your kindness <?php //redirect to your "current" page wp_redirect( $_SERVER["HTTP_REFERER"] ); // redirect to the "checkout" page function wpse_131562_redirect() { if (! is_user_logged_in() && (is_woocommerce() || is_cart()) ) { // feel free to customize the following line to suit your needs wp_redirect(site_url('checkout/')); exit; } } add_action('template_redirect', 'wpse_131562_redirect');
  4. Hello all my theme itself has the feature of logging in with Google but there are some drawbacks Hope you can help me My theme uses this file (socials-auth.php) to login with Google http://txt.do/1ktj8 I want the user to not redirect after logging into /my-account page and become the same as the current page line 57 and 75 wp_redirect( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); And after the user login, his Gmail name will appear with a random number, But I want to get the name and lastname from his Google account and display it on the site (pre_user_nickname) line 62 if ( ! empty( $userProfile ) ) { $email = $userProfile->email; if ( email_exists( $email ) ) { $user_data = get_user_by( "email", $email ); mf_login_user( $user_data ); wp_redirect( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); } else { list( $user_login, $no_matter_data ) = explode( '@', $email ); $u_login = $user_login . rand( 1000, 9999999 ); $password = bin2hex( random_bytes( 15 ) ); $user_register_data = [ 'user_login' => apply_filters( 'pre_user_login', $u_login ), 'user_email' => apply_filters( 'pre_user_email', $email ), 'user_pass' => apply_filters( 'pre_user_pass', $password ), ]; Hope you can help me thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.