Done
Forum Replies Created
-
it was founded that with 3rd code custom field data transfer works, when subscription via form [newsletter-form] but doesnt on register.
should we count on support? we are ukrainians, need this software for cultural and refugees projects.
please advise with settings
This, POST method code, which sends data WITH email together
add_action('register_post', 'send_interests_to_newsletter', 10, 3);
function send_interests_to_newsletter($sanitized_user_login, $user_email, $errors) {
if (!empty($_POST['acf']['field_66eb8796332ca'])) {
$interests = $_POST['acf']['field_66eb8796332ca'];
$interests_string = is_array($interests) ? implode(',', array_map('trim', $interests)) : trim($interests);
$api_url = 'https://donesgrunge.com/wp-json/newsletter/v2/subscribers?client_key=&client_secret=';
$data = array(
'email' => $user_email,
'extra_fields' => array(
array(
'id' => 1,
'value' => $interests_string,
),
),
);
$response = wp_remote_post($api_url, array(
'method' => 'POST',
'body' => json_encode($data),
'headers' => array(
'Content-Type' => 'application/json',
),
));
if (is_wp_error($response)) {
error_log('API Error: ' . $response->get_error_message());
} else {
error_log('API Response: ' . wp_remote_retrieve_body($response));
}
}
}sends, as it visible by api responce
[26-Sep-2024 04:25:32 UTC] API Response: {"id":124,"email":"d*****@yahoo.com","first_name":"","last_name":"","gender":null,"country":"","region":"","city":"","lists":[],"extra_fields":[{"id":1,"value":"rock"}],"status":"not_confirmed","token":"*********"}but interests value doesnt saves in newsletter’s custom field. its shows first interest in list
- This reply was modified 1 year, 8 months ago by Done.
this code, which sends data without email, works, but creates one more subscriber without email. 2 subscribers created on register at once.
add_action('register_post', 'send_interests_to_newsletter', 10, 3);
function send_interests_to_newsletter($sanitized_user_login, $user_email, $errors) {
if (!empty($_POST['acf']['field_66eb8796332ca'])) {
$interests = $_POST['acf']['field_66eb8796332ca'];
$interests_string = is_array($interests) ? implode(',', array_map('trim', $interests)) : trim($interests);
$api_url = 'https://donesgrunge.com/wp-json/newsletter/v2/subscribers?client_key=&client_secret=';
$data = array(
'extra_fields' => array(
array(
'id' => 1,
'value' => $interests_string,
),
),
);
$response = wp_remote_post($api_url, array(
'method' => 'POST',
'body' => json_encode($data),
'headers' => array(
'Content-Type' => 'application/json',
),
));
if (is_wp_error($response)) {
error_log('API Error: ' . $response->get_error_message());
} else {
error_log('API Response: ' . wp_remote_retrieve_body($response));
}
}
}This, updating subscriber data code
add_action('register_post', 'update_interests_in_newsletter', 10, 3);
function update_interests_in_newsletter($sanitized_user_login, $user_email, $errors) {
if (!empty($_POST['acf']['field_66eb8796332ca'])) {
$interests = $_POST['acf']['field_66eb8796332ca'];
$interests_string = is_array($interests) ? implode(',', array_map('trim', $interests)) : trim($interests);
$api_url = 'https://donesgrunge.com/wp-json/newsletter/v2/subscribers/' . $user_email . '?client_key=&client_secret=';
$data = array(
'extra_fields' => array(
array(
'id' => 1, // ID поля в Newsletter
'value' => $interests_string,
),
),
);
$response = wp_remote_request($api_url, array(
'method' => 'PUT',
'body' => json_encode($data),
'headers' => array(
'Content-Type' => 'application/json',
),
));
if (is_wp_error($response)) {
error_log('API Error: ' . $response->get_error_message());
} else {
error_log('API Response: ' . wp_remote_retrieve_body($response));
}
}
}which sends data with email, sends data, as it visible by api responce
[26-Sep-2024 04:07:23 UTC] API Response: {"id":123,"email":"di****@yahoo.com","first_name":"","last_name":"","gender":null,"country":"","region":"","city":"","lists":[],"extra_fields":[{"id":1,"value":"rock"}],"status":"not_confirmed","token":"*********"}but interests doesnt save in custom newsletter’s field. its shows always first interest in list. i can provide keys for test, if necessary.
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clickmessage, saying that click will remove, obviously not needed – its intuitively understandable and everywhere work like this. Message, links to wishlist, is usefull. Its appears like script, that removes product, works for container, which contains message and button. Its possible to disable that script for message or just move message to other container and this is only
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clicki want to keep remove functionality by clicking on button and disable by clicking on text
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clicki made product remove text as notification product added with link, like
added to <a href="https://donesgrunge.com/wishsuite/">Wishlist</a>i need fuction, that disables removing product from wishlist by click on product remove text – by default product removes by clicking either button or remove text (remove on 2nd click)
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clickrefer where is message code, maybe ill manage its disappearing with ai
- This reply was modified 2 years ago by Done.
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clickalso good to do that added removed message near button dissapears after some seconds
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clickhttps://donesgrunge.com/shop/live/online/covers/bi-2/
i positioned with sortcode with negative margin to be over picture.2nd question is more important
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second click- Button doesnt appears only before add to cart and not on all other places. its seems like it doesnt work with product list pages and single product pages, constructed as templates from separate elementor widgets – product lists is Loop grid widget, single product page made from Add to cart, Product picture, Description, etc widgets.
- When remove on second click enabled, message near button “Product added” doesnt appears.
Forum: Plugins
In reply to: [TI WooCommerce Wishlist] Show message in block on the page instead popupand or functions, that generates added / removed messages
Forum: Plugins
In reply to: [TI WooCommerce Wishlist] Show message in block on the page instead popupor i just need function, that triggers popup, so i can make it switch from display: none to display: flex 2 blocks with messages added / removed and auto switch back to display: none
Forum: Plugins
In reply to: [WishSuite - Wishlist for WooCommerce] Remove from wishlist on second clicki belive such customization isnt big deal and i can pay some for it. if youre intrerested – say how can contact you about this.
Forum: Plugins
In reply to: [TI WooCommerce Wishlist] Show message in block on the page instead popupi belive such customization isnt big deal and i can pay some for it. if youre intrerested – say how can contact you about this.