Add Login box to my main website


New Member
Hi guys!
I am not sure if this is a small thing or I am putting my legs into a deep mudhole but I would like to add the login box on the main website (running on Wordpress) and do the credentials check from there. If the user has valid credentials, take them to the sub-domain client area where the app is installed else display an error message. Is that a possibility or I should just redirect them to the login page (Worst case scnario)
Ali R-
That's an option, it can be done, but really, if you're not familiar with PHP then that's going to give you a hard time.
PHP is not a problem. I am a developer but also have developers who are working for me actively and I can delegate the task to them as long as I can tell them what to do. Any idea or sample on how this can be achieved would be greatly appreciated.
In this case,

You can create a custom config file, in apps/customer/config/ and name it main-custom.php.
Put following contents into it:
<?php defined('MW_PATH') || exit('No direct script access allowed');

return array(
    'components' => array(
        'request' => array( 
            'noCsrfValidationRoutes'  => array('guest/*'),
The above means that your gues pages aren't protected by a CSRF token anymore, which means you can make post requests to this page from external websites, like your wordpress website.
So now you can:
1. Simplest way:
Create a form in wordpress with the action to the and whan somebody fills in the info there and click submit, it will target the actual login page in mailwizz.
2. Harder way:
Create a controller in mailwizz, where you post info from your website and when the form is submitted, via ajax to a file on your wordpress, you make a curl request to this controller and check if the user/pass are valid and then return a json response. If the response is not successful, then you show the errors, otherwise if the response is successful and the user exists, then you simply change the action of the original form into the mailwizz login url and submit the data to there, all this by using javascript.
The reason why you do this is to keep the user on your wordpress website till you are sure his credentials for mailwizz are fine, and once they are, you let it go to the actual mailwizz login form.

To illustrate this:
$('#login-form').on('submit', function(){
   var $this = $(this);
   if ($'skip-all')) {
         return true;
    $.post('/your/wordpress/url', formData, function(json){
         if (json.result == 'success') {
              $'skip-all', true).attr('action', '/your-mailwizz-login-url').submit();
         } else {
              // do something with the errors
    return false;

And the code that responds to the url: /your/wordpress/url should be something like:
// send the data to your new controller and validate it, return an array with info
$response = curl_to_your_new_mailwizz_controller_and_send_all_the($_POST);
$response = json_encode($response)

Of course, if your wordpress and mailwizz are on same domain, you can implement the login into your newly created controller in mailwizz and post via ajax from wordpress to mailwizz.
You can simply take the GuestController.php copy it into another file and make it's actions return json content that you can later read from ajax.

That's pretty much it :D
I have a similar request to this thread. Could you please confirm which file this code should go in?

$('#login-form').on('submit', function(){ var $this = $(this); if ($'skip-all')) { return true; } $.post('/your/wordpress/url', formData, function(json){ if (json.result == 'success') { $'skip-all', true).attr('action', '/your-mailwizz-login-url').submit(); } else { // do something with the errors } }); return false; });

also where should i place the custom guestcontroller file? should it be in the same directory as the original GuestController.php?