I have a template that takes input from a form and and does several operations. These operations call plugin functions and I'd like one of them to call a different function if one of the input parameters is set.
This is the template code:
{if segment_2 == 'submit'}
<?
$embed_params = 'email="' . $_POST['email'] . '"';
$embed_params .= 'PID="' . $_POST['PID'] . '"';
$embed_params .= 'DOB="' . $_POST['DOB'] . '" Site="" site="'.$_POST['site'].'"';
?>
{embed='/forgot_password_form' message='{exp:forgot_password:send_email code="{segment_3}" <?=$embed_params?>}' <?=$embed_params?>}
{if:elseif segment_2 == 'reset'}
{embed='/forgot_password_reset' email='{exp:forgot_password:check_code code="{segment_3}"}' code="{segment_3}" <?=$embed_params?> site="<?=$_POST['site']?>"}
{if:elseif segment_2 == 'reset_submit'}
{embed='/forgot_password_reset' message='{exp:forgot_password:update_password code="<?=$_POST['code']?>" password="<?=$_POST['password']?>" site="<?=$_POST['site']?>" }' }
{if:else}
{embed='/forgot_password_form' }
{/if}
They get an email with a reset code when the send_mail
plugin function s called and then when they click the reset link, it calls forgot_password/reset
to load a reset form and when they submit the reset form, it calls the forgot_password/reset_submit to update their password.
Now, if the $_POST["email']
is set, I want to call exp:forgot_password:send_email
, if it is not set, I want to call exp:forgot_password:show_pass
.
I'm going to return their actual username and password to show vs. having them reset it.
How would I call show_pass
instead of send_email
if the email address is not set here? Or should I just use the plugin code to determine?