user_email; // Save email contact for auth. update_option( RWPAI_WEB_EMAIL, $user_email ); // Globalize the script variables. wp_localize_script( $handle, RWPAI_JS_GLOBAL_VAR, array( 'nonce_admin' => rwpai_nonce_create( RWPAI_NONCE_NAME_ADMIN ), 'nonce_public' => rwpai_nonce_create( RWPAI_NONCE_NAME_PUBLIC ), 'site_url' => get_site_url(), 'site_lang' => get_locale(), 'credential' => rwpai_get_credential(), 'assets_url' => plugins_url( 'public', RWPAI_PLUGIN_MAIN_FILE ), 'email' => $user_email, 'name' => $current_user->display_name ?? $current_user->user_login, ) ); } add_action( 'admin_enqueue_scripts', 'rwpai_enqueue_admin_scripts' ); /** * Adds the Reinvent WP AI Agent settings page to the admin menu. */ function rwpai_add_admin_menu() { add_menu_page( esc_html__( 'Reinvent WP AI Agent Settings', 'ai-agent' ), esc_html__( 'Reinvent WP AI Agent', 'ai-agent' ), 'manage_options', RWPAI_MENU_SLUG, 'rwpai_render_admin_page', 'dashicons-star-filled', 30 ); } add_action( 'admin_menu', 'rwpai_add_admin_menu' ); /** * Renders the admin page for the plugin. */ function rwpai_render_admin_page() { echo '
'; }