4images Modifications / Modifikationen > Mods & Plugins (Releases & Support)

[MOD] Birthday Mod v1.0

(1/29) > >>

IcEcReaM:
[ Introduction ]
With this Mod Users are able to input their birthday when registering or when updating their profile.
Fully configurable if
- birthday age also shown in profile next to birthday
- countdown to be shown in profile till next birthday
- if the birthday must be entered or is optional on registration/updating profile
- that todays birthdays are shown on index
- it's also possible to enter only day & month, then for year 0000 must be entered
- Birthday message can set when a user enters the site and has birthday (can be set on/off)

German:
Mit diesem Mod können User bei der Registrierung oder in ihren Einstellungen ihr Geburtstagsdatum eingeben.
Dieser Mod bietet verschiedene Einstellungsmöglichkeiten:
- einstellbar ob Alter im Profil auch angezeigt wird.
- einstellbarer Countdown bis zum nächsten Geburtstag im Profil
- einstellbar ob der Geburtstag eingegeben werden muss oder nur optional eingegeben werden kann.
- einstellbar ob die jeweilg heutigen Geburtstag auf der Indexseite erscheinen
- möglich nur Monat & Tag als Geburtstag einzugeben, dann muss für die Jahreseingabe "0000" eingegeben werden.
- wenn ein Geburtstagskind die Seite betritt kann eine Geburtstagsnachricht gesetzt werden.

Demo Link

[ Changed Files ]
includes/functions.php
includes/db_field_definitions.php
includes/session.php
register.php
index.php
member.php
templates/register_form.html
templates/member_profile.html
templates/member_editprofile.html
templates/home.html
admin/settings.php
lang/<your language>/admin.php
lang/<your language>/main.php

[ Installation ]

First Backup your Files

Step 1
Open register.php

Find

--- Code: ---$user_icq = (isset($HTTP_POST_VARS['user_icq'])) ? ((intval(trim($HTTP_POST_VARS['user_icq']))) ? intval(trim($HTTP_POST_VARS['user_icq'])) : "") : "";

--- End code ---
below insert

--- Code: ---  $user_birthday_day = (isset($HTTP_POST_VARS['user_birthday_day'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_day'])) : "";
  $user_birthday_month = (isset($HTTP_POST_VARS['user_birthday_month'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_month'])) : "";
  $user_birthday_year = (isset($HTTP_POST_VARS['user_birthday_year'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_year'])) : "";
 
--- End code ---

Find
--- Code: ---if ($user_password == "") {
--- End code ---
above insert

--- Code: ---    //Birthday Mod
    if (!$user_birthday = check_birthday($user_birthday_day,$user_birthday_month,$user_birthday_year,$config['birthday_required'])) {
      $msg .= (($msg != "") ?  "<br />" : "").$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $lang['birthday']), $lang['field_required']);
      $error = 1;
    }
--- End code ---

Find

--- Code: ---$activationkey = get_random_key(USERS_TABLE, get_user_table_field("", $user_table_fields['user_activationkey']));
--- End code ---
above insert


--- Code: ---    // Birthday Mod
    $additional_field_sql .= ", ".get_user_table_field("", "birthday");
    $additional_value_sql .= ", '$user_birthday'";
--- End code ---

Find

--- Code: ---$site_template->register_vars(array(
      "user_name" => htmlspecialchars(stripslashes($user_name)),
--- End code ---
above insert

--- Code: ---  $birthday_day_options = "<option value=\"\">--</option>\n";
  $birthday_month_options = "<option value=\"\">--</option>\n";

  for ($i=1;$i<=31;$i++){
    $birthday_day_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_day) ? "selected" : "").">".$i."</option>\n";

  }
  for ($i=1;$i<=12;$i++){                                                                                                                        //getmonth($i)
    $birthday_month_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_month) ? "selected" : "").">".$lang['months'][sprintf("%02d",$i)]."</option>\n";
  }
--- End code ---

Find

--- Code: ---"user_icq" => $user_icq,
--- End code ---
below insert

--- Code: ---      "birthday_day_options" => $birthday_day_options,
      "birthday_month_options" => $birthday_month_options,
      "user_birthday_year" => $user_birthday_year,
      "lang_day" => $lang['day'],
      "lang_month" => $lang['month'],
      "lang_year" => $lang['year'],
--- End code ---

Step 2
Open templates/register_form.html

Find

--- Code: ---          <tr>
            <td class="row1"><b>{lang_email}</b></td>
            <td class="row1"><input type="text" name="user_email" size="30" class="input" value="{user_email}" /></td>
          </tr>
--- End code ---
below insert

--- Code: ---<!--  Birthday Mod     -->
          <tr>
             <td class="row1"><b>{lang_birthday}</b></td>
             <td class="row1"><table>
                      <tr>
                          <td>{lang_day}</td>
                          <td>{lang_month}</td>
                          <td>{lang_year}</td>
                      </tr>

                      <tr>
                           <td><select name="user_birthday_day">{birthday_day_options} </select></td>
                           <td><select name="user_birthday_month">{birthday_month_options}</select></td>
                           <td><input class="input" name="user_birthday_year" value="{user_birthday_year}" maxlength="4" size="5" type="text">
                           </td>
                      </tr>

            </table></td>
           </tr>
<!--  Birthday Mod     -->
--- End code ---

Step 3

Open includes/db_field_definitions.php

Find

--- Code: ---?>
--- End code ---
above insert

--- Code: ---$additional_user_fields['birthday'] = array($lang['birthday'], "text", 0);
--- End code ---

Step 4

Open includes/session.php
Find


--- Code: ---"user_icq" => "user_icq"
--- End code ---
above insert

--- Code: ---"birthday" => "birthday",
--- End code ---


Step 5

Open member.php

Find


--- Code: ---      $user_email_button = REPLACE_EMPTY;
    }
--- End code ---
and replace with

--- Code: ---      $user_email_button = REPLACE_EMPTY;
    }
   
    // Birthday Mod
    $user_birthday = (isset($user_row[$user_table_fields['birthday']])) ? $user_row[$user_table_fields['birthday']] : REPLACE_EMPTY;
    if (!empty($user_birthday) && $user_birthday != REPLACE_EMPTY  && $user_row[$user_table_fields['birthday']] != "0000-00-00") {

           $birthday = explode("-",$user_row[$user_table_fields['birthday']]);
           $user_birthday = $birthday[2].".".$lang['months'][sprintf("%02d",$birthday[1])];
           $user_birthday .= ($birthday[0]!="0000") ? " ".$birthday[0]."" : "";
           
           // Show Age in Profile
           if (($config['birthday_show_profile_age'] == 1) && ($age = calc_age ($user_row[$user_table_fields['birthday']]))) {
                $user_birthday .= " ($age)";
           }
           
           // Show Birthdaycountdown in Profile
           if ($config['birthday_profile_countdown'] == 1 && $b_cdown = calc_countdown ($user_row[$user_table_fields['birthday']]))  {

                $site_template->register_vars(array(
                     "lang_birthday_cdown" => $lang['birthday_cdown'],
                     "cdown_days" => $b_cdown['days'],
                     "cdown_hours" => $b_cdown['hours'],
                     "cdown_minutes" => $b_cdown['minutes'],
                     "lang_days" => $lang['days'],
                     "lang_hours" => $lang['hours'],
                     "lang_minutes" => $lang['minutes']
                ));
           }
          // End Show Birthdaycountdown in Profile

    }
    else {
      $user_birthday = REPLACE_EMPTY;
    }
    // Birthday Mod
--- End code ---

Find


--- Code: ---"user_name" => (isset($user_row['user_name'])) ? htmlspecialchars($user_row['user_name']) : REPLACE_EMPTY,
--- End code ---
insert below

--- Code: ---"user_birthday" => $user_birthday,
--- End code ---

Find


--- Code: ---$user_invisible = (isset($HTTP_POST_VARS['user_invisible'])) ? intval($HTTP_POST_VARS['user_invisible']) : 0;
--- End code ---
insert below

--- Code: ---  $user_birthday_day = (isset($HTTP_POST_VARS['user_birthday_day'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_day'])) : "";
  $user_birthday_month = (isset($HTTP_POST_VARS['user_birthday_month'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_month'])) : "";
  $user_birthday_year = (isset($HTTP_POST_VARS['user_birthday_year'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['user_birthday_year'])) : "";

--- End code ---

directly at the same place after


--- Code: ---$error = 0;
--- End code ---
insert below

--- Code: ---  if (!$user_birthday = check_birthday($user_birthday_day,$user_birthday_month,$user_birthday_year,$config['birthday_required'])) {
     $msg .= (($msg != "") ? "<br />" : "").$lang['birthday_error'];
     $error = 1;
  }
--- End code ---

Find

--- Code: ---      $table_fields = $site_db->get_table_fields(USERS_TABLE);
      foreach ($additional_user_fields as $key => $val) {
        if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
          $additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
        }
      }
    }
--- End code ---
below insert

--- Code: ---    // Birthday Mod
    $additional_sql .= ", ".get_user_table_field("", "birthday")." = '$user_birthday'";

--- End code ---

Find

--- Code: ---    $user_icq = $user_info['user_icq'];
  }
--- End code ---
and replace with

--- Code: ---    $user_icq = $user_info['user_icq'];
      $birthday = explode("-",$user_info['birthday']);
    $user_birthday_day = $birthday[2];
    $user_birthday_month = $birthday[1];
    $user_birthday_year = $birthday[0];
  }

  $birthday_day_options = "<option value=\"\">--</option>\n";
  $birthday_month_options = "<option value=\"\">--</option>\n";

  for ($i=1;$i<=31;$i++){
    $birthday_day_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_day) ? "selected" : "").">".$i."</option>\n";

  }
  for ($i=1;$i<=12;$i++){                                                                                                                        //getmonth($i)
    $birthday_month_options .= "<option value=\"".sprintf("%02d",$i)."\"".(($i == $user_birthday_month) ? "selected" : "").">".$lang['months'][sprintf("%02d",$i)]."</option>\n";
  }
--- End code ---

Find

--- Code: ---"user_homepage" => htmlspecialchars(stripslashes($user_homepage)),
--- End code ---
below insert

--- Code: ---    "birthday_day_options" => $birthday_day_options,
    "birthday_month_options" => $birthday_month_options,
    "user_birthday_year" => $user_birthday_year,
    "lang_day" => $lang['day'],
    "lang_month" => $lang['month'],
    "lang_year" => $lang['year'],
--- End code ---

Step 6

Open templates/member_profile.html

Find

--- Code: ---        <tr>
          <td class="row2"><b>{lang_icq}</b></td>
          <td class="row2">{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
        </tr>
--- End code ---
below insert

--- Code: ---        <tr>
          <td class="row1"><b>{lang_birthday}</b></td>
          <td class="row1">{if user_birthday}{user_birthday}{endif user_birthday}</td></td>
        </tr>
        {if cdown_days}
        <tr>
          <td class="row2"><b>{lang_birthday_cdown}</b></td>
          <td class="row2">{cdown_days} {lang_days} {cdown_hours} {lang_hours} {cdown_minutes} {lang_minutes} </td></td>
        </tr>
        {endif cdown_days}
--- End code ---


Step 7

Open templates/member_editprofile.html

Find

--- Code: ---           <tr>
            <td class="row2"><b>{lang_icq}</b></td>
            <td class="row2"><input type="text" name="user_icq"  size="30" value="{user_icq}" class="input" /></td>
          </tr>
--- End code ---
insert below


--- Code: ---          <tr>
             <td class="row1"><b>{lang_birthday}</b></td>
             <td class="row1"><table>
                      <tr>
                          <td>{lang_day}</td>
                          <td>{lang_month}</td>
                          <td>{lang_year}</td>
                      </tr>

                      <tr>
                           <td><select name="user_birthday_day">{birthday_day_options}</select></td>
                           <td><select name="user_birthday_month">{birthday_month_options}</select></td>
                           <td><input class="input" name="user_birthday_year" value="{user_birthday_year}" maxlength="4" size="5" type="text"></td>
                      </tr>

            </table></td>
           </tr>
--- End code ---

Step 8

Open includes/functions.php

Search at the bottom

--- Code: ---?>
--- End code ---
and above insert

--- Code: ---function check_birthday($birthday_day = "", $birthday_month = "", $birthday_year = "", $valid = 0) {
  $error = 0;
  if($birthday_day && $birthday_month && $birthday_year) {
      switch(strlen($birthday_year)) {
      case 2:
          $birthday_year = "19$birthday_year";
          break;
      case 4:
          break;
      default:
        $birthday_year = "0000";
        if ($valid) $error = 1;
        break;
      }
   $birthday = "$birthday_year-$birthday_month-$birthday_day";
   }
   else {
       $birthday = "0000-00-00";
       $error = 1;
   }
   if ($valid == 1 && ($error || (!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $birthday)))) return false;
   else return $birthday;
}

function calc_age ($birthday = "") {
    $user_birthday = explode("-",$birthday);
    if ($user_birthday[0]!= "0000" && $user_birthday) {
      $today = getdate (time());
      $age = ($today['year'] - $user_birthday[0]);
      if ($age > 0 )  {
      $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']);
      $birthday_thisyear = getdate ($birthday_thisyear_var);
      if ($birthday_thisyear['yday']>$today['yday']) $age--;
      return $age;
      }
      else return false;
    }
}

function calc_countdown ($birthday = "") {
    $user_birthday = explode("-",$birthday);
    if ($user_birthday[1] != "00" && $user_birthday[2] != "00") {
      $today = getdate (time());
      $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']);
      $birthday_thisyear = getdate ($birthday_thisyear_var);
      if ($birthday_thisyear['yday']<=$today['yday']) $birthday_thisyear_var = mktime(0,0,0,$user_birthday[1],$user_birthday[2],$today['year']+1);
      $difference = $birthday_thisyear_var - time();
      if ($difference < 0) $difference = 0;
      $dleft = floor($difference/60/60/24);
      $hleft = floor(($difference - $dleft*60*60*24)/60/60);
      $mleft = floor(($difference - $dleft*60*60*24 - $hleft*60*60)/60);
$return = array(
'days'=>$dleft,
'hours'=>$hleft,
'minutes'=>$mleft,
);
return $return;
    }
    else return false;
}


--- End code ---

Step 9

Open admin/settings.php

Find the last line that is like
show_table_separator($setting_group[9], 2, "#setting_group_9");
and notice the number, and then add  1
e.g. if the highest number you can find is $setting_group[9] then the next number will be 10
You need that number to replace it for the XX in the next 2 instructions.

Find

--- Code: ---show_form_footer($lang['save_changes'], "", 2);
--- End code ---
above insert

--- Code: ---  //Birthday Mod
  show_table_separator($setting_group[XX], 2, "#setting_group_XX");
  show_setting_row("birthday_required", "radio");
  show_setting_row("birthday_show_profile_age", "radio");
  show_setting_row("birthday_index", "radio");
  show_setting_row("birthday_profile_countdown", "radio");
  show_setting_row("birthday_message", "radio");
  //Birthday Mod
--- End code ---

Don't forget to replace the XX with the number mentioned above.

Step 10

Open lang/<your language>/admin.php
Find

--- Code: ---?>
--- End code ---
insert above

--- Code: ---/*-- Setting-Group XX --*/   // Birthday Mod
$setting_group[XX]="Birthday Config";
$setting['birthday_required'] = "Must be entered a birthday?";
$setting['birthday_show_profile_age'] = "Show also Age in Profile?";
$setting['birthday_index'] = "Show on Index Users have birthday today";
$setting['birthday_profile_countdown'] = "Show Time till next birthday in profile";
$setting['birthday_message'] = "Show Birthday Message on Index (when user has B-Day)";

--- End code ---

or in German

--- Code: ---/*-- Setting-Group XX --*/   // Birthday Mod
$setting_group[XX]="Geburtstags Mod Einstellung";
$setting['birthday_required'] = "Ist der Geburtstag eine Pflichtangabe?";
$setting['birthday_show_profile_age'] = "Alter im Profil anzeigen?";
$setting['birthday_index'] = "Zeige auf der Index die heutigen Geburtstage an";
$setting['birthday_profile_countdown'] = "Geburtstagscountdown im Profil";
$setting['birthday_message'] = "Geburtstagsgruss auf der Index zeigen (für User die Geb. haben)";

--- End code ---

Don't forget to replace the XX with the number mentioned above.


Step 11

Open index.php

Find

--- Code: ---//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
--- End code ---
above insert:

--- Code: ---// Birthday Mod  Start Events
if($config['birthday_message'] == 1)  {
    $user_birthday = explode("-",$user_info[$user_table_fields['birthday']]);
    if (($user_birthday[1] == date ("m", time())) && ($user_birthday[2] == date ("d", time()))) {
         $birthday_message = $site_template->parse_template("birthday_message");
         $site_template->register_vars(array(
                      "birthday_message" => $birthday_message
              ));
    }
}
if($config['birthday_index'] == 1)  {
 $currentdate = date("m-d", time());
 
$sql = "SELECT ".get_user_table_field("", "user_id").", ".get_user_table_field("", "user_name").", ".get_user_table_field("", "birthday")."
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "birthday")." LIKE '%-$currentdate'
          ORDER BY ".get_user_table_field("", "user_name");
$result = $site_db->query($sql);

$birthday_list = "";
   while($row = $site_db->fetch_array($result)) {
        $age = calc_age($row[$user_table_fields['birthday']]);
        $birthday_list .= ($birthday_list) ? ", " : "";
        $birthday_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row[$user_table_fields['user_id']])."\">".$row[$user_table_fields['user_name']]."</a> (".$age.")";
    }
 
$site_template->register_vars(array(
  "lang_events" => $lang['events'],
  "birthday_list" => $birthday_list,
  "lang_congratulate" => $lang['congratulate']
   ));
}
--- End code ---

Step 12

Open templates/home.html

Find

--- Code: ---{if categories}

--- End code ---

insert above

--- Code: ---                   {if birthday_message}{birthday_message}{endif birthday_message}

--- End code ---


Find

--- Code: ---   {whos_online}
  <br />

--- End code ---
insert below

--- Code: ---<!--  Start Events   -->
{if birthday_list}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td >
      <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
        <tr>
          <td valign="top" class="head1">
            <table width="100%" border="0" cellpadding="4" cellspacing="2">
              <tr>
                <td class="head1" valign="top">{lang_events}</td>
              </tr>
            </table></td>
        </tr>

        <tr>
          <td valign="top" >
              <table  width="100%" border="0" cellpadding="4" cellspacing="1" width="98%">
              <tr>
                <td width="40" class="catbgcolor"><img src="{template_url}/images/birthday_baloon.gif" alt=""></td>
                <td class="catbgcolor"><b>{lang_congratulate}</b><br>{birthday_list}</td>
              </tr>
            </table></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<br />
{endif birthday_list}
<!--  End Events   -->
--- End code ---

Step 12

Open lang/<your language>/main.php
Find

--- Code: ---?>
--- End code ---
insert above

--- Code: ---//-----------------------------------------------------
//--- Birthday Mod ---------------------------------------
//-----------------------------------------------------

$lang['days'] = "day(s)";
$lang['hours'] = "hour(s)";
$lang['minutes'] = "minute(s)";
$lang['day'] = "day";
$lang['month'] = "month";
$lang['year'] = "year";
$lang['birthday'] = "Birthday:";
$lang['birthday_cdown'] = "Time till next Birthday:";
$lang['birthday_error'] = "Please enter correct birthday";
$lang['months'] = array(
"01" => "January",
"02" => "February",
"03" => "March",
"04" => "April",
"05" => "May",
"06" => "June",
"07" => "July",
"08" => "August",
"09" => "September",
"10" => "October",
"11" => "November",
"12" => "December",
);
$lang['events'] = "Actual Events:";
$lang['congratulate'] = "Congratulations to Birthday:";


--- End code ---

or in German /Deutsch:

--- Code: ---//-----------------------------------------------------
//--- Birthday Mod ---------------------------------------
//-----------------------------------------------------

$lang['days'] = "Tag(e)";
$lang['hours'] = "Stunde(n)";
$lang['minutes'] = "Minute(n)";
$lang['day'] = "Tag";
$lang['month'] = "Monat";
$lang['year'] = "Jahr";
$lang['birthday'] = "Geburtstag:";
$lang['birthday_cdown'] = "Zeit bis zum nchsten Geburtstag:";
$lang['birthday_error'] = "Korrektes Geburtstagsdatum eintragen";
$lang['months'] = array(
"01" => "Januar",
"02" => "Februar",
"03" => "M&auml;rz",
"04" => "April",
"05" => "Mai",
"06" => "Juni",
"07" => "Juli",
"08" => "August",
"09" => "September",
"10" => "Oktober",
"11" => "November",
"12" => "Dezember",
);
$lang['events'] = "Actual Events:";
$lang['congratulate'] = "Congratulations to Birthday:";


--- End code ---

an dutch langauge file can be found here:
dutch translation

Step 12

Execute the install_birthday.php on your root directory and then delete it.

Step 13
the birthday_baloon.gif must be placed in your templates/<your template folder>/images

Step 14
Upload birthday_message.html in your templates/<your templates/

You can modify your Birthday Message in that template to customize it.

Finished!



For Users that using other mods like these and wont delete the old entries of their user's birthday can use the old database entries if
the entries are given in the format like xxxx-xx-xx  (year-month-day).
That means if in USERS TABLE the field for the birthday entries are saved in DATE Format can use their entries with this mod,
by making some changes.

Here the instructions:
Just replace the value "birthday" with your db field name.

In Step 3

--- Code: ---$additional_user_fields['birthday']
--- End code ---
Instead of birthday use your db filed name

In Step 4

--- Code: ---"birthday" => "birthday",
--- End code ---
Instead of => "birthday"  use your db filed name

Edit the birthday_install.php
delete the line

--- Code: ---"ALTER TABLE `".USERS_TABLE."` ADD `birthday` DATE DEFAULT '0000-00-00' NOT NULL"
--- End code ---

Thats all.

I've tested the mod on a fresh & clean 4images installation.



Additional Options / show asterisk (Sternzeichen):
If you want that the asterisk (german: Sternzeichen) should be displayed next to birthday in profile,
follow these steps.

Open includes/functions.php
Search for
--- Code: ---?>
--- End code ---
insert above

--- Code: ---function sternzeichen($tag, $monat) {
    $sternzeichen = array(
        array(mktime(0, 0, 0, 1, 1, date('Y')), mktime(0, 0, 0, 1, 20, date('Y')), 1),
        array(mktime(0, 0, 0, 1, 21, date('Y')), mktime(0, 0, 0, 2, 19, date('Y')), 2),
        array(mktime(0, 0, 0, 2, 20, date('Y')), mktime(0, 0, 0, 3, 20, date('Y')), 3),
        array(mktime(0, 0, 0, 3, 21, date('Y')), mktime(0, 0, 0, 4, 20, date('Y')), 4),
        array(mktime(0, 0, 0, 4, 21, date('Y')), mktime(0, 0, 0, 5, 21, date('Y')), 5),
        array(mktime(0, 0, 0, 5, 22, date('Y')), mktime(0, 0, 0, 6, 21, date('Y')), 6),
        array(mktime(0, 0, 0, 6, 22, date('Y')), mktime(0, 0, 0, 7, 22, date('Y')), 7),
        array(mktime(0, 0, 0, 7, 23, date('Y')), mktime(0, 0, 0, 8, 23, date('Y')), 8),
        array(mktime(0, 0, 0, 8, 24, date('Y')), mktime(0, 0, 0, 9, 23, date('Y')), 9),
        array(mktime(0, 0, 0, 9, 24, date('Y')), mktime(0, 0, 0, 10, 23, date('Y')), 10),
        array(mktime(0, 0, 0, 10, 24, date('Y')), mktime(0, 0, 0, 11, 22, date('Y')), 11),
        array(mktime(0, 0, 0, 11, 23, date('Y')), mktime(0, 0, 0, 12, 21, date('Y')), 12),
        array(mktime(0, 0, 0, 12, 22, date('Y')), mktime(0, 0, 0, 12, 31, date('Y')), 1)
    );

    foreach ($sternzeichen as $value) {
        if ((mktime(0, 0, 0, intval($monat), intval($tag), date('Y')) >= $value[0]) && (mktime(0, 0, 0, $monat, $tag, date('Y')) <= $value[1])) {
            return $value[2];
        }
    }
    return false;
}
--- End code ---

Open lang/<your language>/main.php
Search for
--- Code: ---?>
--- End code ---
insert above

--- Code: ---$lang['asterisk'] = "Sternzeichen";
$lang['asterisks'] = array(
  1 => "Steinbock",
       "Wassermann",
       "Fische",
       "Widder",
       "Stier",
       "Zwillinge",
       "Krebs",
       "Löwe",
       "Jungfrau",
       "Waage",
       "Skorpion",
       "Schütze",
       "Steinbock"
);
--- End code ---

Open templates/member_profile.html
Search for
--- Code: ---{user_birthday}
--- End code ---

replace it with

--- Code: ---{user_birthday} {sternzeichen}
--- End code ---
Note: you can insert {sternzeichen} anywhere you want in that template wherever it should be displayed

Open member.php
Search for

--- Code: ---// End Show Birthdaycountdown in Profile
--- End code ---
replace it with

--- Code: ---          // End Show Birthdaycountdown in Profile
          $sternzeichen = sternzeichen($birthday[2], $birthday[1]);
--- End code ---

search for

--- Code: ---      "user_birthday" => $user_birthday,
--- End code ---
and replace it with

--- Code: ---      "user_birthday" => $user_birthday,
      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." "  : "",
--- End code ---

If you want, that also the asteriks images are displayes next to birthday.
Create in your templates/<your templates>/images/ folder an new folder named sternzeichen
--> templates/<your templates>/images/sternzeichen
There you should place 12 images named from 1.jpg to 12.jpg,
which are the corresponding images like the asterisk.
you can find some images attached. thx to trez for these images.
Here you can find also some from Loda



you should use following code instead

--- Code: ---      "user_birthday" => $user_birthday,
      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." "  : "",
--- End code ---
user following

--- Code: ---      "sternzeichen" => ($sternzeichen) ? " &nbsp;&nbsp;".$lang['asterisk']." : ".$lang['asterisks'][$sternzeichen]." <img src=\"".TEMPLATE_PATH."/images/sternzeichen/".$sternzeichen.".jpg\" alt=\"".$lang['asterisks'][$sternzeichen]."\">"  : "",
--- End code ---

finished!

P.S.: Maybe someone can translate the asteriks language into english.


17.02. Added additonal option

@German Users: check your language/<your language>/main.php
I did a correction above, cause "03" => "M&auml;", should be like this "03" => "M&auml;rz",
Otherwise only Mä is displayed instead of März.
Corrected above.


Installer and needed files are attached.
You can also download it from here: Link
Just log in as 4images/4images.
Of course you can also create your own account (no email verification is needed, cause its an testboard).
Demo can be also seen there.

mawenzi:
... very nice MOD ... especially the birthday countdown ... and the birthday_baloon ...  :wink:
... a very good and clear presentation ...
... thanks for it ...

mawenzi

Loda:
WOW!
thank you very much for this great mod! works perfekt!
only the installation file don't work for me and so i made it manuell.

insane:
whats the db field name?
where can i find it?
do i have to do all again? (i already executed the birthday_install.php)

TheOracle:

--- Quote ---
// Birthday Mod
    $additional_sql .= ", ".get_user_table_field("", "birthday")." = '$user_birthday'";


--- End quote ---

I have been told recently that the get_user_table_field function only complys with the core fields within the USERS_TABLE and not on additional user fields. ;)

Meaning, the above should be changed to :


--- Code: ---
// Birthday Mod
    $additional_sql .= ", birthday" = ".$user_birthday;


--- End code ---

;)

In the mean time, could we see a screenshot of this presentation ? ;)

Navigation

[0] Message Index

[#] Next page

Go to full version