ExpressionEngine / ExpressionEngine

ExpressionEngine is a flexible, feature-rich, free open-source content management platform that empowers hundreds of thousands of individuals and organizations around the world to easily manage their web site.

Home Page:https://expressionengine.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

member_process_reset_password and cp_member_reset_password hooks pass different information when firing ... why?

jcogs-design opened this issue · comments

There are two EE hooks that relate to users changing their password:
cp_member_reset_password in ee/legacy/controllers/cp/login.php and
member_process_reset_password in ee/ExpressionEngine/Addons/member/mod.member_auth.php

The first passes no information to the hook when it fires


        /* -------------------------------------------
        /* 'cp_member_reset_password' hook.
        /*  - Additional processing after user resets password
        /*  - Added EE 2.9.3
        */
        $this->extensions->call('cp_member_reset_password');
        if ($this->extensions->end_script === true) {
            return;
        }
        /*
        /* -------------------------------------------*/

The second passes the member_id of the user whose password has changed.


        /* -------------------------------------------
        /* 'member_process_reset_password' hook.
        /*  - Additional processing after user resets password
        /*  - Added EE 2.9.3
        /*  - Member ID parameter added 4.0.0
        */
        if (ee()->extensions->active_hook('member_process_reset_password') === true) {
            $data = ee()->extensions->call('member_process_reset_password', $data, $member_id_query->row('member_id'));
            if (ee()->extensions->end_script === true) {
                return;
            }
        }
        /*
        /* -------------------------------------------*/

It would seem that anything that wants to do something after the user changes their password would need to respond to both these hooks ... but the absence of $member_id from the first hook makes this more complex - as the affected $member_id needs to be deduced some other way.

Am I missing something about why one hook includes $member_id and the other doesn't?

EE 7.4.9
php 8.3