aaron13223
Forum Replies Created
-
Here’s the whole process for better clarity:
We register an endpoint using
register_rest_route()that acts as a webhook. (The function that adds this is hooked into the action rest_api_init)When we recieve a request on that endpoint, we create an async action using
as_enqueue_async_action()We run WP Cron via the WP CLI that is managed by a systemd-timer. It basically runs at an interval to simply run the following command:
wp cron event run --due-nowAnd so action scheduler runs accordingly as well. The function run via this particular async action is this:
wp_trash_post( $order_id );Also, thanks for the confirmation on
simple_history/pause, we have implemented so I think it should “fix” our problem but I guess it would be good to sort out this “incorrect identifier” as well?Please let me know if you would like me to mark this as solved. Thanks again for all your help!
I am adding some of the code snippets too, just in case.
Register Webhook:
$namespace = WPSC_NAMESPACE . '/' . WPSC_API_VERSION;
$route = 'checkout';
$args = array(
'methods' => 'POST',
'callback' => array($this, 'process_checkout'),
'permission_callback' => array($this, 'validate_request'),
);
// Finally register our route
register_rest_route( $namespace, $route, $args );Enqueue Async Action:
as_enqueue_async_action(
'wpsc_async_order_delete_order', // $hook
array('data' => $data, // $args
'wpsc_low', // $group
false, // $unique
20
);Some solutions of the top of my head:
- Some way to stop logging of events so we can do that right before we run things like wp_trash_post (This way we can just log custom events since primary event would not show up)
- Some way to set “user” in some context. So it identifies the consequent events correctly? I am assuming
simple_history/log_insert_contextruns right before the event is logged but wouldn’t really be ideal to transform it in this scenario? - Try to figure out context for Action Scheduler.
I would say 1 is great for US. Do you think using
do_action('simple_history/pause')and thendo_action('simple_history/resume')would work well? Would this only work in the current context or would it stop logging ALL events until we set it to resume again? That would be my only concern.All of these are purely ideas/request. Please don’t feel burdened to implement or see to these if necessary. Thanks again for all your help. I really appreciate it.
Hi @eskapism ,
Thanks for getting back so promptly. Here’s more details about the setup:
We use a custom plugin to register a rest route using
register_rest_route()Now when a request is made on that webhook, we use action scheduler to run the function as a background task using
as_enqueue_async_action()When the action scheduler queue runs the corresponding function, it simply calls
wp_trash_post()Let me know if there’s any more info you would require and thanks a lot for your help!
Forum: Plugins
In reply to: [Autoptimize] Broken variables/rgb valuesHi @optimizingmatters ,
I have now been using variables to update the rgb values and that does not cause issues. Thanks for your help.
If possible, I would really appreciate it if in the future the regex rules can be updated so this doesn’t happen. Regardless, thanks a lot for this great plugin:)Forum: Plugins
In reply to: [Nextend Social Login and Register] After Login Hook?Hi @robertnextendweb ,
Thanks a lot for your help!
nsl_{{provider_id}}_link_useraction is what I was looking for.I have one other question but it’s completely okay if you don’t answer since I understand custom code is out of scope.
Do you think
wp_get_session_token()will work well in this context of the nsl action to get the session token of the user who just linked their social account?Thanks again for your help!
Forum: Plugins
In reply to: [Nextend Social Login and Register] Edit/Disable Register Notice/MessageHi Laszlo,
Thanks so much for this! That is definitely a much more efficient approach. You guys are awesome 😉
Forum: Plugins
In reply to: [Nextend Social Login and Register] Edit/Disable Register Notice/MessageAdding this in case someone ever needs it in the future:
function modify_nextend_register_message($translated_text, $text, $domain) {
if ($text === 'Register For This Site') {
return 'Custom message';
}
return $translated_text;
}
add_filter('gettext', 'modify_nextend_register_message', 20, 3);Forum: Plugins
In reply to: [Nextend Social Login and Register] Edit/Disable Register Notice/MessageHi Robert,
I hope you are doing well and thanks so much for getting back so quickly.
I talked about the privacy part so it’s easier to identify what form I was talking out.
The one I am talking about in particular is the one the one users reach if they try to login in via their social account but do not have an account yet. So they see the “Register” form in that case.
What I want to edit/disable is the Message/Notice that shows up at the top of the form with the text “Register For This Site”
That notice is added via the function displayForm() in the class NextendSocialUserData inside the file includes/userdata.php.
The notice is being added on line 156 with this code:
login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $this->errors);I also understand if you guys cannot help with custom coding, no issues with that:)
I just thought it would better to reach out to you guys to hear your thoughts about what could be a good solution to this.
I will see what I can do with the translation file. Let me know what you think and I really appreciate your help on this. Thanks again!
Forum: Plugins
In reply to: [WooCommerce] Cannot Override Templates – Custom ThemeFor anyone that comes across this later. The templates do override if you put them in the correct folder just that you HAVE to clear object cache if you have it enabled. New templates do not appear unless you clear object cache like Redis. 😉
Worked like a charm. Thanks so much!
if( function_exists( 'SimpleLogger' ) ){
$user = get_user_by( 'id', $user_id );
$log = SimpleLogger()->info(
'User purchased {product} successfully for ${amount}.',
[
'product' => get_the_title( $data['metadata']['product_id'] ),
'amount' => $amount_total,
'category' => 'payments',
'_initiator' => Simple_History\Log_Initiators::WP_USER,
'_user_id' => $user_id,
'_user_login' => $user->user_login,
'_user_email' => $user->user_email,
]
);
}Forum: Plugins
In reply to: [Action Scheduler] Running Every X sec?Hi Barry,
Thanks a lot for the detailed info!
I am sorry as I initially missed the WP-CLI part but now that I have read it, this is exactly what I was looking for!
I was already grouping tasks like this: abc-high, abc-medium, abc-low
I can now run specific groups of tasks with varying times with the systemd timer on the Server directly.
Thanks a lot for your help!
Forum: Plugins
In reply to: [Nextend Social Login and Register] Social Button Jumping? Initially HiddenHi Laszlo,
Thanks a lot for the detailed response! I am assuming this doesn’t happen when the buttons are added below the Login Form with the premium version?
Anyway, I was able to remove the positioning codes by adding [theme]/nsl/login/below.php like you suggested.
And then I positioned the Social Login Button using position:absolute and added position: relative and some padding to .login formThis worked well and now there’s no CLS! Thanks a lot for your help!
Forum: Plugins
In reply to: [Nextend Social Login and Register] Social Button Jumping? Initially HiddenHi Laszlo,
Thanks a lot for the quick turnaround. I am using the Free plugin and not the pro version. Could you please take a look at this link?
If you look closely, you will notice that the Google Login Button has a CLS Issue where it is hidden by default and as soon as the page fully loads, it comes into view.
The Button only looks like it’s “jumping” when I force the button to be displayed from the start using an external stylesheet. Let me know what you think or if you need anything else from me.#nsl-custom-login-form-main .nsl-container{
display: none;
}The code above seems to be added and the display: block; is set with inline css – maybe that’s why?
Thanks again!
- This reply was modified 1 year ago by aaron13223.
Forum: Reviews
In reply to: [Login by Auth0] Avoid “Login by Auth0” – A Broken, Abandoned Mess! 🚨“Fatal Errors & Crashes” – What was the exact issue?
It mostly looks like a rant rather than a productive review. I could just say “It works for me” but I’d rather listen to you explain what exactly was the problem you faced?Forum: Plugins
In reply to: [Lazy Load for Videos] Vimeo: The embed code for this video is not validHey Kevin,
The url in the post editor is: https://vimeo.com/526338719/458ab0c2bc
This does embed normally when you’ve the plugin deactivated. Thanks again!