0

I'm trying to trigger some code in an extension when a new member clicks their activation link in the welcome email e.g domain/?ACT=171&id=oZYXwJfcAx

I can access the authcode using $id = $this->EE->input->get_post('id'); and I can detect that the current hook is activation using:

if ($this->EE->extensions->active_hook('member_register_validate_members') === TRUE){ ... }

but I can't query the exp_members table for the member_id using the auth_code as it has already expired at this point.

Here's the query I'm trying to run:

    $id  = $this->EE->input->get_post('id');

    $this->EE->db->select('exp_members.member_id');
    $this->EE->db->where('exp_members.authcode =', '"' . $this->EE->db->escape_str($id) . '"', FALSE);
    $this->EE->db->limit(1);

    $query = $this->EE->db->get('exp_members');

    if ($query->num_rows() > 0)
    {
         foreach($query->result() as $row)
         {
             $member_id = $row->member_id;
         }
    }

I'm going around in circles on this so any help would be greatly appreciated.

Using EE 2.9.2 with MSM and Solspace User 3.5.0 installed.

1 Answer 1

0

$member_id should be available in the member_register_validate_members hook.
See EE's documentation about the member_register_validate_members hook.

You should be able to query the exp_members table with the member_id from the hook at hand.

1
  • Yes I finally figured this out from the documentation. The bit that isn't that clear in any documentation is that when you trigger the member_register_validate_members hook and call its method the member_id parameter is then passed to the hook's method. Thanks @solspace for the reply.
    – neilkb
    Aug 14, 2015 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.