wordpress - 需要一些帮助将 wordpress 注册表连接到 infusionsoft
问题描述
我对这一切都很陌生,我尝试过搜索自己,但没有找到我需要的东西。我需要将默认的 WordPress 注册表单连接到 infusionsoft。因此,每次有新成员注册时,我都会在 infusionsoft 的联系人列表中找到他们的电子邮件地址。希望我解释正确。随意编辑我的问题。
解决方案
您需要设置很多东西,所以我将略读在解决方案之前您需要做的事情。我添加了一些链接,您可以随时参考。
您首先需要的是 Infusionsoft 的 PHP SDK。如果您不确定如何设置,请参阅: https ://blog.terresquall.com/2021/03/using-keaps-aka-infusionsoft-php-sdk-2021/
在您的 Wordpress 管理仪表板中创建身份验证位作为菜单页面。
确定身份验证后,您可以将生成的访问令牌保存到您的 Infusionsoft API 作为 WordPress 中的一个选项。使用register_setting()和get_option()为插件/主题中的 API 调用保存访问令牌。
之后,您需要使用将在用户注册后调用的 user_register 挂钩进行 API 调用,最终将注册详细信息发送到 infusionsoft:
add_action( 'user_register', 'user_to_infusionsoft', 10, 1 );
function user_to_infusionsoft($user_id){
//Include your infusionsoft PHP SDK path if you haven't already
$infusionsoft = $infusionsoft = new \Infusionsoft\Infusionsoft(array(
'clientId' => 'Your API key goes here',
'clientSecret' => 'Your API secret goes here',
'redirectUri' => 'http://yourwebsite.com/authentication.php',
));
//Retrieve the access token that you generated and saved from the options
$token = get_option('infusionsoft_token');
$infusionsoft->setToken(unserialize($token));
$user_info = get_userdata($user_id);
//Set up the email in the format to be used by the API
$user_email = new \stdClass;
$user_email->field = 'EMAIL1';
$user_email->email = $user_info->user_email;
$contact = ['given_name' => $user_info->first_name, 'family_name' => $user_info->last_name, 'email_addresses' => [$user_email]];
$infusionsoft->contacts()->create($contact);
}
推荐阅读
- javascript - I want to add rows in all table with the name
- java - Azure webapp HTTP 状态 404 - 未找到
- python - 如何在 Python 中以最快的方式计算矩阵指数?
- php - 如何返回php数组中重复次数最多的值
- fiddler - 如何在 loadrunner 中导入提琴手保存会话(.saz)文件时创建 loadrunner 事务
- mysql - 在 Magnolia:用 MySQL 替换 H2:JackRabbit 无法实例化持久性管理器
- android - 如何更改 xml 文件中的可伸缩性
- pandas - 如何从数据框中的每一列中删除空值并根据键在 1 行中附加非空列值
- python - ValueError:预期 1D 或 2D 数组,得到 0D 数组
- node.js - 如何修复嵌套订阅以按顺序工作?