Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hi!

I'm using the extended_users module (which is great!), and for security account activation is moderated. Is there a way to have <cms:process_activation /> trigger an email to be sent to the newly activated account so they know they've been approved?

Thanks,
Sam
Hi Sam,

and for security account activation is moderated
Does that mean the admin manually activates the account (as opposed to the user doing it himself following the activation email)?
KK wrote: Hi Sam,

and for security account activation is moderated
Does that mean the admin manually activates the account (as opposed to the user doing it himself following the activation email)?


The activation email is sent to the administrator(s) rather than the user and is activated via the click.
That should be straightforward - add a cms:send_mail statement right after the k_success condition of cms:cms:process_activation (but before the cms:redirect) e.g.
<h1>Activate account</h1>

<cms:process_activation />

<cms:if k_success >

<cms:send_mail..

<cms:set_flash name='success_msg' value='2' />
<cms:redirect k_page_link />
...

Hope this helps.
I figured that's what it would be, but what variable would be used for the user's email? That's where I'm having the problem; I'm not seeing in the documentation for the extended_users module how that works with the process_activation - the user isn't logged in, so

Code: Select all
<cms:pages masterpage=k_user_template page=k_user_id>


can't access their information. Clearly, the email has been passed so the account can be verified, but what that variable is (frm_k_extendeduser_email maybe?) isn't clear.

Thanks,
Sam
Ok, I see the problem.

The module does not make available the just activated user's info as variables but we can glean that from the activation key contained in the link used for activation.

Please try out the following (haven't tested it but should work, I think). Use the code in the k_success block -
Code: Select all
<cms:if k_success >

<cms:php>     
    global $CTX;
    list( $user_id, $key, $expiry, $hash ) = explode( '|', $_GET['key'] );
    $CTX->set( 'my_user_id', $user_id, 'global' );
</cms:php>

<cms:pages masterpage=k_user_template id=my_user_id show_future_entries='1' limit='1'>
    ... user info available here for using in email ..
</cms:pages>

...

Make sure not to skip the show_future_entries='1' parameter.

Does this help?
That worked perfectly! Thanks, KK.
I am so glad it did :)
Thanks for letting me know.
8 posts Page 1 of 1