Exreaction's Anniversary List

Post Reply

Topic author
JeRicHoOL
Valued Contributor
Posts: 53
Joined: 8. September 2008 14:02

Exreaction's Anniversary List

Post by JeRicHoOL »

I would like to have a block for the following mod.
This mod displays a list of users who have been registered for X years on the index.

So, for example, if I would have registered on January 25, 2000, I would show up on the list tomorrow (Jan 25, 2009) as EXreaction (9).
http://www.lithiumstudios.org/forum/vie ... =31&t=1114
User avatar

Mike
Former Team Member
Posts: 1862
Joined: 3. July 2008 23:59
Location: Schwarzwald / FDS
Contact:

Re: Exreaction's Anniversary List

Post by Mike »

As first: I neither give guarantee that this Mod works corrrectly, nor did I Support this Mod.
I only altered the install instructions to enable it in your Portal.

You dont need to download anything... Just follow this instructions.
This Mod is testet, and my Portal is still running ;)
If you dont see the Block, it is because you dont have any anniversarys. ;)

If you have trouble to install this Mod in your Portal, ask here. If you want to have Support for this Mod itself, ask the Autor (link above)

Backup your files, if anything goes wrong...


let's start...

Open: /language/en/mods/lang_portal.php

Find
Tip: This may be a partial find and not the whole line.

Code: Select all

$lang = array_merge($lang, array(
Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Code: Select all

	'ANNIVERSARY_LIST'	=> 'Anniversary List',

Create: anniversary.php
in: portal/block/

paste the following Content in this file

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: anniversary.php 325 2008-08-17 18:59:40Z kevin74 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

if (!defined('IN_PHPBB'))
{
   exit;
}

if (!defined('IN_PORTAL'))
{
   exit;
}
// Generate anniversary list
$anniversary_list = $cache->get('anniversary_list');
if ($anniversary_list === false)
{
    $anniversary_list = '';
    $current_date = date('m-d');
    $current_year = date('Y');
    $leap_year = date('L');
    $sql = 'SELECT user_id, username, user_colour, user_regdate
        FROM ' . USERS_TABLE . "
        WHERE user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
    $result = $db->sql_query($sql);

    while ($row = $db->sql_fetchrow($result))
    {
        // We are compensating for leap year here.  If the year is not a leap year, the current date is Feb 28, and they joined Feb 29 we will list their names.
        if (date('m-d', $row['user_regdate']) == $current_date || (!$leap_year && $current_date == '02-28' && date('m-d', $row['user_regdate']) == '02-29'))
        {
            if (($current_year - date('Y', $row['user_regdate'])) > 0)
            {
                $anniversary_list .= (($anniversary_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
                $anniversary_list .= ' (' . ($current_year - date('Y', $row['user_regdate'])) . ')';
            }
        }
    }
    $db->sql_freeresult($result);

    //Figure out what tomorrow's beginning time is based on the board timezone settings and have the cache expire then.
    $till_tomorrow = gmmktime(0, 0, 0) + 86400 - ($config['board_timezone'] * 3600) - ($config['board_dst'] * 3600) - time();
    $cache->put('anniversary_list', $anniversary_list, $till_tomorrow);
}
$template->assign_var('ANNIVERSARY_LIST', $anniversary_list); 
?>
Open: portal.php
Find
Tip: This may be a partial find and not the whole line.

Code: Select all

$template->assign_vars(array(
    'PORTAL_LEFT_COLUMN'     => $portal_config['portal_left_column_width'],
    'PORTAL_RIGHT_COLUMN'     => $portal_config['portal_right_column_width'],
)); 
Add before
Tip: Add these lines on a new blank line before the preceding line(s) to find.

Code: Select all

include($phpbb_root_path . 'portal/block/anniversary.'.$phpEx); 
for prosilver:
make a new Block in: styles/prosilver/template/portal/block/, called anniversary.html and paste in the following code:

Code: Select all

<!--version $Id: anniversary.html 236 2008-05-18 15:50:06Z kevin74 $ //-->
<div class="portal-panel">
	<div class="inner">
		<span class="portal-corners-top"><span></span></span>
			<h3><img src="{T_THEME_PATH}/images/portal/portal_birthday.gif" width="18px" height="15px" alt=""/>&nbsp;{L_ANNIVERSARY_LIST}</h3>
			<p>{L_CONGRATULATIONS}: <strong>{ANNIVERSARY_LIST}</strong></p>
		<span class="portal-corners-bottom"><span></span></span>
	</div>
</div>
<br style="clear:both" />
for subsilver2:
make a new Block in: styles/subsilver2/template/portal/block/, called anniversary.html and paste in the following code:

Code: Select all

<!--version $Id: anniversary.html 216 2008-04-29 07:23:22Z kevin74 $ //-->
<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<th><span style="float: left"><img src="{T_THEME_PATH}/images/portal/portal_birthday.png" width="16px" height="16px" alt="" />&nbsp;{L_ANNIVERSARY_LIST}</span></th>
	</tr>
	<tr class="row1">
		<td style="padding:5px 5px 5px 5px;">
			<div class="postbody">
                 <p>{L_CONGRATULATIONS}: <strong>{ANNIVERSARY_LIST}</strong></p>
			</div>
		</td>
	</tr>

</table>
<br clear="all" />
Open: portal_body.html

Find
Tip: This may be a partial find and not the whole line.

Code: Select all

<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
            <!-- INCLUDE portal/block/birthday_list.html -->
        <!-- ENDIF -->
Add after
Tip: Add these lines on a new blank line after the preceding line(s) to find.

Code: Select all

<!-- IF ANNIVERSARY_LIST -->
		    <!-- INCLUDE portal/block/anniversary.html -->
        <!-- ENDIF -->
Last edited by Mike on 12. February 2009 21:25, edited 7 times in total.
Reason: proper version
kein Support per PN / Messenger
no Support via PM / Messenger
User avatar

Mike
Former Team Member
Posts: 1862
Joined: 3. July 2008 23:59
Location: Schwarzwald / FDS
Contact:

Re: Exreaction's Anniversary List

Post by Mike »

Now i have an anniversary, and therefore i can say: it works perfectly ;)
anniversary.jpg
kein Support per PN / Messenger
no Support via PM / Messenger
Post Reply

Return to “Modification Requests”