I'm writing a customer portal plugin, utilizing Crafts user registration form: https://craftcms.com/docs/templating/user-registration-form
{# User registration form: #}
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="users/saveUser">
<input type="hidden" name="redirect" value="">
{# What do I add / change ? #}
{# ... #}
</form>
My plugin has two different types of account profile records, *.._OrganizationProfileRecord* and *.._UserProfileRecord*. What I want to do is send a variable to the onSaveUser event handler in my plugin main class, to tell it what type of user was just saved (*"org"* or *"user"*), and then take appropriate actions, i.e. create either an organization or user profile.
class myPortalPlugin extends BasePlugin
{
public function init()
{
craft()->on('users.onSaveUser', function(Event $event)
{
$craftUser = $event->params['user'];
$isNewUser = $event->params['isNewUser'];
if ($isNewUser)
{
// Check if user is an organization or a regular user, and
// create the appropriate profile record.
// How do I check?
// ...
}
}
// ...
}
### Questions:
1. How would I go about passing data/variable from the form to the onSaveUser event handler?
2. Is there a better / more convenient way to do this?
Many thanks in advance for any help you can provide in this matter! bowing
/Monkey