Birthday cake

Lynx

Пользователь
MOD Title: Birthday Cake (Birthday MOD add-on)
MOD Author: evil3 < [email protected] > (Igor Wiedler)

Please Login or Register to view hidden text.


Adapted for TorrentPier R775 modern by Demetri (Dmitrit Y. Mayer)
Adapted for TorrentPier II by Lynx
MOD Description: Display a birthday cake in viewtopic if the user has birthday.
Installation Level: Easy
Installation Time: ~3-5 Minutes
Files To Edit:
## viewtopic.php
## templates/default/tpl_config.php
## language/lang_russian/lang_main.php
## language/lang_english/lang_main.php
## templates/default/viewtopic.tpl
Included Files:
## templates/default/images/icon_birthday.gif
License:

Please Login or Register to view hidden text.

GNU General Public License v2

Поскольку мод даты рождения встроен в движок, установка данного мода не требует дополнительных условий.

icon_birthday.gif


#
#-----[ COPY ]---------------------------------------------
#
icon_birthday.gif to templates/default/images/icon_birthday.gif

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


#
#-----[ FIND ]---------------------------------------------
#
PHP:
            //
    // Generate ranks, set them to empty string initially.
    //
    $poster_rank = $rank_image = '';
    $gender_image = '';
#
#-----[ AFTER, ADD ]---------------------------------------------
#
PHP:
      // Birthday Cake
      $poster_birthdate = '';
      // Birthday Cake [END]
#
#-----[ FIND ]---------------------------------------------
#
PHP:
'POSTER_NAME'        => profile_url(array('username' => $poster, 'user_rank' => $user_rank)),
#
#-----[ AFTER, ADD ]---------------------------------------------
#
PHP:
        // Birthday Cake   
        'BIRTHDAY_TODAY'    => (isset($poster_birthdate)) ? (($this_date == $poster_birthdate) ? true : false ) : false,
        'BIRTHDAY_CAKE_IMG'  => '<img src="' . $images['icon_birthday'] . '" alt="' . $lang['Birthday_Cake'] . '" title="' . $lang['Birthday_Cake'] . '" align="top" border="0" />',
        'L_BIRTHDAY_TODAY'  => $lang['Birthday_Cake'],   
        // Birthday Cake [END]
#
#-----[ OPEN ]---------------------------------------------
#
templates/default/tpl_config.php
#
#-----[ FIND ]---------------------------------------------
#
PHP:
// post_buttons
$images['icon_quote']          = $_lang .'icon_quote.gif';

#
#-----[ BEFORE, ADD ]---------------------------------------------
#

PHP:
// Birthday Cake
 
$images['icon_birthday'] = $_main .'icon_birthday.gif';
 
// Birthday Cake [END]

#
#-----[ OPEN ]---------------------------------------------
#
language/lang_russian/lang_main.php
#
#-----[ FIND ]---------------------------------------------
?>
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
PHP:
//
// Birthday Cake
//
$lang['Birthday_Cake'] = 'С Днем Рождения!';
//
// Birthday Cake [END]
//
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]---------------------------------------------
?>
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
PHP:
//
// Birthday Cake
//
$lang['Birthday_Cake'] = 'Happy Birthday!';
//
// Birthday Cake [END]
//
#
#-----[ OPEN ]---------------------------------------------
#
templates/default/viewtopic.tpl
#
#-----[ FIND ]---------------------------------------------
#
HTML:
<p><img src="{SPACER}" width="{TOPIC_LEFT_COL_SPACER_WITDH}" height="<!-- IF postrow.POSTER_AVATAR || postrow.RANK_IMAGE -->2<!-- ELSE -->30<!-- ENDIF -->" border="0" alt="" /></p>
#
#-----[ BEFORE, ADD ]---------------------------------------------
#
HTML:
        <!-- Birthday Cake -->
        <!-- IF postrow.BIRTHDAY_TODAY --><center><br /><br /><p class="birthdaycake">{postrow.BIRTHDAY_CAKE_IMG}<br>{postrow.L_BIRTHDAY_TODAY}<br /></p></center><!-- ENDIF -->   
        <!-- Birthday Cake [END] -->

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

Lynx

Пользователь
Gemini_13, чем заменить переменную $this_date? Вылез нотис:
Notice: Undefined variable: this_date in /var/www/lynx/data/www/***/viewtopic.php on line 1310

PHP:
'BIRTHDAY_TODAY'    => (isset($poster_birthdate)) ? (($this_date == $poster_birthdate) ? true : false ) : false,
 

PheRum

Легенда
интересно, что он должен показать по такому условию?
'BIRTHDAY_TODAY' => (isset($poster_birthdate)) ? (($this_date == $poster_birthdate) ? true : false ) : false,
 

Lynx

Пользователь
Теперь торт выводится у всех юзеров не зависимо от того, какая дата рождения у них указана. Блин, где-то накосячил, пытаюсь выяснить.

birthday_cake.png
 

Lynx

Пользователь
Добавил вот это:
PHP:
$this_date = bb_date('md', time(), $bb_cfg['board_timezone']);
Нотис исчез, но и торт пропал. Ещё чего-то не хватает...:D
 
Сверху