2

I have a registration process which is split into a number of steps, at step 1 the user creates a free account (which requires activation by email to be moved from pending to the relevant group_id), at step 2 the user can choose to become a paid member, the module I'm using then moves the member to the relevant paid member group upon completion of payment. This all works just fine and is quite a normal process to follow (I think, Github uses a similar mechanism).

The problem I have is that I want to validate email addresses for free accounts but if a user continues and becomes a paid member 'before' they have activated their account and then attempts to activate it subsequently, they currently get the "Invalid activation request" error because they are no longer a pending member.

To me it seems the simplest solution to this problem would be to allow member activation to fail silently or somehow hijack that process and bypass the error for members that are no longer pending.

I've searched far and wide for an existing add on that does this with no luck and it seems that the 'member_register_validate_members' hook (http://ellislab.com/expressionengine/user-guide/development/extension_hooks/module/member_register/index.html#member_register_validate_members) fires 'after' validation and not before so I can't see that it will help me.

Any bright ideas?

2

Ok well I solved this in the end by writing a bespoke extension to simply bypass the error message which is usually shown for an invalid activation request.

function activation_hijack ( $session_data )
{

    if (ee()->input->get('ACT')) {

        $act = ee()->input->get('ACT');

        if ($act==8 AND ee()->input->get('id')) {

            $id = ee()->input->get('id');
            // Is there even a Pending (group 4) account for this particular user?
            $query = ee()->db->select('member_id, group_id, email')
            ->where('group_id', 4)
            ->where('authcode', $id)
            ->get('members');

            if ($query->num_rows() == 0)
            {
                // Bypass activation and redirect, this user is no longer pending
                $path = ee()->functions->create_url('/', FALSE);
                header("Location: ". $path);
                exit;
            }
        }
    }

}

Does the job. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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