In the plugin settings I have checked to Show the order print link in Admin emails (This includes the emails for a new, processing and completed order. On top of that the customer and admin invoice emails will also include the link.) — BUT it is not showing.
I am assuming that it’s because I am not using the default Woo emails.
How can I show this link using your Email Template Customizer?
Please advise!
Thank you.
Chris
this is very big problem
]]>everything went smoothe with Noptin, except: After a while I noticed that the admin email does not get any notifications about new subscribers.
All other mails are sent without problems. I added a valid and tested mail address to the “Notification recipient(s)” field in the Settings.
What am I doing wrong?
Cheers, Frank
]]>I am noticing that admin is not getting the new message notifications anymore (no browser tab notif and no new message count appearing)
Other users are getting the notifications fine
Thanks a lot
]]>I am working on a plugin feature that checks for usage of image media before deletion – specifically within Advanced Custom Fields image fields in posts of a custom post type, but this part is not the issue.
I can use a WP_Query/meta_query to successfully check for this scenario, but the problem is that I would like to print the results of my WP_Query to the wp-admin/upload.php page so that administrators can understand if the attachment was deleted successfully, or if not, why. I am not sure how to make this possible.
Here is example code I am testing with now. Currently I am writing the results of my check to wp-content/debug.log. It would be better if administrators could see that in wp-admin.
// Prevent deletion of attached media
function check_acf_image_field_usage( $attachment_id ) {
// Relevant meta keys are the image field names
$image_field_names = array(
'acf_image_field_name_example_1',
'acf_image_field_name_example_2',
'acf_image_field_name_example_3',
);
// Create a meta query from $image_field_names starting with 'relation' => 'OR'
$image_fields_meta_query = array('relation' => 'OR');
for ($i = 0; $i < count($image_field_names); $i++) {
$newArray = array(
'key' => $image_field_names[$i],
'value' => $attachment_id,
'compare' => '=',
);
array_push($image_fields_meta_query, $newArray);
}
$args = array(
'post_type' => 'custom-post-type',
'meta_query' => $image_fields_meta_query
);
$query = new WP_Query($args);
// If 0 posts were found in the meta_query
if (count($query->posts) === 0) {
// CHANGE THIS write_log FUNCTION INTO SOMETHING THAT WILL OUTPUT TO wp-admin?
write_log("The attachment that was requested to be deleted is included in " . count($query->posts) . " posts, so it will be deleted.");
// Proceed to delete the attachment.
return;
// If 1 or more posts were found in the meta_query
} else if (count($query->posts) > 0) {
// CHANGE THESE write_log FUNCTIONS INTO SOMETHING THAT WILL OUTPUT TO wp-admin?
write_log("The attachment that was requested to be deleted is included in " . count($query->posts) . " posts.");
write_log('It is currently attached as an image to:');
// Loop through meta query results to log each discovered post containing the attachment
for ($i = 0; $i < count($query->posts); $i++) {
write_log($query->posts[$i]->ID . ' - ' . $query->posts[$i]->post_title);
}
// Stop WordPress execution so that the attachment is not deleted.
$message = 'Sorry, this attachment cannot be deleted.';
wp_die($message);
}
}
add_action( 'delete_attachment', 'check_acf_image_field_usage' );
// Generic function for writing data to wp-content/debug.log file
function write_log( $log ) {
if ( true === WP_DEBUG ) {
if ( is_array($log) || is_object($log) ) {
error_log( print_r($log, true) );
} else {
error_log( $log );
}
}
}
Here are the requirements:
– Print results of a WP_Query to a wp-admin page (upload.php) that happens within the ‘delete_attachment’ hook.
– All that matters to me is that administrators see the results of the query, I don’t care much about how or where it appears.
– In other words, the content for the admin notification depends on the WP_Query results, which runs when an admin tries to delete an attachment.
– What is the best way to print information from a WP_Query to a wp-admin page at the time the hook is called?
– Simply using an admin notice doesn’t seem to be a solution because that shows the same data every time the page is loaded, and the WP_Query does not run when the page loads.
Additionally, I am wondering is there a better method than using wp_die() to stop the attachment from being deleted?
Thanks for your help!
]]>Kind regards
]]>I am, however, successfully sending mail through Gravity Form contact forms on the site.
I’ve installed WP mail log to track mail being sent and what I’ve noticed is that when a message is sent through gravity forms the headers column is populated with from address and content type, however when I send the admin update request the header column in Wp mail log is blank.
I’m having trouble figuring out how to resolve this without disrupting gravity forms operations?
Any suggestions would be great, I will continue researching in the mean time.
Also, the site is installed on a VPS running ubuntu, there are no other websites o n the VPS, if that helps at all.
Thanks,
]]>There is a hook “um_registration_complete” that might be useful for this. But how to evalute registration fields and send mails based on conditions?
Thanks for pointers or code samples.
]]>Is there a way to remove a temporary user automatically, once their account expires?
I realised that when your plugin creates a temporary account, it creates an actual WP user account in the backend. Which is totally fine. But once it expires, that account remains in the regular WP Users list, even though the user can’t actually login anymore. Which is a problem, because some plugins (and WP core) use WP Users table to send notifications to active admins (or other roles). And since those accounts are still in the list, notifications will be wrongly sent out to them, even if the account already expired. The plugin needs to clean up it’s expired users out of the WP Users list in order to avoid that.
NOTE: It would still be nice to be able to restore/extend expired accounts, but only from the Temporary Logins settings page. So perhaps you need to store the list of expired temporary users in the DB somewhere. That way WP Users will only contain active accounts, while you will still have the ability to restore old users again (which will then re-add them to the WP Users table).
Regards,
Alex