fabx77
Forum Replies Created
-
Good evening,
Thank you so much for your reply!!!
Indeed, I’m not very comfortable with hooks…
Here’s a very early version of my code:
// // Create a cron job to run the day after an event happens or ends
function set_expiry_date( $post_id ) {
error_log( 'start of function' );
// See if an event_end_date or event_date has been entered and if not then end the function
if( get_post_meta( $post_id, $key = 'event_end_date', $single = true ) ) {
// Get the end date of the event in unix grenwich mean time
$acf_end_date = get_post_meta( $post_id, $key = 'event_end_date', $single = true );
} elseif ( get_post_meta( $post_id, $key = 'event_date', $single = true ) ) {
// Get the start date of the event in unix grenwich mean time
$acf_end_date = get_post_meta( $post_id, $key = 'event_date', $single = true );
} else {
// No start or end date. Lets delete any CRON jobs related to this post and end the function.
wp_clear_scheduled_hook( 'make_past_event', array( $post_id ) );
return;
}
}
// ....
.....
.....
// Hook into the save_post_{post-type} function to create/update the cron job everytime an event is saved.
add_action( 'acf/save_post', 'set_expiry_date', 20 );The error_log “Start of function” within the function never appears in the debug.log file, so I deduce that the function is never called…
Thank you so much again for your help!!! :-))
- This reply was modified 2 months, 3 weeks ago by fabx77.
Forum: Plugins
In reply to: [Code Snippets] My code is not executingHi Caroline,
Thank you so much for your information!
I have to add
var_dump($name_variable);to my procedure because I’ve noticed that my code isn’t executing and I can’t even see the variables displayed by another plugin called “variable_inspector”.I have four options in your plugin to run the code:
- Run everywhere
- Run only in the admin area
- Run only in the public interface
- Run only once
I’ve tried each one, but the code still doesn’t run… Here’s just the beginning of my code:
==================================================================
// Create a cron job to run the day after an event happens or ends
function set_expiry_date( $post_id ) {/ // See if an event_end_date or event_date has been entered, and if not, then end the function
if( get_post_meta( $post_id, $key = ‘date_de_latelier’, $single = true ) ) {
/ // Get the end date of the event in Unix grenwich mean time
$acf_date_de_latelier = get_post_meta( $post_id, $key = ‘date_de_latelier’, $single = true );var_dump($acf_date_de_latelier);
do_action(‘inspect’, [‘variable_name’, $acf_date_de_latelier]);} else {
// No start or end date. Lets delete any CRON jobs related to this post and end the function.
wp_clear_scheduled_hook(‘make_past_event’, array($post_id));
return; }……
The “workshop_date” variable is, of course entered for each article.
Thank you.
ps:WP_DEBUG and WP_DEBUG_LOG are indeed enabled in the config.php file.
- This reply was modified 2 months, 3 weeks ago by fabx77.
Forum: Fixing WordPress
In reply to: How to display the contents of variables used in a PHP procedureI actually moved it to the more appropriate forum, “Developing with WP,” but I don’t see it. Could you please move it to “Plugins” or “Developing with WP”? Thank you.
Forum: Fixing WordPress
In reply to: How to display the contents of variables used in a PHP procedureThank you so much for your information! I’ve rephrased my request with more details because I think the problem is more related to plugin settings than to PHP.
I created a test WordPress site in a local environment using WampServer.
I added PHP code (via the Code-Snippets plugin). Which file does WordPress add the code to? Is it in functions.php? I’m a bit lost…
Since I’m running tests, I’d like to display all the variables (custom fields via ACF) that I use in my procedure.
But on the site, where can I see the contents of my variables? When checking the site’s health status, it says:
“Your site is not configured to display debugging information.”
So, after searching online, I discovered that I needed to modify wp-config.php. Therefore, I added:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, true );
But my variables still aren’t showing up… :-(( Is there anything else I can do?
I know there are “Query Monitor” and “Variable Inspector” plugins, but I don’t really understand how they work or where my variables are displayed.
Apparently, I need to add lines to the code like:do_action( 'inspect', [ 'variable_name', $variable ] ). I checked the variables in “Variable Inspector” but I still don’t see them… I see others, but not the ones I added via Snippet…
I even used (another way) in my procedure:var_dump($acf_date_de_latelier);error_log( print_r( $acf_date_de_latelier, true ) );
`but still NOTHING…
I really think I’ve tried everything… :-((
Thank you so much for sharing your experiences 😉 because I’m really struggling with this problem… :-((Hello, still no ideas on my problem? Thank you.
Hello,
Thank you again for your help!
Regarding my first workflow based on metadata, I did enter the metadata in the “element” column (the date on which I want the action to occur), but
apparently, with this version of the plugin I have, it doesn’t take metadata into account. Is there something else I need to enable?Anyway, I created a new workflow (copies attached) which involves changing the category of an article based on a date in the calendar.
So I entered “on a specific date” and “Selected from the calendar.” However, when I look at the calendar, it always selects a date 2 or 3 days later by default.
Why is that?
So I change it to today’s date and a specific time, but it always reverts to the current time…?? (See the planned actions)I’ve attached four screenshots showing some steps in the workflow:
1/ “Scheduling Delay”
2/ “Replace all terms in the publication” (Categorize changed from “Upcoming Workshop” to “Past Workshop”)3/ The “Planned Actions” table
4/ And the debug logThanks again for your help! Because this time I’m completely lost…
- This reply was modified 3 months, 3 weeks ago by fabx77.
Hello,
After creating my workflow, nothing is triggered.
(Yet my crontab is active).
1/ When I check the “Scheduled Actions,” the scheduling date is correctly entered in this column, but there’s nothing in the arguments…is this normal?
(Note: even when I click “Run,” the event doesn’t trigger).
2/ Also, from the dashboard, when I check the list of articles, under “Future Action,” nothing is entered…?? Is this normal?
Is there another action I need to take after creating a workflow?
Thank you so much for your ideas, because I’m really struggling!
Note: However, when I’m editing an article, in the right sidebar, there’s “Future Action.” If I check it and then choose, for example, a trigger date, the action does trigger, but I would, of course, like it to be automatic via the workflow.
Thank you so much for your quick response!
“Upcoming Workshops” and “Past Workshops” are indeed article categories designed to automatically change categories once the workshop date has passed.
If I understand correctly, I can therefore create a custom field to serve as a reference.
For example:
– Workshop Day (D) is: 24/01 (I will, of course, include this in the article title to inform users)
- Custom field: 25/01
So, based on what I understand from your screenshot, the following day (D+1) will trigger an automatic category change?
Hello,
Have you found a solution to my problem with Firefox? I have several users who use this browser and they are really frustrated because in the field (drop-down list) they only see “protected mail” and not the email address.Thanks
Thank you again for your reply.
I did add the field manually, but since I didn’t see it in the list displayed next to each field, I didn’t know it could be added that way.Hello,
I exported my site locally (tested on my logical server: Wampserver64), so I kept the same plugins.
Thinking the problem was caused by a plugin, I deactivated them one by one, ending up with only two: Email Encoder and WP Forms Lite… and I’m still having the same problem in Firefox. Could you perform the same test on your end?Reminders:
- Theme: “Graphène”
- WP version: 6.8.3
- PHP version: 8.3.14
Thank you so much in advance for your help! 😉
PS: Is it the field with the email dropdown list that’s causing the problem with the plugin? I think I have the same problem even when using a simple email field (without a dropdown list)…
- This reply was modified 6 months, 1 week ago by fabx77.
Thank you again for your reply, but I still have the same problem…
Good evening,
Thank you for your reply!
I’ve attached a screenshot.
The problem only appears in the Firefox browser; only “protected mail” is displayed.
When I view the page’s HTML and go to “source page,” in the “option value” tag, I don’t see the email address in plain text, but rather hexadecimal, so the plugin is definitely active.
Note: when I use “inspect,” I do see the email address in plain text.In all other browsers, I see the email address + “protected mail.”
Thanks for your ideas 😉
Forum: Plugins
In reply to: [Authorizer] It doesn’t direct me to my WordPress siteThank you for your reply.
Yes, I have filled out all the necessary fields (keys, etc.), but it’s not working…Hello,
Thank you for your reply.
I tried retrieving my site locally on my Windows computer and it works perfectly!!! (and therefore, implicitly, must use the Windows crontab)
(ps: I only scheduled the action without declaring a workflow)Which would mean that the cron on the server is having a problem? However, when I look at the plugin settings, the crontab is indeed enabled on the server.
In short, I don’t understand the problem…???