I have been using a lot of VIEWS shortcodes and TYPES shortcodes to create dynamic pages.
The site was very slow because of these shortcodes so I decided to create a user_meta array that contains information from most commonly run attributes. This saves processing time and loads the page faster.
I want to update the array by using custom code written in toolset custom code section. The code has been written and it works fine if I use the on-demand feature of toolset and append the file to the url - hidden link
However, this creates a problem that the page does not load UNTIL the file-name.php is fully executed. This causes a delay. As I am using a toolset form to login and toolset custom cod section to write the code, I was wondering if there is a way to run the code for a specific user AFTER the user logs in. This way the page will show data from the last update and by the time the user refreshes the page, the latest code would have run and the data would be 100% accurate.
The file-name.php is user specific so I need to run it when a user logs in. I tried to do this with cron job but it appears that cron-job does not run for a specific user.
AI am on US time and would prefer a US person to manage this ticket.
Hello,
There isn't such kind of built-in feature with Toolset plugins, in your case, I suggest you try to add a AJAX action after specific user load the frontend pages/post, for example:
1) Add an AJAX action, and trigger a PHP function
https://codex.wordpress.org/AJAX_in_Plugins
2) In this PHP function, check the user's roles:
https://developer.wordpress.org/reference/functions/wp_get_current_user/
and run your custom PHP file
My issue is resolved now. Thank you!