Mautic Community Forums

Integrating Mautic with Wordpress

Hello,



I know there’s a Mautic Wordpress plugin, but I’d like to more deeply integrate Mautic and Wordpress. Specifically, I’ve put Mautic in a subdirectory of my multi-user Wordpress network site and I’ve fixed Wordpress so its rewrite rules ignore that subdirectory. So far, so good.



However, I’d like to include wp-blog-header.php so I can use the Wordpress is_user_logged_in() function and do pass-through authentication in Mautic, so my users don’t have to log into Mautic if they’re already logged in to Wordpress. I have also added require_once(’…/wp-blog-header.php’); in the beginning of Mautic’s index.php file, nothing is crashing, and I can still manually log into Mautic. Where would be the best place to hook into the Mautic login process to override its default login check with Wordpress’s is_user_logged_in()? Also, since it’s a WP network, I’d like to override mautic’s local.php configuration file and point it to different database tables depending on which network subdomain URL is currently being used (so each user’s site in my network has their own Mautic tables). If I can do the is_user_logged_in part, I think I can figure out the override of local.php just by replacing local.php with a symlink to a file outside of the Mautic directory (so mine won’t get stepped on too badly in the event of a Mautic upgrade). From there I can inspect the subdomain URL and point to the right database tables.



Any advice? I appreciate your time and expertise!



Best,

Dave

Anyone have any ideas about this? I’m a bit surprised there are no responses. It doesn’t instill confidence in the responsiveness of the Mautic support team. I appreciate anyone’s advice on this.

@davetbo

Have you looked into OAuth for both systems?

I have a similar need, but I’m not working on this just yet. When I do, I’ll follow up here.

Already integration at a higher level to WordPress we have done . Just plug testing . Give us a moment , glad for him then share

[quote=9776:@Svet Zitrka]Already integration at a higher level to WordPress we have done . Just plug testing . Give us a moment , glad for him then share

[/quote]

Great :smiley:

Hello,

I know there’s a Mautic Wordpress plugin, but I’d like to more deeply integrate Mautic and Wordpress. Specifically, I’ve put Mautic in a subdirectory of my multi-user Wordpress network site and I’ve fixed Wordpress so its rewrite rules ignore that subdirectory. So far, so good.

However, I’d like to include wp-blog-header.php so I can use the Wordpress is_user_logged_in() function and do pass-through authentication in Mautic, so my users don’t have to log into Mautic if they’re already logged in to Wordpress. I have also added require_once(’…/wp-blog-header.php’); in the beginning of Mautic’s index.php file, nothing is crashing, and I can still manually log into Mautic. Where would be the best place to hook into the Mautic login process to override its default login check with Wordpress’s is_user_logged_in()? Also, since it’s a WP network, I’d like to override mautic’s local.php configuration file and point it to different database tables depending on which network subdomain URL is currently being used (so each user’s site in my network has their own Mautic tables). If I can do the is_user_logged_in part, I think I can figure out the override of local.php just by replacing local.php with a symlink to a file outside of the Mautic directory (so mine won’t get stepped on too badly in the event of a Mautic upgrade). From there I can inspect the subdomain URL and point to the right database tables.

Any advice? I appreciate your time and expertise!

Best,
Dave