[Split] Last Active in Profile Area

Discussion forum for Extension Writers regarding Extension Development.
User avatar
Walther
Registered User
Posts: 301
Joined: Fri Jul 09, 2004 5:21 pm
Location: The Netherlands

[Split] Last Active in Profile Area

Post by Walther »

Ref: viewtopic.php?p=16026793

I adapted the given solution to show the lastvisit, so it now both shows the joined AND the lastvisit
Had a little more work to do in the viewtopic.php (declaring new variable 'lastvisit' and parsing it)

However, is there a possibility to strip the time from both, and maybe a possibility to only show to admin and/or moderators?

edit:
tampered with chatGPT for the date format, got the following working solution, but is it any good?

Code: Select all

'joined'    => explode(' ', $user->format_date($row['user_regdate']))[0] . ' ' . explode(' ', $user->format_date($row['user_regdate']))[1] . ' ' . explode(' ', $user->format_date($row['user_regdate']))[2],
'lastvisit' => explode(' ', $user->format_date($row['user_lastvisit']))[0] . ' ' . explode(' ', $user->format_date($row['user_lastvisit']))[1] . ' ' . explode(' ', $user->format_date($row['user_lastvisit']))[2],
Last edited by Mick on Sun Aug 18, 2024 7:02 am, edited 1 time in total.
Reason: Split from https://www.phpbb.com/community/viewtopic.php?p=16026793
User avatar
Walther
Registered User
Posts: 301
Joined: Fri Jul 09, 2004 5:21 pm
Location: The Netherlands

Re: [Split] Last Active in Profile Area

Post by Walther »

Little update:

Although the previous mentioned code does work, now trying a much easier (and little faster method), also gave some cleaner code.

Code: Select all

'joined'    => substr($user->format_date($row['user_regdate']), 0, 11),
'lastvisit' => substr($user->format_date($row['user_lastvisit']), 0, 11),
Result in:
Joined: 17 Jun 2011
Last visit: 09 Aug 2024

edit: I noticed that the ref. given by the mod does not goes to the right topic, but goes to this thread.
The original topic was : viewtopic.php?t=2592126 ( Last Active in Profile Area )
User avatar
ssl
Registered User
Posts: 1979
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert

Re: [Split] Last Active in Profile Area

Post by ssl »

Sorry for my English ... I do my best! :anger_right:

:point_right_tone3: phpBB: 3.3.13 | PHP: 8.3.9
:point_right_tone4: [Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"

Return to “Extension Writers Discussion”