MyBB Community Forums

Full Version: <blank> years of service
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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: rlIG8wr.png]

Image 2:

[Image: FGCnPxq.png]

I would also like to know how to make the text change color with each different "<#> years of service"
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>
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.
(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?
(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.
(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
(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.
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 ?
How would you make this into months instead of years?
^ 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 !
Pages: 1 2 3