You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I have noticed a minor issue in the wpMandrill plugin, which I believe is a bug. In the plugin, while sending emails and setting metadata, the parameter definition for metadata is named 'meta_data' instead of the correct 'metadata'. This inconsistency causes problems when trying to retrieve the metadata through the Mandrill API.
Steps to Reproduce:
Use the wpMandrill plugin to send an email.
Include metadata by passing an array to the 'meta_data' parameter in the 'wpMandrill::mail()' function.
Attempt to retrieve this metadata using the Mandrill API for the sent email.
Expected Behavior:
The plugin should use 'metadata' as the parameter name for setting metadata, which aligns with Mandrill's naming convention.
Actual Behavior:
The plugin uses 'meta_data' as the parameter name, which results in difficulties when trying to access the metadata through the Mandrill API. The API expects 'metadata' as the parameter name.
Additional Information:
This inconsistency may cause confusion and issues for users who want to work with the Mandrill API to retrieve email metadata.
It is a small but significant bug as it affects the plugin's functionality and compatibility with Mandrill.
To correct this, it is recommended to update the 'meta_data' parameter to 'metadata' in the plugin's codebase.
Please consider making this change in the wpMandrill plugin to ensure better compatibility with Mandrill and enhance user experience. Thank you for your attention to this matter.
Hi @timi-ro, I'm finally getting around to looking into issues on the plugin for an update. Are you adding the meta data programmatically? Any additional context would be great; thank you!
Thanks for following up on the plugin issues. To clarify, I didn't modify the plugin code directly in our software. Instead, I addressed the issue by using a WordPress hook to work around a bug in the wpMandrill::send() function.
The problem arises because the plugin currently uses a variable named meta_data (with an underscore), but the Mandrill API expects this variable to be metadata (without the underscore). To fix this, I created a hook that ensures the metadata is attached properly when sending emails. Here's the code I implemented:
/*
* This hook is required due to a bug in wpMandrill::send() function. The current metadata variable is 'meta_data' (with
* underscore), which does not match the 'metadata' variable expected by the Mandrill API.
* This hook is to attach the metadata properly on send().
* If the wpMandrill plugin gets updated and the bug is fixed, this hook can be removed.
*/
function pass_custom_email_data($data)
{
$data['metadata'] = [
'site_id' => get_current_blog_id(),
];
return $data;
}
This approach ensures that the correct metadata is passed to the Mandrill API without needing to modify the plugin itself. If the plugin is updated and the bug is fixed, this hook can easily be removed.
Description:
I have noticed a minor issue in the wpMandrill plugin, which I believe is a bug. In the plugin, while sending emails and setting metadata, the parameter definition for metadata is named 'meta_data' instead of the correct 'metadata'. This inconsistency causes problems when trying to retrieve the metadata through the Mandrill API.
Steps to Reproduce:
Use the wpMandrill plugin to send an email.
Include metadata by passing an array to the 'meta_data' parameter in the 'wpMandrill::mail()' function.
Attempt to retrieve this metadata using the Mandrill API for the sent email.
Expected Behavior:
The plugin should use 'metadata' as the parameter name for setting metadata, which aligns with Mandrill's naming convention.
Actual Behavior:
The plugin uses 'meta_data' as the parameter name, which results in difficulties when trying to access the metadata through the Mandrill API. The API expects 'metadata' as the parameter name.
Additional Information:
This inconsistency may cause confusion and issues for users who want to work with the Mandrill API to retrieve email metadata.
It is a small but significant bug as it affects the plugin's functionality and compatibility with Mandrill.
To correct this, it is recommended to update the 'meta_data' parameter to 'metadata' in the plugin's codebase.
Please consider making this change in the wpMandrill plugin to ensure better compatibility with Mandrill and enhance user experience. Thank you for your attention to this matter.
Fixed in this fork
The text was updated successfully, but these errors were encountered: