We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ ! ] Local time in profile
Topic Started: Jan 10 2015, 05:57 AM (605 Views)
-The-
Member Avatar
#the { display: none; }
[ *  *  *  *  * ]
Board Address: http://atriumforum.com
Board Software: ZetaBoards
Description: Pull the member's local time stat from the main profile and display it in the mini-profile (probably as a custom profile line).

Thanks,

The
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Using AJAX to display any type of content in the mini profile would require too much AJAX. If, for example, 15 different users posts were on one page it would require 15 AJAX requests to grab the data for all 15 users. I can think of one possible way to deter the amount of AJAX it has to use, but it's too complex and would require a lot of coding.
Offline Profile Goto Top
 
-The-
Member Avatar
#the { display: none; }
[ *  *  *  *  * ]
Ok...guess we can manually add it in a custom profile block, but thanks for that anyway :(
Offline Profile Goto Top
 
RedBldSandman
Member Avatar
Asante sana Squash banana
[ *  *  *  * ]
You could make a custom profile field shown in topics which automatically changes when they change their local time setting (showing GMT+X and DST). It could be converted to a time if wanted (1 ajax request to board settings and use the clock time on the page but this makes every topic page load count as 2 page loads...) or just be left as GMT+X (DST).

The code would need to update the profile field on registration and to get the initial settings for currently registered members either (i) the members would need to update their board settings or (ii) the code recognises when they're in a thread which has one of their posts and then checks if it's set -> if it isn't then it updates the profile field. Option (ii) is more intensive as it would scan each thread which is loaded but wouldn't affect performance really (and could be reduced further by only searching every 1/10 threads - this would delay the update of the fields but would later on would reduce the effect on performance, it could even be adjusted later on e.g. at the start it processes every thread but then can be changed to check 1/10 threads later) but would get rid of the need for current members to all update their profile fields.

I unfortunately don't have the time to make the code but thought I'd just suggest a possible solution.
Edited by RedBldSandman, Jan 10 2015, 01:44 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You totally lost me.

Unless you were to convert a timezone to specific time, then wouldn't it require an AJAX request for every member in the topic? I'm sure the OP wants time to display and not a timezone, which is what the default registration/Board Settings option would return if it were to post an AJAX request to update their profile field to display their timezone in topics.
Offline Profile Goto Top
 
RedBldSandman
Member Avatar
Asante sana Squash banana
[ *  *  *  * ]
In topic:
1. You would have every members' time zone in topic via the new profile field (via the update part of the code)
2. You would grab the current user's time zone via 1 ajax request to board settings
3, Using some simple logic involving the current user's time zone and the board clock on the topic page you convert all the time zones in the profile fields to times (e.g. I'm GMT and it's 1:22PM on the board clock -> If a profile field timezone is GMT + 1 you add on one hour so it's 2:22PM)
Offline Profile Goto Top
 
Arrogant
Member Avatar
Member
[ *  *  *  * ]
RedBldSandman
Jan 15 2015, 09:33 AM
In topic:
1. You would have every members' time zone in topic via the new profile field (via the update part of the code)
2. You would grab the current user's time zone via 1 ajax request to board settings
3, Using some simple logic involving the current user's time zone and the board clock on the topic page you convert all the time zones in the profile fields to times (e.g. I'm GMT and it's 1:22PM on the board clock -> If a profile field timezone is GMT + 1 you add on one hour so it's 2:22PM)
  1. Create a new profile field that stores the member's time zone offset (i.e., -5).
    You'd need to use AJAX to get the correct time zone if it hasn't yet been updated (or go off the board clock, like you mentioned, by getting the time zone offset and dividing it by 60).
    You could also update it when a new member is registered by showing the profile field on the registration page and updating it then.
  2. Use the moment.js library to adjust the time based on a specific time zone (in this case, -5).
Code:
 
moment().utcOffset(-5).format("MMM Do YYYY, h:mm a");

Using an existing library makes it a lot easier. There's a bit of logic involved with doing it yourself, between getting the local time, getting the time zine, setting the time zone, checking whether it's DST or not, etc.. nothing too complicated, but why bother? moment.js does the job just fine. There may also be a jQuery plugin you could use (haven't looked myself).
Edited by Arrogant, Jan 18 2015, 11:33 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
-The-, are you still interested in this script? I may attempt it if you are using the JavaScript library that Arrogant posted.
Offline Profile Goto Top
 
RedBldSandman
Member Avatar
Asante sana Squash banana
[ *  *  *  * ]
Arrogant
Jan 18 2015, 11:23 PM
Pretty much repeating what I've said

moment.js
Your post just confuses things I'm afraid as, in that post, I was just giving a rundown on what would happen "in topic" whilst previous posts explained the whole code.

moment.js (possibly also moment-timezone) is useful but for one of the simpler parts of the code so just make sure you have the other parts clear in your head Cory :)
Offline Profile Goto Top
 
-The-
Member Avatar
#the { display: none; }
[ *  *  *  *  * ]
I am still interested in this script, but I think some of this is slightly above my head. If you could give a simple rundown on how to use the code (as I'm sure you will, knowing you Cory), then it'd be great to have.

Thanks,

The
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Unfortunately, it appears I won't be working on this script after all because I do not have the time or patience for it. Sorry for the inconvenience.
Offline Profile Goto Top
 
-The-
Member Avatar
#the { display: none; }
[ *  *  *  *  * ]
Don't worry Cory. My board members quickly forgot about this once I told them it would be a pain :)
Offline Profile Goto Top
 
Roby
Member Avatar
#27

This request has gone a lengthy period of time without any new activity, therefore it is being marked as expired. This means that the request was typically too time-consuming or irritating for coders (who provide this service voluntarily in their free time) to complete.

Thank you.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic