This example sends a welcome email to new users who were automatically approved, and a ‘please wait’ email for new users pending approval.
This hook function is called when a new member signs up. If you open the generated hooks/__global.php file in a text editor, you can see this function defined as follows:
function
member_activity(
$memberInfo
,
$activity
, &
$args
){
switch
(
$activity
){
case
'pending'
:
// send 'please wait' email to new user
@mail(
$memberInfo
[
'email'
],
// email recipient
"Thank you for signing up at our website!"
,
// subject
"Dear {$memberInfo['username']}, \n\n"
.
"We'll review and approve your new account within a few hours.\n\n"
.
"Thank you."
,
// message
"From: support@domain.com"
// the "From" address the user will see
);
break
;
case
'automatic'
:
// send 'welcome' email to new user
@mail(
$memberInfo
[
'email'
],
// email recipient
"Thank you for signing up at our website!"
,
// subject
"Dear {$memberInfo['username']}, \n\n"
.
"You can now log into our website from this page:\n"
.
"http://www.domain.com/appgini\n\n"
.
"Thank you."
,
// message
"From: support@domain.com"
// the "From" address the user will see
);
break
;
case
'profile'
:
break
;
case
'password'
:
break
;
}
}