mautic / mautic-joomla

Joomla Plugin
16 stars 16 forks source link

Compatibility update to support Joomla 4 and Mautic 4 #37

Open LadySolveig opened 1 year ago

LadySolveig commented 1 year ago

What's changed

MauticForJ4_2_0_0-rc.zip

Fixes #35 #36

LadySolveig commented 1 year ago

@RCheesley thank you very much for your review. I commited your changes for the readme and fixed the broken search query from the flash install message.

The page you see when you first authenticate is created by Mautic and the "%" are not present in the current stable release. The descriptive name "Joomla" in your example is the name you give it on the Mautic API configuration page. In my case 'Test'. twig oauth mautic4 oauth mautic4-j4-3

I assume you tested with Mautic version 5. The authorization template has changed. Maybe the "%" comes from the view. I found the following lines in this context. twig oauth mautic5 twig oauth mautic5-2

I installed the zip that I provided in this pull request and tested the API-Connection on the current Joomla Version 4.3.1 and current stable Mautic version 4.4.8. I'm sorry, I can't reproduce your issue with the connection.

That's my result with the default redirect path 'administrator'

oauth mautic4-j4 oauth mautic4-j4-2


> #Date: 2023-05-17 18:12:26 UTC
> #Software: Joomla! 4.3.1 Stable [ Bora ] 2-May-2023 16:00 GMT
> 
> #Fields: datetime priority clientip   category    message
> 2023-05-17T18:12:26+00:00 INFO 91.57.190.240  plg_system_mautic   Authorize method called.
> 2023-05-17T18:13:34+00:00 INFO 91.57.190.240  plg_system_mautic   Authorize method called.
> 2023-05-17T18:13:34+00:00 INFO 91.57.190.240  plg_system_mautic   authorize::accessTokenData: Joomla\Registry\Registry::__set_state(array(
>    'data' => 
>   (object) array(
>      'token' => 
>     (object) array(
>        'access_token' => 'M2E3NTFlN2MzNDZmZWQ5MTY3MWU4NTdlNzliMWYzNDk4OWE5ZGZmOGFhNDhlYTM2NDM4ZTJjY2Q1MjljYWY3OQ',
>        'expires' => 1684350814,
>        'token_type' => 'bearer',
>        'refresh_token' => 'NDZkODM1N2Y1NGE3YzBkMjliMDBiY2M1M2U0NzZkNDllNTVkNDY3ZmU3MGVlMjlhNzMzNDEzYWU1NTA5NzZlYQ',
>        'created' => '2023-05-17 18:13:34',
>     ),
>   ),
>    'initialized' => true,
>    'separator' => '.',

Can you please give me a hint on which versions you tested ? Additionally, the Joomla log file named plg_system_mautic.php from folder administrator/logs would be very helpful.

RCheesley commented 1 year ago

Hi there,

I went back to test this again - still getting the %Joomla Integration% so might be something that we need to look into for the 5.x branch - would you mind raising it as a bug?

I am still getting the auth error:

{"errors":[{"message":"The redirect URI provided does not match registered URI(s).","code":400,"type":"redirect_uri_mismatch"}]}

I am testing with Mautic 5.x branch, and the git clone from the 4.3-dev branch of Joomla (before I was just using a regular 4.2.x Joomla install as I was testing on the dev area of my own website - this time I spun up a local instance for testing).

Here's the content of the log file:

#
#<?php die('Forbidden.'); ?>
#Date: 2023-08-16 14:48:04 UTC
#Software: Joomla! 4.3.4-rc2-dev Development [ Bora ] 15-August-2023 16:01 GMT

#Fields: datetime   priority clientip   category    message
2023-08-16T14:48:04+00:00   INFO 172.18.0.8 plg_system_mautic   Authorize method called.

In the Mautic side I have the redirect URI set to https://mautic.ddev.site/administrator and the Joomla side has the base URL set as https://mautic.ddev.site and the callback path as administrator.

Please let me know if I'm maybe setting something incorrectly!

LadySolveig commented 1 year ago

@RCheesley nice to hear from you. I paused the project at the moment. Thank you for your infos. I will look into this the next 2 or 3 weeks give you feedback. I will also test with the new Joomla 5 version so we can go forward with this side project.

mautibot commented 1 year ago

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/joomla-4-extension-update/23021/4

RCheesley commented 8 months ago

Hey @LadySolveig I finally got around to testing this again but this time on my live site, and I've managed to auth properly! 🥳

Works absolutely beautifully with the tracking!

Few things I found:

screenshot-m ruthcheesley co uk-2024 03 15-23_41_59

Form embed works great:

screenshot-ruthcheesley co uk-2024 03 15-23_46_18

Gated video also working as expected:

screenshot-ruthcheesley co uk-2024 03 15-23_48_37

I could not seem to get the DWC firing as I'd expect - it's just showing the default content despite matching on various fields (e.g. country for an anon visitor, or first name for a known visitor) but might be a separate issue.

Otherwise, awesome work!

RCheesley commented 8 months ago

(PS it works great with Mautic 5.0.3 and Joomla 4.4.3 - haven't yet tested with Joomla 5 though!)

RCheesley commented 5 months ago

@LadySolveig do you think you might be able to get to fixing these small issues so we can release this? I'd love to get an updated Joomla plugin out there so we can start promoting it more heavily!

LadySolveig commented 5 months ago

@RCheesley I have to set up a new Mautic instance first, I am currently not so up to date and then I would like to test the compatibility with Joomla! 5 directly, but it could take another 3-4 weeks. I might be able to do it faster, but I don't want to promise that. Could you be patient with me until then?

RCheesley commented 5 months ago

You can use Gitpod for that - https://gitpod.io/#https://github.com/mautic/mautic - or just do a git clone for the repo, and type ddev start if you use DDEV :)

For sure can be patient - I already tested with Mautic 5.0.3 and Joomla 4.4.3 but haven't tried Joomla 5 just yet (waiting on a few plugins to be updated first!)

LadySolveig commented 5 months ago

All your extensions that work in Joomla 4.4 should have no problems with Joomla 5.1 😉. You can also enable the compatibility Plugin If You have problems.