Jan Lysy
Forum Replies Created
-
Hello @sitenoob247, @fixmybusiness, and @exatechgroup,
I was unable to replicate the problem you mentioned:
MailPoet error:
MailPoet\Doctrine\WPDB\Exceptions\QueryException: Duplicate entry ‘0’ for key ‘PRIMARY’
Based on the error message, it appears there may be an issue with your database structure, likely related to a corrupted auto-increment configuration. You can verify this by running the following database query:
SELECT COLUMN_NAME, EXTRA
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = 'wordpress'
AND TABLE_NAME = 'wp_mailpoet_newsletter_option_fields'
AND EXTRA LIKE '%auto_increment%';
Please ensure that the database name (
TABLE_SCHEMA
) in the query matches the one in yourwp-config.php
file, and that the table name (TABLE_NAME
) reflects your specific table prefix (e.g.,wp_
by default, or a custom prefix if one is used).If this query returns no results, it indicates that the auto-increment setting may not be configured properly. This could be caused by a manual change or by a migration or backup tool, which may have been used for creating a staging site or restoring a backup.
It’s important to note that the data in the
wp_mailpoet_newsletter_option_fields
table is inserted only once during the plugin activation and is never deleted by the MailPoet plugin.Could you let us know if you have recently used any plugins or tools for restoring your database, migrating between hosts, or similar actions? This information could help us pinpoint the cause of the issue. You can also share the version of the database used on your website.
Hello there?@hamid009?,
Thanks for sharing more information about the problem.
how can I get the last sent date of mailpoet in that category so I can only send limited new jobs in case there is only 2 or 3 new jobs in that category, I haven’t explore that part, may be your developer can shed light on this part and give me some hooks etc
I’m afraid that the MailPoet plugin does not currently have a mechanism that could assist you with this specific request related to your custom shortcode. The functionality you’re describing is managed by the Automated Latest Content block, which works in the background.
Now problem is that I am querying and showing these jobs in my own template, so I don’t need Latest Post widget to show posts in email body, but somehow only trigger this when there is new jobs in that category.
Okay I didn’t find solution but I did trick, I added the Latest Post Widget, and change Post to 1, then changed link color to white which is my background color, and changed all other links on pages to different colors manually, now when some new jobs are posted in category it does trigger email.
but is there a neat way to do this ?also can you tell me if there is a way to add some check in WP_Query to only send jobs which are posted after last mailpoet email ?
I really appreciate your creativity in finding a workaround! While I haven’t found a mechanism that directly resolves your challenge, here’s a cleaner approach you might try:
- Set up an Automated Latest Content block for your specific custom post type and category. This will automatically handle most of the filtering for you.
- Use the
mailpoet_rendering_post_process
filter, which allows you to modify the content of the email just before it’s sent. You can use this hook to inject custom logic or manipulate the email content. Here is a full list of MailPoet filters and actions. - Apply a regular expression to find the content of the specific post. MailPoet uses a table with a data attribute like
data-post-id
to identify posts in the email. - Use the post ID you find to load the specific post, then replace the content as needed with your own prepared content.
This method has some clear benefits: it allows you to leverage MailPoet’s existing filtering capabilities while reducing the need for manual custom solutions. By relying on the Automated Latest Content block, you avoid the risk of sending duplicate jobs and gain the flexibility to filter posts by category, post type, and more.
I hope this helps! Let me know if you have any further questions or need clarification.
Hi there,
I’ve looked into the issue, and the error message you’re seeing indicates that the
assert()
PHP function is unavailable. This could be due to your server’s PHP configuration or a possible issue with the PHP installation itself.Could you let us know which hosting provider you’re using? I recommend reaching out to your hosting provider and asking them to check the PHP configuration or reinstall PHP if needed. They should be able to assist you in resolving this issue.
Let us know how it goes!