我使用插件 mailjet-for-wordpress。
我想要的是
希望用户像这样在前端输入他们的 nom、prenom 和电子邮件:http: //gyazo.com/b58675c671584f8edc6ab6d703370ba9
我的问题
对于我只是添加的字段,例如 nom,prenom 它不会在我的管理页面中显示,与用户订阅时的电子邮件字段相同:http: //gyazo.com/9b72fdc03d22732cf21ddac9f70b2c33
我试过的
我曾尝试在 mailjet 中创建联系人属性字段,例如 nom、prenom。而且我还尝试修改小部件“订阅我们的时事通讯”,我在时事通讯表单中添加了更多字段。我已修改代码如下:
文件 mailjet-widget.php
// WIDGET CODE GOES HERE
echo '
<form class="subscribe-form">
//add field nom
<input type="text" name="nom" placeholder="' . __('Nom', 'wp-mailjet') . '" class="username">
//add field prenom
<input type="text" name="prenom" placeholder="' . __('Prenom', 'wp-mailjet') . '" class="username">
//email it is original field in default newsletter mailjet form
<input id="email" name="email" value="" type="email" placeholder="' . __('your@email.com', 'wp-mailjet') . '" />
<input name="action" type="hidden" value="mailjet_subscribe_ajax_hook" />
<input name="list_id" type="hidden" value="' . $list_id . '" />
<input name="submit" type="submit" class="mailjet-subscribe" value="' . __($button_text) . '">
</form>
<div class="response">
</div>';
并且也在这个函数中 mailjet_subscribe_from_widget()
public function mailjet_subscribe_from_widget()
{
// Get some variables - email, list_id, etc.
$email = $_POST['email'];
$list_id = $_POST['list_id'];
//field add
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
// Add the contact to the contact list
$result = $this->api->addContact(array(
'Email' => $email,
'Nom' => $nom,
'Prenom' => $prenom,
'ListID' => $list_id
));
// Check what is the response and display proper message
if(isset($result->Status)) {
if($result->Status == 'DUPLICATE'){
echo '<p class="error">';
echo sprintf(__("The contact %s is already subscribed", 'wp-mailjet'), $email);
echo '</p>';
die();
}
else if($result->Status == 'ERROR'){
echo '<p class="error">';
echo sprintf(__("Sorry %s we couldn't subscribe at this time", 'wp-mailjet'), $email);
echo '</p>';
die();
}
}
// Adding was successful
echo '<p class="success">';
echo sprintf(__("Thanks for subscribing with %s", 'wp-mailjet'), $email);
echo '</p>';
die();
}
我已经尝试像这样搜索和测试几天但仍然无法得到结果。我是插件 mailjet-for-wordpress 插件的新手,有谁知道请帮我找到解决方案,
先谢谢了,