inherit
169267
0
Nov 23, 2024 12:51:41 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Aug 29, 2021 8:17:27 GMT -8
I have this code in my plug in
$(document).ready(function(){ var user=pb.data('user'); var myDate = new Date(); var hrs = myDate.getHours();
var greet;
if (hrs < 12) greet = 'Good Morning'; else if (hrs >= 12 && hrs <= 17) greet = 'Good Afternoon'; else if (hrs >= 17 && hrs <= 24) greet = 'Good Evening';
document.getElementById('lblGreetings').innerHTML = '<b>' + greet + ' '+user+'</b> '; });
I place my holder in the layout
<label id="lblGreetings"> </label>
But what it show on the home page is "Good morning null" How do I get the user's name to appear?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Aug 29, 2021 14:12:43 GMT -8
I have this code in my plug in $(document).ready(function(){ var user=pb.data('user'); var myDate = new Date(); var hrs = myDate.getHours();
var greet;
if (hrs < 12) greet = 'Good Morning'; else if (hrs >= 12 && hrs <= 17) greet = 'Good Afternoon'; else if (hrs >= 17 && hrs <= 24) greet = 'Good Evening';
document.getElementById('lblGreetings').innerHTML = '<b>' + greet + ' '+user+'</b> '; });
I place my holder in the layout <label id="lblGreetings"> </label> But what it show on the home page is "Good morning null" How do I get the user's name to appear? Try changing... var user=pb.data('user'); to var user=pb.data('user').name;
|
|
inherit
169267
0
Nov 23, 2024 12:51:41 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Aug 29, 2021 14:34:07 GMT -8
Todgewill this use the time off of proboards server?
|
|
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 Aug 29, 2021 17:16:54 GMT -8
Todge will this use the time off of proboards server? If you change the line: var myDate = new Date(); to: var myDate = new Date(pb.data('serverDate')) that will make the code use the Proboards' server time rather than the user's local computer time
|
|
inherit
169267
0
Nov 23, 2024 12:51:41 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Aug 30, 2021 3:44:45 GMT -8
Thank you
|
|