如何使用digits插件验证用户是否成功注册或登录wordpress?

问题描述 投票:0回答:1

我需要向digits插件添加一些js代码,然后将数据发送到google Analytics。使用数字插件时,有默认的登录和注册表单,我正在使用这些表单。当用户成功注册或登录网站时,我需要将数据发送到谷歌分析。问题是我不知道在哪个php文件中进行身份验证,如果我知道了,我可以在那里添加js代码。需要编辑哪个文件?

如果有人有使用此插件的经验,我们将不胜感激。我不知道这个插件的代码结构。

javascript php wordpress plugins
1个回答
0
投票

不建议直接修改第三方插件,因为更新时所做的任何更改都会被覆盖。插件为典型集成提供自己的方法、操作和过滤器。对于 Digits 插件,请参阅其文档以获取指导。

要添加自定义功能,请考虑创建自己的插件,利用 WordPress 操作和过滤器来挂钩插件的功能。

例如。通过动作调用的插件和函数

<?php

/*
Plugin Name: <Unic plugin name here>
Description: <Description here>
Version: 1.0
Author: <Your Name here>
*/

// Function to be called on 'init' action
function my_function_name_here() {
    // Your code here...
    if(is_user_logged_in()) {
        // ...to send to Google point
    }
}

// Hook your function, to the Wordpress built-in 'init' action
add_action('init', 'my_function_name_here');

现在就您的情况而言,寻找类似的操作。 “表格已提交”。

对于登录的用户,您有:

is_user_logged_in()
wp_get_current_user()

developer.wordpress.org...is_user_logged_in/

也检查一下: 数字 - 如何

© www.soinside.com 2019 - 2024. All rights reserved.