• Resolved zel

    (@zel)


    Hello!
    I’ve downloaded your plugin – it’s very nice πŸ™‚ I’ve almost achieved what I wanted with your plugin. But one problem… πŸ™

    Here’s the deal. I have following code:

    <input type="submit" name="submit" value="company">
    <input type="submit" name="submit" value="multi_company">
        <?php
    }
    add_action('zm_ajax_login_register_below_email_field', 'account_type_registration_field');
    
    function setCompanyRole($company_id) {
    if($_POST['submit'] == 'company') {$user_type='company';}
    if($_POST['submit'] == 'multi_company') {$user_type='multi_company';}
    
      if(!current_user_can('manage_options')) {
        $company = get_user_by('id', $company_id);
        $ce = CompanyEmployee::getInstance();
        if($user_type=='company') {
          $ce->markUserAsCompany($company);
        }
        elseif($user_type=='multi_company')  {
          $ce->markUserAsMultiCompany($company);
        }
      }
    }
    
    add_action("user_register", "setCompanyRole");

    Which, when I call it as (add_action(register_form)) in my wp-login works just fine – It marks user as proper company.
    When I try to do that inside your register form, it doesn’t work. Why?
    I’ve added to the <form> attribute method=”post”
    could you please help?
    ah, account_type_registration_field is a function which starts earlier.
    https://wordpress.org/plugins/zm-ajax-login-register/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Zane Matthew

    (@zanematthew)

    Hi Zel,

    Glad your customizing the plugin πŸ˜€

    I would strongly recommend using the hook zm_ajax_login_after_successfull_registration . You can use it like the following:

    function setCompanyRole( $user_id ){
    // your custom logic here
    }
    add_action(‘zm_ajax_login_after_successfull_registration’, ‘setCompanyRole’);

    Regarding your snippet, that might not work due to having two submit buttons, you should change one of them to a button.

    I think the above hook is what your looking for, let me know if that works.

    Thread Starter zel

    (@zel)

    Well, I’ve come with easier solution – just hid the dropdown, and add some java to handle that. Now everything works fine πŸ˜€ But the hook will come in handy for sure!

    Zane please tell me, are you thinking about implementing ‘lost password’? πŸ™‚

    Plugin Author Zane Matthew

    (@zanematthew)

    Hi Zel,

    Glad you got it working! πŸ˜€ Feel free to follow me on twitter @zanematthew as I do plan on releasing a developer documentation detailing the hooks/filters available.

    Yes this is something I plan on implementing! Although it will probably be in the Pro version. Reason being the main compliment I receive regarding the free version is its dirt simple and little to no options/settings. Then again, I might roll it into the free one keeping it as basic/simple as possible, and then provide additional options in the Pro version. As the Pro version is being loaded with tons of options.

    Thread Starter zel

    (@zel)

    Hey Zane, I’m glad you are working on it.
    When you plan to add forgot password? When you do, I’m buying pro version πŸ™‚

    well, I have one more question:
    after adding:
    add_action(‘zm_ajax_login_after_successfull_registration’, ‘send_email’);
    My wordpress is sending confirmation email. Well problem is, I don’t know how to send typed in by user password. Do you think is there any safe way to pass password to my function, so it can send it with confirmation email?

    Plugin Author Zane Matthew

    (@zanematthew)

    Hi Zel,

    You can’t get the password in plain text and send it, as WordPress hashes the password. At most what you could do is reset the password using [wp_set_password](http://codex.wordpress.org/Function_Reference/wp_set_password) and from there send the password in the email, but I’m not 100% sure if this is the user flow your going for.

    P.S. I have version 1.1 for Pro coming out soon, but I wasn’t able to get “forgot password” in that release. The 1.1 release has; widget support, custom login logo, email verify, manual verify and a few other small things.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Form doesn't seem to read $_POST’ is closed to new replies.