BuddyDev

Search

[Resolved] Restrict Email Domains – QuadMenu Compatability?

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22654

    Hello,

    I am using a 3rd party navbar menu called “QuadMenu” (https://quadmenu.com/) that integrates the login and register forms into the menu. Is it possible to have the “Restrict Email Domains” plugin work with this menu?

    I configured the “Restrict Email Domains” plugin to only allow gmail.com, yahoo.com and hotmail.com but when using the QuadMenu registration form it just bypasses those limits and registers any email address.

    Just wondering if there is a way to get this to work?

    Sincerely,
    Mic

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22657

    Hi Mic,
    We don’t know about the compatibility and based on your topic we assume it is not compatible.

    It seems they have their own custom handler for registration. If you can ask them how can we hook into their validation process for registration, I can add the support for it.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22662

    Hey Brajesh,

    Thanks for the awesome support again! I have a support ticket in with the other developer asking them for a way to hook into their registration process. I will update this thread when I hear back from them.

    -Mic

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22663

    Thank you Mic.
    I am looking forward to your reply.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22672

    Hey Brajesh,

    Their reply was:

    “Ask your developer what kind of hook he needs and we can consider to include it. The registration function is inside this file https://pastebin.com/7QKRMRxg (link added by me) and looks like this…”

    
    function register_user($output) {
    
          if (!check_ajax_referer('quadmenu', 'nonce', false)) {
            QuadMenu::send_json_error(esc_html__('Please reload page.', 'quadmenu'));
          }
    
          $username = sanitize_user($_POST['user']);
          $email = sanitize_email($_POST['mail']);
          $password = $_POST['pass'];
    
          if (empty($username)) {
            QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide an username.', 'quadmenu')));
          }
    
          if (empty($email) || !is_email($email)) {
            QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide a valid email address.', 'quadmenu')));
          }
    
          if (empty($password)) {
            QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', esc_html__('Please provide a password.', 'quadmenu')));
          }
    
          $userdata = array(
              'user_login' => $username,
              'user_pass' => $password,
              'user_email' => $email,
          );
    
          $user_id = wp_insert_user($userdata);
    
          if (!is_wp_error($user_id)) {
    
            $user = get_user_by('id', $user_id);
    
            if ($user) {
              wp_set_current_user($user_id, $user->user_login);
              wp_set_auth_cookie($user_id);
              do_action('wp_login', $user->user_login);
            }
    
            QuadMenu::send_json_success(sprintf('<div class="quadmenu-alert alert-success">%s</div>', esc_html__('Welcome! Your user have been created.', 'quadmenu')));
          } else {
            QuadMenu::send_json_error(sprintf('<div class="quadmenu-alert alert-danger">%s</div>', $user_id->get_error_message()));
          }
    
          wp_die();
        }
    

    This request seems to be getting quite specific. I don’t know how many other people are using QuadMenu, so it might not be worth investing in. If you happen to know what kind of hook you would need I will pass it along to that developer.

    Thanks for your willingness to take a look!

    -Mic

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22673

    Hi Mic,
    Please ask them to put a like before this

    
    $user_id = wp_insert_user($userdata);
    

    Something like

    
    do_action( 'quadmenu_registration_validated', $userdata );
    
    

    ill allow us to generate custom error before allowing registration.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22674

    Thanks Brajesh,

    I have forwarded your message on to them. I have asked for a response, but I don’t know if they will respond or not. I will update this thread if they do.

    -Mic

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22679

    Hi Mic,
    Thank you.
    I am looking forward to their reply. Let us hope for the bets.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Mic on #22893

    Hey,

    They responded with:

    Sorry, but we cannot add the hook yet, dev team is evaluating a different way to do it. integrated with WP functions

    I appreciate your help, but I am going to mark this as resolved.

    -Mic

    • This reply was modified 5 years, 7 months ago by Mic.
    • This reply was modified 5 years, 7 months ago by Mic.
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #22898

    Hi Mic,
    Thank you.

    I hope they use the correct wp functions in future. If they do, the plugin will be automatically compatible.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved