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

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Paddic
Registered User
Posts: 198
Joined: Tue May 18, 2004 10:58 am

Suggestion

Post by Paddic »

For boards with many templates, especially with different background colors, one image may not be enough to please visually...

So, my suggestion is to replace every:

Code: Select all

$board_config['annual_stars']
with:

Code: Select all

str_replace('{TEMPLATE}', $template->root, $board_config['annual_stars'])

After that, you can use {TEMPLATE} in your star file path name, for example "{TEMPLATE}/images/star.gif" and have template specific graphics.
User avatar
okada1314
Registered User
Posts: 209
Joined: Sat Oct 29, 2005 10:51 am

Post by okada1314 »

the sql cannot work!!!
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

This MOD looks cool. I might install this, but only if you promise to make this for phpBB3 :D

Oh, and i'll wait until it's validated :)
cavallino
Registered User
Posts: 317
Joined: Thu Aug 04, 2005 7:06 am

Post by cavallino »

Hello, this mod doesn't work in my board... I don't know why :(

I have made all the changes, sql included of course... i uploaded the star.gif inside /images but nothing shows up! Neither in viewtopic... membership...or wherever should appear!

I think that the installation text file needs to be revised in some points anyway, for example:

Code: Select all

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

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

#
#-----[ BEFORE, ADD ]-------------------------------------
#
$term = floor ( (time() - $profiledata['user_regdate']) / (365 * 86400) );
$term_img = str_repeat('<img src="' . $board_config['annual_stars'] . '" border="0" title="' . $lang['Annual_stars'] . '" />', $term);
I have 2 different places in which that string appears.. one is

Code: Select all

$template->assign_vars(array(
	'USERNAME' => $username_color,
and the other

Code: Select all

$template->assign_vars(array(
		'PROFILE_TIME'		=> DisplayPlayingTime(2, $profiledata['ina_time_playing']),
before which one of these 2 i have to put the required code?
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: Suggestion

Post by drathbun »

Paddic wrote: So, my suggestion is to replace every:

...

After that, you can use {TEMPLATE} in your star file path name, for example "{TEMPLATE}/images/star.gif" and have template specific graphics.

Good idea, thanks. I never use more than one template, so that had not occurred to me. I will implement that change, or something like it that provides the same functionality.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

okada1314 wrote: the sql cannot work!!!

Why? There is nothing wrong with it. If you do not use "phpbb_" as your table prefix, then you must alter it to suit your installation. But the install instructions are written as required for the phpBB MOD Template, which says to use that prefix.

Code: Select all

insert into phpbb_config (config_name, config_value) values ('annual_stars', 'images/star.gif');
There is nothing wrong with that SQL code.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

cavallino wrote: I think that the installation text file needs to be revised in some points anyway, for example:

Code: Select all

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

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

#
#-----[ BEFORE, ADD ]-------------------------------------
#
$term = floor ( (time() - $profiledata['user_regdate']) / (365 * 86400) );
$term_img = str_repeat('<img src="' . $board_config['annual_stars'] . '" border="0" title="' . $lang['Annual_stars'] . '" />', $term);
I have 2 different places in which that string appears.. one is

Code: Select all

$template->assign_vars(array(
	'USERNAME' => $username_color,
and the other

Code: Select all

$template->assign_vars(array(
		'PROFILE_TIME'		=> DisplayPlayingTime(2, $profiledata['ina_time_playing']),
before which one of these 2 i have to put the required code?

Two points. First, if you "find" a string twice, you always act on the one that you find first starting from the last edit position. That's how EasyMOD works, and thats how the MOD installation instructions are written. The suggestion has been made to me several times by MOD Team members to prune the "find" strings down to the smallest possible length in order to support installs on heavily MODded boards. For that reason I checked to find the smallest amount of unique text that would still identify the insert position.

Second, the code that you pasted is from another MOD. The fact is, neither of the two lines of code you posted appear in a "standard" phpBB file. :-) If you look at a standard usercp_viewprofile.php file contents you will not find a second assign_vars string.

So once you get that straightened out, then perhaps we can try to figure out why the stars don't show up. Remember that you must have at least one member that has been registered for more than one year before anything appears... :-P
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

eviL<3 wrote: This MOD looks cool. I might install this, but only if you promise to make this for phpBB3 :D

No promises. ;-)
Oh, and i'll wait until it's validated :)

So with the Page Permissions MOD you dive right in, but a MOD that simply adds a tiny graphic to a couple of pages... that you don't trust me on. :lol: :-P
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
Disturbed One
Registered User
Posts: 129
Joined: Sun Apr 03, 2005 12:31 am

Post by Disturbed One »

drathbun wrote: 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.

Hello,

It was only 10:45 PM or so when I posted. GMT -8 :)
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

1.0.1 Update

Download link in first post updated
Download 1.0.1 ZIP

I included some extra star graphics (blue, green, and red) along with the original yellow star.gif. I also reduced the color depth, cutting the file size by 70% or more.

I also now use the template path and user selected style name as part of the image path. So you must now put the star.gif within the template folder. The copy command has been changed to

Code: Select all

#
#-----[ COPY ]-------------------------------------
#
copy star.gif to templates/subSilver/images/star.gif
Once this has been done, each of the php files must be edited to include the new location. A text file with update instructions from 1.0.0 to 1.0.1 is included in the download, shown here as well.

Code: Select all

# Update instructions 1.0.0 -> 1.0.1
# No template changes are required
# No admin panel code changes are required
# The changes involve adding the template path +
# the user selected theme name to the image path 
# location, also a new location for the star.gif

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

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

#
#-----[ FIND ]-------------------------------------
#
<img src="' . $board_config['annual_stars']

#
#-----[ IN-LINE FIND ]-------------------------------------
#
img src="

#
#-----[ IN-LINE AFTER, ADD ]-------------------------------------
#
templates/' . $theme['template_name'] . '/

#
#-----[ OPEN ]-------------------------------------
#
memberlist.php

#
#-----[ FIND ]-------------------------------------
#
<img src="' . $board_config['annual_stars']

#
#-----[ IN-LINE FIND ]-------------------------------------
#
img src="

#
#-----[ IN-LINE AFTER, ADD ]-------------------------------------
#
templates/' . $theme['template_name'] . '/

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

#
#-----[ FIND ]-------------------------------------
#
<img src="' . $board_config['annual_stars']

#
#-----[ IN-LINE FIND ]-------------------------------------
#
img src="

#
#-----[ IN-LINE AFTER, ADD ]-------------------------------------
#
templates/' . $theme['template_name'] . '/
Each of the IN-LINE AFTER, ADD commands adds the template path and the theme name to the image location. Each line should go from

Code: Select all

<img src="' . $board_config['annual_stars']
to

Code: Select all

<img src="templates/' . $theme['template_name'] . '/' . $board_config['annual_stars']
instead.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw »

drathbun wrote: So with the Page Permissions MOD you dive right in, but a MOD that simply adds a tiny graphic to a couple of pages... that you don't trust me on. :lol: :-P


Hehe, it's not about trust. It's more about last-second changes. As long as it's in here there might be little changes, that i don't want to hunt down. I'll rather wait until it's done, and then i don't have to worry about version chaos :D

Whee, i'm learning a little php now, so i might be making my own mods some time :)
User avatar
okada1314
Registered User
Posts: 209
Joined: Sat Oct 29, 2005 10:51 am

Post by okada1314 »

Image
Disturbed One
Registered User
Posts: 129
Joined: Sun Apr 03, 2005 12:31 am

Post by Disturbed One »

Hello,

That means you already have the field in the database. Do not worry about it.
User avatar
okada1314
Registered User
Posts: 209
Joined: Sat Oct 29, 2005 10:51 am

Post by okada1314 »

wait

i think is php problem


the php cannot detects sql !!
User avatar
okada1314
Registered User
Posts: 209
Joined: Sat Oct 29, 2005 10:51 am

Post by okada1314 »

Image
Locked

Return to “[2.0.x] MODs in Development”