Page 1 of 3

[MOD-DB] Annual Stars 1.0.1 (Last Update May 8, 2006)

Posted: Sun Apr 16, 2006 5:19 am
by drathbun
MOD Title: Annual Stars
MOD Description: Displays a graphic (a star is included with the MOD) for each year of membership.
MOD Version: 1.0.1
MOD Download: Please use Release Topic here
Demo Board: None, see screen shots to be provided shortly

1.0.1 Update
Per a suggestion from a post later in this topic, included the template path + user selected style in the image path location. So instead of having a single graphic stored in images/star.gif you can now have templates/subSilver/images/star.gif and templates/subRed/images.star.gif and so on. Note that the image name should be the same in all templates used on your board, only the location is different.

My graphics skills are minimal. :-) I did a color shift on my original star graphic (and also reduced the color depth, cutting the file size from near 1K down to ~ 200 bytes) and provided 3 additional colors. If anyone wants to submit annual "reward" images (they do not have to be stars, obviously) I will happily host them, subject to my approval. I don't intend to host "inapproprate" images, you will have to host those yourself. I have the final call as to what is considered "inappropriate" for hosting on my site. :-)

Original MOD Description follows
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.

A simple star graphic is included with the MOD. You can use it or you can switch it out for another graphic of your choice. The path to the image is set in the admin control panel (ACP) so you do not need to edit any code in order to switch the image.

Graphics included: Image Image Image Image

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.

Posted: Sun Apr 16, 2006 5:25 am
by Disturbed One
Hello,

This is very cool, especially since there are no extra SQL queries.

I can upload some screenshots.

Posted: Sun Apr 16, 2006 5:29 am
by drathbun
I'm making screenshots now, will post them in a few minutes. 8) Thanks.

Posted: Sun Apr 16, 2006 5:33 am
by Disturbed One
Hello,

You have an error.

admin_board.php

Code: Select all

	'ANNUAL_STARS' => $new['annual_stars'],
should be

Code: Select all

	'ANNUAL_STARS' => $new['annual_image'],

Posted: Sun Apr 16, 2006 5:34 am
by Disturbed One
Hello,

Wait... all of your other things look at "annual_stars". So your SQL query should be that then.

Posted: Sun Apr 16, 2006 5:39 am
by drathbun
The following screen shots are all from actual boards where this MOD is in use. The first four show the various different screens where the annual star could be displayed, and in this case only one year of membership has been recognized. The last two samples are from a board that has been around for a lot longer, and shows how the annual stars are repeated per each year of membership.

I put this MOD right at RC (release candidate) status because it's fairly simple, and I've been using it for over 3 years. I don't expect any coding issues, but there might be issues in the way the template / install instructions are written up.

Admin Control Panel
Image

Memberlist
Image

Profile
Image

On a post (viewtopic)
Image

Samples showing more than one year of membership
Image
Image

Posted: Sun Apr 16, 2006 5:42 am
by drathbun
Disturbed One wrote: Hello,

Wait... all of your other things look at "annual_stars". So your SQL query should be that then.

See, I knew there would be some sort of problem with the install notes! :lol: Fixing now, thanks.

Posted: Sun Apr 16, 2006 5:44 am
by drathbun
Fixed. I didn't bother updating the version, as I doubt many other folks have downloaded / installed it yet. Thanks for the quick turn-around, hopefully that's the only glitch.

Posted: Sun Apr 16, 2006 5:48 am
by Disturbed One
Hello,

The only other "problem" I see is in the view profile there is no title. The source uses alt.

So I changed the line to be

Code: Select all

$term_img = str_repeat('<img src="' . $board_config['annual_stars'] . '" border="0" title="' . $lang['Annual_stars'] . '" />', $term);
instead of your

Code: Select all

$term_img = str_repeat('<img src="' . $board_config['annual_stars'] . '" border="0" alt="' . $lang['Annual_stars'] . '" />', $term);
An alt will not be useful if the image is not there, because "Years of Membership" does not really help. I'm not sure if it really is a problem or not.

Posted: Sun Apr 16, 2006 5:51 am
by drathbun
No, you're right, it should be "title" instead of "alt". I copied the code from the original board I wrote this for, and that was several years ago when I didn't understand the difference in the usage of alt and title. ;-) I'll update it, thanks again.

Posted: Sun Apr 16, 2006 5:55 am
by drathbun
Download link updated, still 1.0.0 though. 8)

Posted: Sun Apr 16, 2006 6:03 am
by Peter77sx
Hello, I installed the SQL before you updated. has the SQL changed?

::edit:: yes it has.

Works great. it was an nice idea for a MOD. thanks. :)

Posted: Sun Apr 16, 2006 6:09 am
by drathbun
Geez, y'all are fast. :shock: It's after midnight on a Saturday where I am, and I know I have no life, what excuse do the rest of you have? ;-)

Minor changes to the code (change alt= to title= in one place) and yes, the SQL insert statement has changed. You'll have to update it directly as the admin panel won't "see" the value until the name matches. Once you update the row (or simply delete it and insert a new one) then you can update the value via the ACP.

Posted: Sun Apr 16, 2006 6:18 am
by Peter77sx
Oops, double post.

Posted: Sun Apr 16, 2006 6:19 am
by Peter77sx
Yup, got it to work... thanks.

Its after 2am over here. plans were cancled for the night! :o