Nicolas
Forum Replies Created
-
Hi, sorry for re-open this thread.
I want to know if the last update of the plugin which fixed conditional logic for the form fields without metakeys, solve this situation.
I would like to delete my custom code if the plugin do it by itself.
Thanks anyway and happy new year!!
Hi again!
I finally did it!
Im not proud, because i wanted to use php, but this is the best i could do:
function remove_before_send () { ?> <script> var boton = document.querySelector("#input"); boton.addEventListener("click", function(){ var elements = document.querySelectorAll('.um-is-conditional'); for (var i = 0; i < elements.length; i++) { if (elements[i].style.display == "none") { elements[i].childNodes[1].childNodes[0].value = ""; } } }); </script> <?php } add_filter( 'um_profile_content_main', 'remove_before_send');
- This reply was modified 4 years, 2 months ago by Nicolas.
By the way. I’m still looking for a solution and found this thread which is exactly my problem:
https://github.com/ultimatemember/ultimatemember/issues/381
Let me know if you could figure it out
Thanks!
Hi!! Sorry for re-open again this thread.
I already did the function with your advice, but does not work with that hook. Maybe im doing something wrong?
My code works if i use the hook um_profile_content_main, but this clear the fields when user try to edit his profile.
I wanted to clear these fields after user edit his profile, but before send to DB.
I tried with um_user_before_updating_profile too. But nothing happen.
Any idea? BTW: I use the hook um_after_user_updated with another function already.
function remove_before_send ($args) { ?> <script> var elements = document.querySelectorAll('.um-is-conditional'); for (var i = 0; i < elements.length; i++) { elements[i].childNodes[1].childNodes[0].value = "PROBANDO"; } </script> <?php } add_action('um_profile_content_main', 'remove_before_send');
EDIT:
I solved it.
I had to put this at first of my function (which i dont know well what it does lol):
global $ultimatemember; um_fetch_user( um_user('ID') );
Thanks for your help and your concern in my case ??
Hi again!
Sorry, I really don’t want to be a bother, but nothing has changed yet.
I’ll keep trying to make it work.
If you have another idea in mind, please let me know.
BTW, i note that if, for example, i change the first_name for another one in the first time nothing happen, but, when i do it for a second time with a different first_name, it will change to the option that i put at the first try. It’s very strange. I dont know if there a queque or something.
My debug console does not show anything related with the HTTP PUT Method.
Thanks for your time. I really appreciate it.
Hi!
Thanks for the code. But unfortunately nothing changed.
I tried with the original user edit of wordpress and works fine. The thing is when i try to make changes from the UM profile editor.
Any other idea?
Thanks again for your collaboration and sorry for bother you with this.
Sorry for the noob question, but where do i need to put it? At the start of the code or at the end?
This is more or less my code (which its work, but only if you edit profile twice). I use wp_remote_request with a put method:
function edit_profile( $args ) { $body = [ 'first_name' => um_user(first_name), 'last_name' => um_user('last_name'), 'phone' => um_user('phone'), 'email' => um_user('email'), ]; $body = wp_json_encode( $body ); $options = [ 'body' => $body, 'headers' => [ 'Content-Type' => 'application/json', ], 'method' => 'PUT', 'timeout' => 60, 'redirection' => 5, 'blocking' => true, 'httpversion' => '1.0', 'sslverify' => false, 'data_format' => 'body', ]; $response = wp_remote_request( 'https://xxxxxxxxxxxx.xxxx.xxx', $options ); UM()->user()->remove_cache( $user_id ); } add_action( 'um_after_user_updated', 'edit_profile', 10, 2 );
Thanks in advance! ??
I made this with pure javascript.
I think Ultimate Members forms uses only server validation, except for the confirm password field, which change border to red if password doesn’t match.
For example, i use this code to validate userlogin field with the keyup listener and the um_after_register_fields hook.
If username doesn’t match with my custom function (validate_ci), which is not in this example, the background field will be red. Otherwhise, will be green:
function customID() { ?> <script> var valinput = document.querySelector("#user_login-534"); valinput.addEventListener('keyup', function(){ if (validate_ci(valinput.value)){ valinput.style.background = "#9deb91"; } else{ valinput.style.background = "#eb91ae"; } }); </script> <?php } add_action('um_after_register_fields', 'customID');
Hope this help.
See ya!
I already understood what was happening
In the login form, user_login field does not appear. Thats why says its null.
- This reply was modified 4 years, 3 months ago by Nicolas.
You are absolute right, as usual with the plugin, Jonathan!
Btw. This code comes from the github documentation. In the push hook says Id for wp_object.
https://github.com/MinnPost/object-sync-for-salesforce/blob/master/docs/extending-sync-allowed.md
Thanks again for all your help!
Hi Jonathan. Understood. No problem.
Im trying with the custom hooks and i have a question with one. The object_sync_for_Salesforce_push_object_allowed
I put this in my function.php with the id of the user i dont want to be pushed to Salesforce but always get pushed to salesforce. I tried change the object. Instead of id, put an first_name, last_name to try, but not luck.
add_filter( 'object_sync_for_salesforce_push_object_allowed', 'check_user', 10, 5 ); // can always reduce this number if all the arguments are not necessary function check_user( $push_allowed, $object_type, $object, $sf_sync_trigger, $mapping ) { if ( $object_type === 'user' && $object['Id'] === 1 ) { $push_allowed = false; } return $push_allowed; }
Let me know. Thanks!
Hi Jonathan. It is working now. Had problems with the required fields in WordPress. Thanks you so much for all the suppport while al the install process in our organization.
Btw, do you know if this plugin can works with Gravity Forms fields? I am thinking in make my user registration with this plugin.
Let me know.
Thanks in advance!
Hi.
Im still interested in remove the modal in the upload single. It is not accessible at all.
Thanks in advance!
Nevermind. Its works now!
I tried again and it work from WordPress to salesforce with no problem.
But not for Salesforce to WordPress.
do you know what could be happening? I assume it is a salesforce problem.
Thanks!