最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

functions - Execute a ultimate member action when user role is updated

programmeradmin1浏览0评论

I want an Ultimate Member action to be performed when I assign a particular role to a user. A role "old_member" exists. If I assign this role to a user, the account should deactivate itself with the Ultimate Member action "deactivate()". Unfortunately, it does not work with this code:

    add_action( 'set_user_role', 'user_role_update', 10, 2);
    function user_role_update( $user_id, $new_role ) {
    if ($new_role == 'old_member') {
        global $ultimatemember;
        um_fetch_user( $user_id );
        $ultimatemember->user->deactivate();
    }
}

Here you can see the code of ultimate member: .php#L97

Can someone tell me what the mistake is?

发布评论

评论列表(0)

  1. 暂无评论