Posts: 18
Threads: 7
Joined: Apr 2015
Reputation:
0
2015-07-19, 08:02 AM
I have noticed this on a total of two forum so far, and I am very curious as to how I could achieve this as well.
On the first one I will show you, you will see where it says something like <Number> years of service under all of the postbit information.
On the second one, you will see it is directly under either the username or under the userbar.
Does anyone know what I would have to edit in the postbit template to add this? Cause these forums are big communities so they don't just go and do it manually, and I think it's quite optimistic that they came up with there own way to do this.
And yes, I have used the search and nothing has shown up.
Image 1:
Image 2:
I would also like to know how to make the text change color with each different "<#> years of service"
Posts: 1,090
Threads: 57
Joined: May 2014
Reputation:
57
2015-07-19, 08:15 AM
Easy, you need this plugin to make it work ~ http://mybbhacks.zingaburga.com/showthread.php?tid=260
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><span style="color: gold;">One Year of Service</span></if>
Posts: 825
Threads: 61
Joined: Mar 2012
Reputation:
49
2015-07-19, 09:10 AM
(This post was last modified: 2015-07-19, 09:10 AM by Krytic.)
Or:
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*365))</setvar>
<span class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} years of service</span>
(The number will be an integer, ie 1, 2, 3, instead of one, two, three)
Then, in global.css, stuff like this works:
.service-1 {
color: pink;
}
.service-2 {
color: yellow;
}
.service-3 {
color: red;
}
.service-4 {
color: orange;
}
et cetera, where the number is the number of years of service.
Posts: 18
Threads: 7
Joined: Apr 2015
Reputation:
0
2015-07-19, 05:17 PM
(This post was last modified: 2015-07-19, 08:06 PM by LucidiousXIV.)
(2015-07-19, 08:15 AM)Akay Wrote: Easy, you need this plugin to make it work ~ http://mybbhacks.zingaburga.com/showthread.php?tid=260
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><span style="color: gold;">One Year of Service</span></if>
(2015-07-19, 09:10 AM)Adamas Wrote: Or:
<setvar years>floor((TIME_NOW-$post['regdate'])/(60*60*24*365))</setvar>
<span class="service-{$GLOBALS['tplvars']['years']}">{$GLOBALS['tplvars']['years']} years of service</span>
(The number will be an integer, ie 1, 2, 3, instead of one, two, three)
Then, in global.css, stuff like this works:
.service-1 {
color: pink;
}
.service-2 {
color: yellow;
}
.service-3 {
color: red;
}
.service-4 {
color: orange;
}
et cetera, where the number is the number of years of service.
But how would I calculate the time for each year? That's what I get messed up with.
(2015-07-19, 08:15 AM)Akay Wrote: Easy, you need this plugin to make it work ~ http://mybbhacks.zingaburga.com/showthread.php?tid=260
<if $post['regdate']+(60*60*24*365) <= TIME_NOW then><span style="color: gold;">One Year of Service</span></if>
So I tried doing it just to test and see if the <span> would work, and no text popped up? Unless it has to be postbit_classic?
Posts: 5,525
Threads: 73
Joined: Feb 2012
Reputation:
582
2015-07-20, 01:04 AM
(2015-07-19, 05:17 PM)LucidiousXIV Wrote: But how would I calculate the time for each year? That's what I get messed up with.
Math and basic knowledge... Two code suggestions were posted above. The 2nd works for all years, just add proper CSS which is also mentioned by Adamas.
Posts: 18
Threads: 7
Joined: Apr 2015
Reputation:
0
2015-07-20, 02:16 AM
(2015-07-20, 01:04 AM)Destroy666 Wrote: (2015-07-19, 05:17 PM)LucidiousXIV Wrote: But how would I calculate the time for each year? That's what I get messed up with.
Math and basic knowledge... Two code suggestions were posted above. The 2nd works for all years, just add proper CSS which is also mentioned by Adamas.
I mean must I do for two years and three years as I am still getting into PHP
Posts: 825
Threads: 61
Joined: Mar 2012
Reputation:
49
2015-07-28, 08:50 AM
(2015-07-20, 02:16 AM)LucidiousXIV Wrote: (2015-07-20, 01:04 AM)Destroy666 Wrote: (2015-07-19, 05:17 PM)LucidiousXIV Wrote: But how would I calculate the time for each year? That's what I get messed up with.
Math and basic knowledge... Two code suggestions were posted above. The 2nd works for all years, just add proper CSS which is also mentioned by Adamas.
I mean must I do for two years and three years as I am still getting into PHP
I apologise for the delayed response. If you're still looking for an answer, no. The only thing you need to worry about is adding new CSS definitions to style each bar. The text itself automatically updates for every user.
Posts: 129
Threads: 47
Joined: Oct 2015
2015-11-12, 09:41 PM
This user has been denied support.
This works but something is wrong in my post but I have 0 years of service which is correct but when I added it to the member profile template in everyone's profile it shows 45 years of service ?
Posts: 32
Threads: 19
Joined: Nov 2015
Reputation:
0
2016-01-08, 10:44 AM
How would you make this into months instead of years?
Posts: 21,668
Threads: 5
Joined: Aug 2011
Reputation:
2,316
2016-01-08, 11:08 AM
^ well, in the code 60*60*24*365 is for a year. here year consists of 365 days. now I hope you can make it for months !
|