Erfan MHDi
Forum Replies Created
-
Forum: Plugins
In reply to: [ARI Fancy Lightbox - Popup for WordPress] FancyBox APIit Works now,
Thanks!
hello,
Thank you for your reply,
i’ve tried thiswppb_update_user_status_on_admin_registration( $NewUser );
but the users are still being created with Approved User Status.
here is the main code i’m using to import users from an external api using ACF Option Page.
function API_Bulk_User_Importer() { $screen = get_current_screen(); if (strpos($screen->id, 'user-importer') == true) { $NewUser = wp_insert_user( array( 'user_login' => $UserName, //from api 'user_pass' => wp_generate_password( 10, true, true ), 'user_email' => $UserEmail,//from api 'role' => 'business_account', ) ); if ( is_wp_error($NewUser) ) { //handle error here } else { $user = get_user_by('id', $NewUser); update_user_meta( $NewUser, 'company', $UserItem['company'] ); wppb_update_user_status_on_admin_registration( $NewUser ); //handle successful creation here } } } add_action('acf/save_post', 'API_Bulk_User_Importer', 10);
Thanks in Advance.
Hello @champsupertramp,
it seems that the problem was using
$_REQUEST['redirect_to']
i manage to fix the problem by using$_SERVER['QUERY_STRING']
instead.
it seems to be working just fine.
here is my final code in case anyone else faces the same issue:function RedirectToURLParameter() { if( isset( $_GET['redirect_to']) && !empty($_REQUEST['redirect_to']) ) { $redirect_to = $_SERVER['QUERY_STRING']; $redirect_to = str_replace("redirect_to=","", $redirect_to ); $redirect_to = str_replace("wishlist_notice=true&","", $redirect_to ); wp_redirect( $redirect_to ); exit; } } add_action('wp_login','RedirectToURLParameter',1); add_action('wp_logout','RedirectToURLParameter',1);
Thank you for your helps @champsupertramp,
P.S: please Do tell me if there is any thing unordinary in my code or if it might have any security issue ( clearly i’m not the expert here ?? ).
Hi @champsupertramp,
Thanks for your response, but it seems there is a problem.
using this line of codes:function RedirectToURLParameter() { if( isset( $_REQUEST['redirect_to'] ) && !empty($_REQUEST['redirect_to']) ) { $redirect_to = $_REQUEST['redirect_to'] ; $redirect_to = str_replace("wishlist_notice=true&","", $redirect_to ); wp_redirect( $redirect_to ); exit; } } add_action("wp_login","RedirectToURLParameter",1); add_action("wp_logout","RedirectToURLParameter",1);
and following this link :
https://www.example.com/signin/?redirect_to=https://store.example.com/account/?wishlist_notice=true&add_to_wishlist=609
is ending up with this link after successful login:
https://store.example.com/account/?wishlist_notice=true
instead of this one:
https://store.example.com/account/?add_to_wishlist=609
the “str_replace” is converting the url correctly but the redirect function is redirection to wrong url.
it seems what’s comes after “&” in “redirect_to=” value is being skipped in first place and the redirect function is redirecting to a url like this:
https://store.example.com/account/?wishlist_notice=true
any idea ?
- This reply was modified 3 years, 4 months ago by Erfan MHDi.
up!
Hello Again @champsupertramp,
there is a problem with the function you kindly mentioned above in some urls that contains another query parameters.right now i’ve this redirect function on my functions.php
function RedirectToURLParameter() { if( isset( $_REQUEST['redirect_to'] ) && ! empty($_REQUEST['redirect_to']) ){ wp_redirect( $_REQUEST['redirect_to'] ); exit; } } add_action("wp_login","RedirectToURLParameter",1); add_action("wp_logout","RedirectToURLParameter",1);
when url is like this:
https://www.example.com/signin/?redirect_to=https://store.example.com/account/
it’ll open this url after successful login:
https://store.example.com/account/
but when the url is like this one:
https://www.example.com/signin/?redirect_to=https://store.example.com/account/?wishlist_notice=true&add_to_wishlist=647
it’ll open this url after successful login:
https://store.example.com/account/?wishlist_notice=true
what i need to be open after login is this url:
https://store.example.com/account/?wishlist_notice=true&add_to_wishlist=647
or maybe hopefully strip the
wishlist_notice=true&
and make the final url like this :
https://store.example.com/account/?add_to_wishlist=647
Thanks in Advance for your time and friendly help. ??
- This reply was modified 3 years, 4 months ago by Erfan MHDi.
- This reply was modified 3 years, 4 months ago by Erfan MHDi.
- This reply was modified 3 years, 4 months ago by Erfan MHDi.
Hello @champsupertramp,
it’s working just they way i was looking for,Thanks mate ??
Perfect, Thanks man !
Ops, Sorry about that, didn’t notice it.
hello,
i have a question about redirecting user after SignIn, Up or Out!
as im using wp multisite, i need to redirect user from SubSite to main site because i only have ultimate member and SignIn form in main site and then after successful login, redirect user back to the ‘account’ page of the sub site he/she was before clicking the login link.i’ve tried this link using ‘?redirect_to’ url parameter
<a href="<?php echo network_home_url() . 'signin/?redirect_to=' . home_url() . '/account/'; ?>" >
to redirect user from this url => example.com/subsite1
to this url => example.com/signin (multisite main-site)
and after successful login i need user to be redirected to => example.com/subsite1/accountand it was working fine with WordPress multisite in subdirectory mode,
but as i had to switch to subdomain mode it looks like the ?redirect_to parameter is being skipped.
what i’m trying to do in subdomain mode isredirect user from this url => subsite1.example.com
to this url => example.com/signin (multisite main-site)
and after successful login i need user to be redirected to => subsite1.example.com/account
but currently user is being redirected to example.com after successful login.i have tried to encode the ?redirect_to value but it make no different with none of these links:
<a href="https://example.com/signin/?redirect_to=https://subsite1.example.com/account/" >
<a href="https://example.com/signin/?redirect_to=https%3A%2F%2Fsubsite1.example.com%2Faccount%2F" >
how can i use redirect_to url parameter to redirect user from sub site to main site login form and redirect him back to the sub site he was at ?
Thanks in Advance!
- This reply was modified 3 years, 5 months ago by Erfan MHDi.
Hi @champsupertramp,
I thought maybe there is a better way with ultimate member hooks or filters than activating the remember me option in ultimate member and make it checked by js on pageload event and hide the box with css display none!
Whats ur idea ?- This reply was modified 3 years, 5 months ago by Erfan MHDi.
the workaround you published is working perfectly ??
Thanks for your time!Perfect!
Thanks, looking forward to hear from you tomorrow. ??Make a test user and verify if this fixes your issue.
yup, Both “JohnDoe” and “johndoe” can now update first and last name in account page.
i didn’t know about the regex problem on custom “user_login” validation.
but i’ve noticed this a while ago (2 years ago i think) and reported it here but i got no answer so i bring it up again.it seems that adding strtolower validation to the core file you mentioned fixes the problem, so should we expect this to be added to UM next update or we have to create an override for it ?
Thanks !
Hi,
Thanks, adding strtolower to line 98 works.
but how can i update proof it ?
is there any hook or any way i can add “strtolower” validation inside my theme so when i update UM plugin this will still works?- This reply was modified 3 years, 5 months ago by Erfan MHDi.
hello,
i didn’t customize it,
the field is just there by itself i guess, wrapped in#um_field_general_user_login
div but the input is disabled.im using General form on Account Page:
[ultimatemember_account tab=general]
Regards.