Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Kirill N Posted March 4, 2015 Posted March 4, 2015 How do I display a user's join date in the post bit?
The Jimmo Posted March 4, 2015 Posted March 4, 2015 Template hook. Think I may experiment real quick.
Kirill N Posted March 4, 2015 Author Posted March 4, 2015 Template hook. Think I may experiment real quick. Hmm I expected it could be done by adding just one line to the template. But thanks, looking forward to it!
The Jimmo Posted March 4, 2015 Posted March 4, 2015 You could probably do it that way too. A template hook though would be more robust IMO.
Kirill N Posted March 4, 2015 Author Posted March 4, 2015 You could probably do it that way too. A template hook though would be more robust IMO.I have a very heavily modified theme so I think a template edit would be a better idea. Do you by any chance what code I should add?
The Jimmo Posted March 4, 2015 Posted March 4, 2015 Can check out my hook here: http://community.invisionpower.com/files/file/7303-jimmo-user-join-date-in-post/Or add the below:{datetime="$comment->author()->joined"}
Kirill N Posted March 4, 2015 Author Posted March 4, 2015 Can check out my hook here: http://community.invisionpower.com/files/file/7303-jimmo-user-join-date-in-post/Or add the below:{datetime="$comment->author()->joined"} This is exactly what I was looking for. Thanks so much!
Kirill N Posted March 15, 2015 Author Posted March 15, 2015 Can check out my hook here: http://community.invisionpower.com/files/file/7303-jimmo-user-join-date-in-post/Or add the below:{datetime="$comment->author()->joined"} Do you by any chance know how to make it display the month and year only?
Adriano Faria Posted March 15, 2015 Posted March 15, 2015 @ForeverPontiac, the date returns as an object (\IPS\DateTime) so you can use format. I'm working to update my hook (http://community.invisionpower.com/files/file/4821-enhanced-joined-date/) and it uses the joined date as well. That's how I did to format it:$joinedDate->format( 'm/d/Y' );However I use it on a PHP function, not on template... don't know how you can do this on a theme hook.
The Jimmo Posted March 15, 2015 Posted March 15, 2015 {{$date = $comment->author()->joined;}} {{$date = $date->format( 'M Y' );}} {$date} wherever you want to use it in the templateBasically what @Adriano Faria mentioned, can probably reduce and combine the lines a bit but this is for demonstration purposes.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.