Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nulog format

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
vario
Posts: 151
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

nulog format

Unread post by vario »

Hi,
Is there any reason why I should not change the logged user and time to a more user-friendly format?
I would choose #LOGIN_NAME# and date('Y-m-d H:i:s') for my purposes.

Neil.
kev1n
nuBuilder Team
Posts: 4302
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: nulog format

Unread post by kev1n »

One of the primary benefits of using Unix time is that it can be represented as an integer making it easier to parse and use across different systems. And depending on the country and preference, different formats would be chosen.

To parse the unix date (and then also display it in your preferred format), check out:
https://github.com/nuBuilder/nuBuilder- ... g_activity
https://github.com/nuBuilder/nuBuilder- ... g_activity
vario
Posts: 151
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: nulog format

Unread post by vario »

I have added the code but it shows zzzzsys_user_id rather than the readable sus_login_name or sus_name I want. Are there going to be any bugs if I change the stored user to LOGIN_NAME at line 172 of nudata.php?

Neil
kev1n
nuBuilder Team
Posts: 4302
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: nulog format

Unread post by kev1n »

I will try adding an additional format to the nulog column so you can use either of them
vario
Posts: 151
Joined: Mon Dec 05, 2011 12:23 pm
Location: Newton Abbot, UK
Has thanked: 1 time
Been thanked: 1 time

Re: nulog format

Unread post by vario »

OK thanks - I have modified nudata.php anyway to test and all working well. If anyone else is interested here is a bit of SQL to update existing data (presuming your SQL supports the regexp code).

Code: Select all

update yourtable
join zzzzsys_user on (zzzzsys_user_id = regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'))
set yourtable_nulog = replace(yourtable_nulog,regexp_substr(yourtable_nulog,'"added":{"user":"\\K[0-9a-z]+'),sus_login_name)
Repeat as required for "edited" and so on.
Post Reply