document.addEventListener("DOMContentLoaded", function() {
const menuItemIcon = document.querySelector("#toplevel_page_rubik-chat .wp-menu-image");
if (menuItemIcon) {
menuItemIcon.innerHTML = ` `;
}
});
';
}
function rubik_chat_settings() {
if ( isset( $_POST['rubik_chat_nonce'] ) ) {
$nonce = sanitize_text_field( wp_unslash( $_POST['rubik_chat_nonce'] ) );
if ( wp_verify_nonce( $nonce, 'rubik_chat_settings_save' ) ) {
if ( isset( $_POST['rubik_chat_id'] ) ) {
$inputValue = sanitize_text_field( wp_unslash( $_POST['rubik_chat_id'] ) );
update_option( 'rubik_chat_id', $inputValue );
echo '
';
}
} else {
echo 'Security check failed. Please try again.
';
}
}
$rubikChatId = get_option( 'rubik_chat_id', '' );
?>
Locate your Chatbot ID in the RubikChat dashboard under the
Settings tab.
The chatbot only answers on its allowed websites: in RubikChat, open the agent, go to Share & Embed and add
under Allowed websites.
esc_attr( $rubik_chat_id ),
'domain' => 'widget.rubikchat.com',
]
);
}
/**
* Sites that updated to 2.0.0/2.0.1 (the RubikChat AI Agent plugin, briefly released under this
* name) keep their agent: its ID moves back to this plugin's setting.
*/
function rubik_chat_restore_chatbot_id() {
if ( get_option( 'rubik_chat_id', '' ) !== '' ) {
return;
}
$agent_id = get_option( 'rubik_bot_id', '' );
if ( is_string( $agent_id ) && $agent_id !== '' ) {
update_option( 'rubik_chat_id', sanitize_text_field( $agent_id ) );
}
}
add_action( 'plugins_loaded', 'rubik_chat_restore_chatbot_id' );