inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Jun 6, 2017 18:09:43 GMT -8
I've got a plugin that will be using a Private User key that will get set (via popup) when the user gets a notification.
My question is, what's the best way to clear that key on the following day? The key will basically have a value of 0 (cleared or just being cleared) or 1 (user has not yet had their popup notification). I'm looking to either be able to just clear the key or just set it to 0, but in a legitimate way as I know it can't be done without a user action.
Highlights of plugin operation (Plugin Update Reminder plugin):
- Options: Daily, Weekly or Monthly - Popup displays on new day (depending on option above) - key gets set (to indicate notice given) when OK is clicked on popup
Issue:
- How to clear the key, or set it to 0, so the popup shows for the next reminder popup.
Or, is their a better way to do this?
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jun 7, 2017 14:02:01 GMT -8
I'm not sure I quite understand part of what you are trying to do. I understand if the user has read the notification the key is set to 0 (aka cleared). Are you trying to make the notification expire if the user hasn't read it in X amount of time (in your case, clear it the next day, week, or month)? Edit: Not sure if you are aware, but if it's a private user key, then no other member can read or write to it. There are issues with the permission system with user keys.
|
|
inherit
216224
0
Aug 1, 2024 1:18:46 GMT -8
Quozzo
408
November 2014
quozzo
|
Post by Quozzo on Jun 9, 2017 13:10:44 GMT -8
Basically, you don't clear the key. The key should just keep track of the last time the closed the popup (save a timestamp) then whenever it's loaded you check to see if the timestamp is today, if it is then no popup is displayed. If it isn't then give them a popup. When they hit "close" you save the timestamp again. Rinse repeat.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Jun 13, 2017 18:33:52 GMT -8
My apologies for not getting back to both of you, Peter and Quozzo, sooner. It's been quite crazy around here since Dad passed away. I'm not sure I quite understand part of what you are trying to do. I understand if the user has read the notification the key is set to 0 (aka cleared). Are you trying to make the notification expire if the user hasn't read it in X amount of time (in your case, clear it the next day, week, or month)? Edit: Not sure if you are aware, but if it's a private user key, then no other member can read or write to it. There are issues with the permission system with user keys. If today is the day they get a notification, then they get plugin update reminder popup - to which I can set the key when they click OK on the popup. If it's not the day for the reminder, I need to make sure no popup gets presented. My initial thoughts were that I would have to clear the key to make sure the popup wouldn't show on a day / date it's not supposed to show. My head's not fully clear yet, so if you need me to elaborate more, I'll certainly try to. Thanks for the response! Basically, you don't clear the key. The key should just keep track of the last time the closed the popup (save a timestamp) then whenever it's loaded you check to see if the timestamp is today, if it is then no popup is displayed. If it isn't then give them a popup. When they hit "close" you save the timestamp again. Rinse repeat. Would this work for any of the options (daily, weekly, monthly)? Also, my biggest hurdle right now is timestamps (which is why I had thought of finding a way to clear the key). All that .toUTCString and other timestamp types confuse me a lot. Like, how do I know what type to change a timestamp to? I ask this because I'm trying to also figure out timestamps so my General Notices plugin can use date ranges (instead of an autoform entry per date of an event). Thanks for the response!
|
|
Former Member
inherit
guest@proboards.com
225992
0
Nov 23, 2024 18:53:09 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Jun 14, 2017 0:20:59 GMT -8
It's been quite crazy around here since Dad passed away. Sorry to hear that Lynx my condolences.
|
|
inherit
216224
0
Aug 1, 2024 1:18:46 GMT -8
Quozzo
408
November 2014
quozzo
|
Post by Quozzo on Jun 14, 2017 17:12:26 GMT -8
My apologies for not getting back to both of you, Peter and Quozzo , sooner. It's been quite crazy around here since Dad passed away. I'm not sure I quite understand part of what you are trying to do. I understand if the user has read the notification the key is set to 0 (aka cleared). Are you trying to make the notification expire if the user hasn't read it in X amount of time (in your case, clear it the next day, week, or month)? Edit: Not sure if you are aware, but if it's a private user key, then no other member can read or write to it. There are issues with the permission system with user keys. If today is the day they get a notification, then they get plugin update reminder popup - to which I can set the key when they click OK on the popup. If it's not the day for the reminder, I need to make sure no popup gets presented. My initial thoughts were that I would have to clear the key to make sure the popup wouldn't show on a day / date it's not supposed to show. My head's not fully clear yet, so if you need me to elaborate more, I'll certainly try to. Thanks for the response! Basically, you don't clear the key. The key should just keep track of the last time the closed the popup (save a timestamp) then whenever it's loaded you check to see if the timestamp is today, if it is then no popup is displayed. If it isn't then give them a popup. When they hit "close" you save the timestamp again. Rinse repeat. Would this work for any of the options (daily, weekly, monthly)? Also, my biggest hurdle right now is timestamps (which is why I had thought of finding a way to clear the key). All that .toUTCString and other timestamp types confuse me a lot. Like, how do I know what type to change a timestamp to? I ask this because I'm trying to also figure out timestamps so my General Notices plugin can use date ranges (instead of an autoform entry per date of an event). Thanks for the response! Yes. If you're not showing them the timestamp, who cares what timezone it is? Just use the same one. UTC is the standard which is nice because I live in the UK. For reference (in your other plugin) you can get the user's local time by the non UTC methods: var d = new Date(); d.getHours() + ":" + d.getMinutes()That will get the user's hour and minutes. Try it in the console.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jun 15, 2017 3:15:15 GMT -8
It's been quite crazy around here since Dad passed away. Ah man. Sorry to hear that
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jun 17, 2017 3:25:49 GMT -8
I am so sorry for your loss Lynx
|
|
inherit
216224
0
Aug 1, 2024 1:18:46 GMT -8
Quozzo
408
November 2014
quozzo
|
Post by Quozzo on Jun 24, 2017 4:07:19 GMT -8
It's been quite crazy around here since Dad passed away. Sorry to hear that. You have my deepest sympathies. I didnt read your whole post, only the reply to my own.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Jul 11, 2017 9:18:02 GMT -8
It's been quite crazy around here since Dad passed away. Sorry to hear that Lynx my condolences. It's been quite crazy around here since Dad passed away. Ah man. Sorry to hear that I am so sorry for your loss Lynx It's been quite crazy around here since Dad passed away. Sorry to hear that. You have my deepest sympathies. I didnt read your whole post, only the reply to my own. Thank you everyone. Sorry I haven't replied sooner, but I hadn't logged onto any forums for quite some time, and I haven't even had the computer on at all for the past week. Question: How can I extract the regular Mon July 11 2017 from pb.data('serverDate')? I will need to specifically get the Day (such as Mon) and the Month and Date. Thanks!
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 11, 2017 9:59:20 GMT -8
Mon July 11 2017$.datepicker.formatDate("D MM dd yy", new Date(pb.data('serverDate')))
Mon$.datepicker.formatDate("D", new Date(pb.data('serverDate')))
July$.datepicker.formatDate("MM", new Date(pb.data('serverDate')))
11$.datepicker.formatDate("dd", new Date(pb.data('serverDate')))
2017$.datepicker.formatDate("yy", new Date(pb.data('serverDate')))
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,846
January 2015
msg
|
Post by Lynx on Jul 11, 2017 10:03:23 GMT -8
Thank you very much, Chris! That helps me a lot. EDIT: So this would allow me to get the day into a variable: var myDay = $.datepicker.formatDate("D", new Date(pb.data('serverDate')));
where I can use myDay later in the code where it holds the current date from PB's serverDate?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 11, 2017 10:28:57 GMT -8
Thank you very much, Chris ! That helps me a lot. EDIT: So this would allow me to get the day into a variable: var myDay = $.datepicker.formatDate("D", new Date(pb.data('serverDate')));
where I can use myDay later in the code where it holds the current date from PB's serverDate? The code you are using there would place the abbreviated name of the day (e.g "Tue") into the myDay variable, if you want the full name of the day (e.g "Tuesday") then use "DD" instead of "D". EDIT: see this post for a list of format string placeholders
|
|