2
0

🐛 (wp) Fix wordpress user parsing

This commit is contained in:
Baptiste Arnaud
2023-03-28 09:48:43 +02:00
parent b788272c12
commit cbeb275164
4 changed files with 17 additions and 14 deletions

View File

@ -1,17 +1,17 @@
{ {
"name": "@typebot.io/wordpress", "name": "@typebot.io/wordpress",
"version": "3.1.6", "version": "3.1.7",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io", "repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno", "author": "baptisteArno",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@prettier/plugin-php": "0.19.4", "@prettier/plugin-php": "0.19.4",
"prettier": "2.8.4" "prettier": "2.8.7"
}, },
"scripts": { "scripts": {
"deploy": "pnpm copy && pnpm commit", "deploy": "pnpm copy && pnpm commit",
"copy": "svn copy ./trunk ./tags/3.1.6", "copy": "svn copy ./trunk ./tags/3.1.7",
"commit": "svn ci -m 'Fix default apiHost typo'" "commit": "svn ci -m 'Fix wordpress user prefill variables'"
} }
} }

View File

@ -5,7 +5,7 @@ Requires at least: 5.0
Tested up to: 6.0 Tested up to: 6.0
License: GPL 2.0 License: GPL 2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.txt License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Stable Tag: 3.1.6 Stable Tag: 3.1.7
== Description == == Description ==
Collect 4x more responses with conversational apps using Typebot. Collect 4x more responses with conversational apps using Typebot.
@ -24,6 +24,9 @@ This plugin relies on Typebot which is a tool that allows you to create conversa
3. Activate your Typebot with the "Typebot" admin button located in the sidebar 3. Activate your Typebot with the "Typebot" admin button located in the sidebar
== Changelog == == Changelog ==
= 3.1.7 =
* Fix forwarded user prefilled variables
= 3.1.6 = = 3.1.6 =
* Fix default apiHost typo * Fix default apiHost typo

View File

@ -10,19 +10,19 @@ class Typebot_Public
echo '<script> echo '<script>
if(typeof window.typebotWpUser === "undefined"){ if(typeof window.typebotWpUser === "undefined"){
window.typebotWpUser = { window.typebotWpUser = {
wp_id:"' . "WP ID":"' .
$wp_user->ID . $wp_user->ID .
'", '",
wp_username:"' . "WP Username":"' .
$wp_user->user_login . $wp_user->user_login .
'", '",
wp_email:"' . "WP Email":"' .
$wp_user->user_email . $wp_user->user_email .
'", '",
wp_first_name:"' . "WP First name":"' .
$wp_user->user_firstname . $wp_user->user_firstname .
'", '",
wp_last_name:"' . "WP Last name":"' .
$wp_user->user_lastname . $wp_user->user_lastname .
'", '",
} }
@ -65,7 +65,7 @@ class Typebot_Public
return windowPath !== excludePath; return windowPath !== excludePath;
})) { })) {
' . get_option('init_snippet') . ' ' . get_option('init_snippet') . '
Typebot.setPrefilledVariables({ typebotWpUser }); Typebot.setPrefilledVariables({ ...typebotWpUser });
}'; }';
} }
@ -101,7 +101,7 @@ class Typebot_Public
$bot_initializer = '<script type="module"> $bot_initializer = '<script type="module">
import Typebot from "' . $lib_url . '" import Typebot from "' . $lib_url . '"
Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { typebotWpUser } });</script>'; Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { ...typebotWpUser } });</script>';
return '<typebot-standard id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';"></typebot-standard>' . $bot_initializer; return '<typebot-standard id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';"></typebot-standard>' . $bot_initializer;
} }

View File

@ -3,7 +3,7 @@
/** /**
* Plugin Name: Typebot * Plugin Name: Typebot
* Description: Convert more with conversational forms * Description: Convert more with conversational forms
* Version: 3.1.6 * Version: 3.1.7
* Author: Typebot * Author: Typebot
* Author URI: http://typebot.io/ * Author URI: http://typebot.io/
* License: GPL-2.0+ * License: GPL-2.0+
@ -16,7 +16,7 @@ if (!defined('WPINC')) {
die(); die();
} }
define('TYPEBOT_VERSION', '3.1.6'); define('TYPEBOT_VERSION', '3.1.7');
function activate_typebot() function activate_typebot()
{ {