Skip to content

Conversation

brianteeman
Copy link
Contributor

@brianteeman brianteeman commented Aug 27, 2025

Pull Request for Issue #39190

Summary of Changes

The User Action Logs has an option to log the ip address. It is disabled by default.

When the logging of IP addresses is enabled it is shown in the User Action Logs component but there is no option available to include the ip address in any action log emails.

This PR adds the option to include the ip address in those emails. It does not include the ip address unless both

  1. Ip address logging has been enabled in the component options
  2. the ip address message tag is added to the mail template

Testing Instructions

Apply the sql updates
In the User Action Logs options enable the logging of email addresses
Make sure you have a user setup who will receive action log emails
Open the action log mail template and with this PR there is a new tag available (ip address) that you can include in the emails.
Include the tag and check the received email

Actual result BEFORE applying this Pull Request

The default action log mail template does not offer the ability to include the ip address

Expected result AFTER applying this Pull Request

The default action log mail template still does not send the ip address but you now have the capability to include the ipaddress

image

@richard67 could you help me with the sql update please. The one currently in this PR is just a placeholder for a real query

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@richard67
Copy link
Member

@richard67 could you help me with the sql update please. The one currently in this PR is just a placeholder for a real query

@brianteeman Example how to add a parameter to a column with a JSON value:

@brianteeman
Copy link
Contributor Author

Thanks @richard67

@brianteeman
Copy link
Contributor Author

@richard67 I've updated the queries - its a bit different to your example as here we are just are adding a value to the params not a full column etc . It works but not sure its correct. Not tested the postgres version - thats a chatgpt conversion. Appreciate your expert guidance. Maybe it doesnt even need the json stuff in this situation

@richard67
Copy link
Member

@richard67 I've updated the queries - its a bit different to your example as here we are just are adding a value to the params not a full column etc . It works but not sure its correct. Not tested the postgres version - thats a chatgpt conversion. Appreciate your expert guidance. Maybe it doesnt even need the json stuff in this situation

@brianteeman The examples which I have linked do exactly that, add one new value to the existing params which already might have other values. Check e.g. the documentation of JSON_SET for MySQL. What you are doing now is unnecessarily complicated. The examples which I have linked are complete, it just needs to replace table names and value names.

@brianteeman
Copy link
Contributor Author

ok - i will try again. my first attempt failed miserably

@brianteeman
Copy link
Contributor Author

sorry i give up - all i can succeed as doing is to replace the content of the params field with {"tags": "ipaddress"} instead of appending ipaddress to the tags array

@richard67
Copy link
Member

I will not be able to help before Friday.

@richard67
Copy link
Member

@brianteeman Hmm, I see, the thing is indeed a bit different than my example. But I think there must be an easier way to add an element to an array in a json.
Besides this, you have 2 update SQL script now for postgresql, 6.0.0-2025-03-25.sql and 6.0.0-2025-08-27.sql. I guess the former should be reverted.
Anyway, I will try to find time on Friday or weekend to investigate the necessary SQL statement.

@brianteeman
Copy link
Contributor Author

I'm actually wondering if it can't just be a simple query that replaces the entire column value with the new column values. The only way to have changed it yourself would have been a manual SQL query (hack) so it should be safe

@richard67
Copy link
Member

The only way to have changed it yourself would have been a manual SQL query (hack)

@brianteeman If that is the case, then that would be safe.

@brianteeman
Copy link
Contributor Author

Thanks @richard67 I have marked this PR as ready for review now

@brianteeman brianteeman marked this pull request as ready for review August 27, 2025 20:54
@exlemor
Copy link

exlemor commented Aug 28, 2025

I have tested this item ✅ successfully on 3af041b

I have successfully tested this and it worked :) I see an IP in my User Action log email! Very cool!

Thanks @brianteeman!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45991.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants