phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

[RELEASED] Annual Stars 1.0.2


 
Search this topic... | Search MOD Development... | Search Box
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Author Message
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Thu Dec 11, 2008 4:25 am 
Post subject: Annual Stars 1.0.2

This MOD has been validated and released at phpbb.com. I am copying the text of the first few posts here. Note that this MOD will be moved into the MOD Releases forum once the MOD Catalog is complete. This MOD has been installed on this site... which you'll see in about a year.

MOD Name: Annual Stars
Author: drathbun
MOD Description: This MOD adds one star per each 365 days of membership on a user's profile, their entry on the memberlist, and on viewtopic.

MOD Version: 1.0.2 (Updated 05/10/06)

FAQ
  • Help, I installed the MOD but no stars show up! What did I do wrong?
    First make sure you uploaded the graphic, and that you referenced the proper path in the admin panel.
    Next, make sure you have at least one user that has been a member of your board for at least a year. icon_wink.gif
  • Does this MOD handle leap years?
    No, it does not. It was much easier to simply subtrace 365 days from the current date and compare to the registration date. As a result, the "annual" nature of this Annual Stars MOD is a bit compromised.
  • Will you make a special graphic for me?
    Nope, my skills are not in that area. There are several colors of stars provided in the download package that work well for light-colored backgrounds. A user has provided a collection of stars that can be used for dark-color backgrounds as well. If you create something and would like to share it, feel free to send me a PM with the details, and I will be happy to host the images.


Edit History:
2007-08-13 : Added FAQ and download link to stars for dark-colored background boards

Screen shots:

Admin Control Panel
Image link

Memberlist
Image link

Profile
Image link

On a post (viewtopic)
Image link

Samples showing more than one year of membership
Image link
Image link

Additional graphics provided:
Download stars for dark background - provided by DizzyDazzle, thanks



annual_stars.1.0.2.zip
 Description:
MOD Install file (zipped)

Download
 Filename:  annual_stars.1.0.2.zip
 Filesize:  3.83 KB
 Downloaded:  821 Time(s)


_________________
phpBBDoctor Blog
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Wed Dec 17, 2008 8:51 pm 
Post subject: Re: Annual Stars 1.0.2

I've made an "clean version" of this MOD. It's called Simple Annual Stars.
Changes:
-tooked out image & language variables
-tooked out SQL querries
-tooked out stars in memberlist
-tested succesfully in 2.0.23

Here is it for who wants it:
Code:
##############################################################
## MOD Title: Simple Annual Stars
## MOD Author: drathbun < N/A > (Dave Rathbun) http://www.phpBBDoctor.com
## MOD Author: Sylver Cheetah 53 < sylvercheetah53@gmail.com > http://www.friendsforever.co.cc
## MOD Description: This MOD "rewards" members by displaying one star for each year of membership beside their name.
## MOD Version: 1.0.2
##
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit (4): viewtopic.php,
##                    templates/subSilver/viewtopic_body.tpl,
##                    includes/usercp_viewprofile.php,
##                    templates/subSilver/profile_view_body.tpl,
## Included Files: star.gif
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb2refugees.com
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb2refugees.com
##############################################################
## Author Notes:
## This MOD allows the board admin to provide a link to a small
## image or icon of some sort. This icon will be displayed
## under the username in their profile, on the member listing,
## and on the viewtopic display once the user has reached a
## year of membership. There icon will be repeated for each
## year of membership.
##
## The calculation process is not very sophisticated, it simply
## looks for 365 day intervals since the use has joined. As a
## result it will not handle leap years. We did not think that
## it needed to be that precise.
##
## Several simple star graphics are included with the MOD. You
## can use one of them or you can switch out for another
## graphic of your choice.
##
## You can consider each of the non-admin install sections
## optional. If you want to display the annual stars only on
## the profile then skip the sections dealing with viewtopic
## (both the php and the tpl files). You may also opt to skip
## the memberlist changes. Note that if you install via EasyMOD
## or some other automatic installer you will have to edit the
## template file prior to using it if you do not want to
## install all three parts.
##
##############################################################
## MOD History:
##
##   2009-01-03 - Version 1.0.2 (Clean Version)
##      -Tooked out image path and language variables and SQL querries to make it easyer
##      -Tooked out stars in memberlist
##      -Tested succesfully on phpBB 2.0.23
##
##   2006-05-09 - Version 1.0.2
##      Missing  in FIND statement for viewtopic fixed
##
##   2006-04-16 - Version 1.0.1
##      Added template path to image location
##
##   2006-04-15 - Version 1.0.0
##      Initial public release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ COPY ]-------------------------------------
#
copy star.gif to images/star.gif

#
#-----[ OPEN ]-------------------------------------
#
viewtopic.php

#
#-----[ FIND ]-------------------------------------
#
   $poster_joined =

#
#-----[ AFTER, ADD ]-------------------------------------
#
   // Begin Annual Stars 1.0.2
   $poster_term = floor(( $postrow[$i]['user_id'] != ANONYMOUS ) ? ((time() - $postrow[$i]['user_regdate']) / (365 * 86400) ) : 0);

   $poster_term_img = str_repeat('<img src="images/star.gif" border="0" title="Annual Stars" />', $poster_term) . (($poster_term) ?  '<br />' : '');
   // END  Annual Stars 1.0.2


#
#-----[ FIND ]-------------------------------------
#
      'POSTER_JOINED' => $poster_joined,

#
#-----[ AFTER, ADD ]-------------------------------------
#
      'POSTER_TERM_IMG' => $poster_term_img,

#
#-----[ OPEN ]-------------------------------------
#
templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]-------------------------------------
#
{postrow.POSTER_JOINED}<br />

#
#-----[ IN-LINE FIND ]-------------------------------------
#
{postrow.POSTER_JOINED}<br />

#
#-----[ IN-LINE AFTER, ADD ]-------------------------------------
#
{postrow.POSTER_TERM_IMG}

#
#-----[ OPEN ]-------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]-------------------------------------
#
assign_vars

#
#-----[ BEFORE, ADD ]-------------------------------------
#
$term = floor ( (time() - $profiledata['user_regdate']) / (365 * 86400) );
$term_img = str_repeat('<img src="images/star.gif" border="0" title="Annual Stars" />', $term);


#
#-----[ FIND ]-------------------------------------
#
   'JOINED' =>

#
#-----[ AFTER, ADD ]-------------------------------------
#
   'TERM_IMG' => $term_img,

#
#-----[ OPEN ]-------------------------------------
#
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]-------------------------------------
#
{JOINED}</span></b>

#
#-----[ IN-LINE FIND ]-------------------------------------
#
{JOINED}</span></b>

#
#-----[ IN-LINE AFTER, ADD ]-------------------------------------
#
{TERM_IMG}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Enjoy. icon_wink.gif

_________________
Image link
My Forum || My Blog

phpBB2 forever! icon_smile.gif
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Thu Nov 10, 2011 2:40 pm 
Post subject: Re: Annual Stars 1.0.2

On my largest board we have folks approaching ten years of membership, and the list of stars is getting quite long. As a result I have modified the code to replace 10 gold stars with one green star. That means nine years of membership will be nine gold stars, then ten years of membership will be one green star, and eleven years of membership will be one green + one gold and onward from there. To do this is fairly simple, especially if you've hard-coded the image names instead of using the admin panel version. Find this:
Code:
   // Begin Annual Stars 1.0.2 (www.phpBBDoctor.com)
   $poster_term = floor(( $postrow[$i]['user_id'] != ANONYMOUS ) ? ((time() - $postrow[$i]['user_regdate']) / (365 * 86400) ) : 0);

   $poster_term_img = str_repeat('<img src="templates/' . $theme['template_name'] . '/' . $board_config['annual_stars'] . '"  border="0" title="' . $lang['Annual_stars'] . '" />', $poster_term) . (($poster_term) ?  '<br />' : '');
   // END  Annual Stars 1.0.2 (www.phpBBDoctor.com)

There are several variations of the $term_img assignment. Instead of using one str_repeat() function I set the threshold in a variable called $green and then do this:
Code:
        $green = 10;
        $poster_term = floor((time() - $reg_date) / (365 * 86400) );
        $poster_term_img = str_repeat('<img src="images/ranks/star-green.gif" width="16" height="16" border="0" title="Green star represents ' . $green . ' years of membership" />', floor($poster_term / $green)) . str_repeat('<img src="images/ranks/star.gif" width="16" height="16" border="0" title="Gold star represents one year of membership" />', ($poster_term % $green)) ;

The $green value is hard-coded for now since I set it once and then forget about it; it didn't seem worth it to create an admin panel entry for this. First, I get the years of membership and store that in the $poster_term variable. The floor() function is used to ignore the decimal result of dividing the total days of membership by the number of days in a standard year. I don't want to use round() because it would round up; the floor() function always truncates or removes the decimal even if it's .99999. Next, I repeat green stars for however many "10's" are in the years of membership, again using the floor() function and dividing the years of membership by $green. Next, I use modulo math to get the remainder of the division and that's how many gold stars are shown.

As mentioned, the official MOD allows users to have their star images in template folders so they can have different stars for each template. I only use one, so I put my star images into the /images/ranks/ folder instead.

Having a green star per 10 years should allow me to show up to 98 years of membership in the same space as I currently use for 9. I think that's more than enough. icon_lol.gif

_________________
phpBBDoctor Blog
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Thu Nov 10, 2011 4:11 pm 
Post subject: Re: Annual Stars 1.0.2

Mind you,

Some of those phpBB2-users are real diehards! icon_biggrin.gif

_________________
phpBB2 will never die, I hope!
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 653
Location: Texas


flag
PostPosted: Thu Nov 10, 2011 10:12 pm 
Post subject: Re: Annual Stars 1.0.2

If we're still using phpBB2 in 98 years I'll be... well, I'll be dead, but that's another issue altogether. icon_cool.gif
_________________
phpBBDoctor Blog
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 621
Location: Spain


flag
PostPosted: Fri Nov 11, 2011 6:53 am 
Post subject: Re: Annual Stars 1.0.2

Haha,

You sound a bit pessimistic. icon_twisted.gif

If we manage to keep up phpBB2 for another 98 years we´ll be capable of anything. icon_mrgreen.gif

_________________
phpBB2 will never die, I hope!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 414
Location: Québec


flag
PostPosted: Fri Nov 11, 2011 5:50 pm 
Post subject: Re: Annual Stars 1.0.2

I know all of us here prefer phpBB2 to most other boards, but to be honest, it would be sad if nothing surpasses it in the next century icon_confused.gif icon_wink.gif
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0228 seconds using 17 queries. (SQL 0.0015 Parse 0.0026 Other 0.0187)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo