Author Topic: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile  (Read 27466 times)

0 Members and 1 Guest are viewing this topic.

Offline oswald

  • Newbie
  • *
  • Posts: 33
    • View Profile
Nettes Mod! :)
Waere wirklich super, wenn es jemand so erweitern koennte, das das system erkennt wann wer Geburtstag hat und dieser user dann irgendwo als "Geburtstagskind" angezeigt wird. Eventuell koennte man auch, wenn das Geburtstagskind selber auf die Seite kommt, einen gesonderten Glueckwunsch anzeigen lassen!? ... in Form eines Spruches oder eins Bildes.. kein Popup...

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #16 on: November 11, 2005, 06:58:55 PM »
hallo!
leider werden geburtsdaten vor dem 1.1.1970 bei mir nicht angezeigt. irgendwie scheint es mit dem unix timestamp zu tun zu haben.
hat jemand eine lösung?

----------------------------------------------------------

hello
unfortunately dates of birth before 1.1.1970 are not indicated, i think it's a problem with the unix timestamp.
any solution for me?

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #17 on: November 21, 2005, 06:05:41 AM »
Hi,

ich kenne mich da auch nicht so aus aber ich denke da musst du deinen Anbieter kontaktieren.

Bei mir werden auch Daten vor 1970 angezeigt.

Siehe hier !!!
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #18 on: November 21, 2005, 08:25:56 AM »
hmm... aber merkwürdiger weise wird es im acp richtig angezeigt... also auch vor 1970...  :?:

Offline Jako

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #19 on: November 21, 2005, 05:56:16 PM »
also wenn ich mich nicht irre funktioniert der mod nur für die v1.7

sollte es jemand bei der v1.7.1 zum laubfen bringen bitte bescheid sagen

Offline Darkness2001

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • photo-galerie-online
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #20 on: November 23, 2005, 12:56:12 PM »
also wenn ich mich nicht irre funktioniert der mod nur für die v1.7

sollte es jemand bei der v1.7.1 zum laubfen bringen bitte bescheid sagen

Hallo,

also ich habe alles soweit nochmals eingebaut und es funkt. auch unter v1.7.1

Hier das MOD:
User Age Mod Readme, Version 1.0 by NicNac for 4Images 4Images/lang/<yourlanguage>/main.php
Place at the end of the file, just before the closing tag (?>):

//-----------------------------------------------------
//--- User age ----------------------------------------
//-----------------------------------------------------
$lang['user_age'] = "[Age]";
$lang['user_birthday'] = "Birthday";
$lang['user_age_missing'] = "Not available";
$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",
);
4Images/includes/db_field.definitions.php
Place at the end of the file, just before the closing tag (?>):

//-----------------------------------------------------
//--- Additional fields for the user age --------------
//-----------------------------------------------------
$additional_user_fields['user_age_birthday'] = array($lang['user_age_birthday'], "text", 1);
4Images/includes/functions.php
Place at the end of the file, just before the closing tag (?>):

//-----------------------------------------------------
//--- User Age Mod ------------------------------------
//-----------------------------------------------------
function get_birthday($sql_date_string)
{
$birthday_array = array();

$birthday_array[0] = substr($sql_date_string, 0, 4);
$birthday_array[1] = substr($sql_date_string, 5, 2);
$birthday_array[2] = substr($sql_date_string, 8, 2);

return $birthday_array;
}
function get_age($year, $month, $day)
{
$age = 0;
$act_timestamp = getdate();

$age = $act_timestamp['year'] - $year;

if($month == $act_timestamp['mon'])
{
if($day > $act_timestamp['mday'])
{
--$age;
}
}
elseif($month > $act_timestamp['mon'])
{
--$age;
}

return $age;
}

function get_year()
{
$act_timestamp = getdate();
return $act_timestamp['year'];
}

4Images/member.php
Search for:

"lang_comments" => $lang['comments'],
"lang_email" => $lang['email'],
"lang_homepage" => $lang['homepage'],
"lang_icq" => $lang['icq']
Add after that:

//--- User Age Mod ------------------------------------
"lang_user_age" => $lang['user_age'],
"lang_user_birthday" => $lang['user_birthday']
//--- End of User Age Mod -----------------------------


Right after that, look for:

if (!empty($additional_user_fields)) {
$additional_field_array = array();
foreach ($additional_user_fields as $key => $val) {
$additional_field_array[$key] = (!empty($user_row[$key])) ? format_text($user_row[$key], 1) : REPLACE_EMPTY;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
and add directly after that:

//--- User Age Mod ------------------------------------
$birthday_array = array();

$birthday_array = get_birthday($additional_field_array['user_age_birthday']);
$birthday_array[3] = get_age($birthday_array[0], $birthday_array[1], $birthday_array[2]);

if($birthday_array[0] == "0000")
{
$site_template->register_vars(array(
"user_age_missing" => $lang['user_age_missing']
));
}
else
{
if($birthday_array[0] != "0000" && $birthday_array[1] != "00" && $birthday_array[2] != "00")
{
$birthday_timestamp = format_date($config['date_format'], strtotime($birthday_array[0] . "-" . $birthday_array[1] . "-" . $birthday_array[2]));
}
else
{
$birthday_timestamp = (($birthday_array[1] != "00") ? $lang['months'][$birthday_array[1]] . " " : "") . $birthday_array[0];
}

$site_template->register_vars(array(
"user_birthday" => $birthday_timestamp,
"user_age" => "[" . $birthday_array[3] . "]"
));
}
//--- End of User Age Mod -----------------------------


Search for:

$user_showemail = (isset($HTTP_POST_VARS['user_showemail'])) ? intval($HTTP_POST_VARS['user_showemail']) : 0;
$user_allowemails = (isset($HTTP_POST_VARS['user_allowemails'])) ? intval($HTTP_POST_VARS['user_allowemails']) : 0;
$user_invisible = (isset($HTTP_POST_VARS['user_invisible'])) ? intval($HTTP_POST_VARS['user_invisible']) : 0;
and add after that:

//--- User Age Mod ------------------------------------
$birthday = "";
($HTTP_POST_VARS['birthday_year'] != "00") ? $birthday .= $HTTP_POST_VARS['birthday_year'] : $birthday .= "0000";
($HTTP_POST_VARS['birthday_month'] != "00") ? $birthday .= "-" . $HTTP_POST_VARS['birthday_month'] : $birthday .= "-00";
($HTTP_POST_VARS['birthday_day'] != "00") ? $birthday .= "-" . $HTTP_POST_VARS['birthday_day'] : $birthday .= "-00";
//--- End of User Age Mod ------------------------------


Search for:

if (!$error) {
$additional_sql = "";
if (!empty($additional_user_fields)) {
$table_fields = $site_db->get_table_fields(USERS_TABLE);
foreach ($additional_user_fields as $key => $val) {
and add after that:

//--- User Age Mod ------------------------------------
if($key == "user_age_birthday")
{
$additional_sql .= ", $key = '" .$birthday . "'";
}
//--- End of User Age Mod -----------------------------


Right there, replace the following:

if(isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key]))
{
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
}
with this:

elseif(isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key]))
{
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
}


Search for:

"lang_new_password_confirm" => $lang['new_password_confirm'],
"lang_edit_profile_msg" => $edit_profile_msg,
"lang_yes" => $lang['yes'],
"lang_no" => $lang['no'],
and add after that:

//--- User Age Mod ------------------------------------
"lang_user_birthday" => $lang['user_birthday']
//--- End of User Age Mod -----------------------------


Search for:

else {
$value = (isset($HTTP_POST_VARS[$key])) ? htmlspecialchars(trim($HTTP_POST_VARS[$key])) : $user_info[$key];
}
$additional_field_array[$key] = $value;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
and add after that:

//--- User Age Mod ------------------------------------
$birthday_array = array();
$year_offset = 1900;

$birthday_array = get_birthday($additional_field_array['user_age_birthday']);
$birthday_dropdowns = array();
$act_year = get_year();

//The years dropdownbox
$birthday_dropdowns[0] .= "<option value=\"00\"" . (($birthday_array[0] == "00") ? " selected=\"selected\"" : "") . ">Year</option>\r\n";
$birthday_dropdowns[0] .= "<option value=\"00\">----------</option>\r\n";

for($year = $act_year; $year >= $year_offset; $year--)
{
if($year == $birthday_array[0])
{
$birthday_dropdowns[0] .= "<option value=\"" . $year . "\" selected=\"selected\">" . $year . "</option>\r\n";
}
else
{
$birthday_dropdowns[0] .= "<option value=\"" . $year . "\">" . $year . "</option>\r\n";
}
}

//The months
$birthday_dropdowns[1] .= "<option value=\"00\"" . (($birthday_array[1] == "00") ? " selected=\"selected\"" : "") . ">Month</option>\r\n";
$birthday_dropdowns[1] .= "<option value=\"00\">----------</option>\r\n";

for($month = 1; $month <= 12; $month++)
{
if($month == $birthday_array[1])
{
$birthday_dropdowns[1] .= "<option value=\"" . sprintf("%02d",$month) . "\" selected=\"selected\">" . $lang['months'][sprintf("%02d",$month)] . "</option>\r\n";
}
else
{
$birthday_dropdowns[1] .= "<option value=\"" . sprintf("%02d",$month) . "\">" . $lang['months'][sprintf("%02d",$month)] . "</option>\r\n";
}
}

//The days
$birthday_dropdowns[2] .= "<option value=\"00\"" . (($birthday_array[2] == "00") ? " selected=\"selected\"" : "") . ">Day</option>\r\n";
$birthday_dropdowns[2] .= "<option value=\"00\">----------</option>\r\n";

for($day = 1; $day <= 31; $day++)
{
if($day == $birthday_array[2])
{
$birthday_dropdowns[2] .= "<option value=\"" . sprintf("%02d",$day) . "\" selected=\"selected\">" . $day . "</option>\r\n";
}
else
{
$birthday_dropdowns[2] .= "<option value=\"" . sprintf("%02d",$day) . "\">" . $day . "</option>\r\n";
}
}

$site_template->register_vars(array(
"dropdown_year" => $birthday_dropdowns[0],
"dropdown_month" => $birthday_dropdowns[1],
"dropdown_day" => $birthday_dropdowns[2],
));
//--- End of User Age Mod -----------------------------
4Images/templates/<yourtemplate>/member_profile.html
Use this code to display each user's birthday:

<tr>
<td class="row1"><b>{lang_user_birthday}{lang_user_age}</b></td>
<td class="row1">{user_age_missing}{user_birthday} {user_age}</td>
</tr>
4Images/templates/<yourtemplate>/member_editprofile.html
Use these three boxes to allow user's to edit their birthdate:

<tr>
<td class="row1"><b>{lang_user_birthday}</b></td>
<td class="row1">
<select name="birthday_day" style="width:50px;">
{dropdown_day}
</select>
<select name="birthday_month" style="width:70px;">
{dropdown_month}
</select>
<select name="birthday_year" style="width:75px;">
{dropdown_year}
</select>
</td>
</tr>
user_age_install.php
And now please use the user_age_install.php file, after adding it to your root directory, to add the additional field to your MySQL Database.

Have Fun!
NicNac

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #21 on: November 23, 2005, 04:41:44 PM »
hallo!
ich werde es nachher dann nochmal versuchen..
eins fehlt:
Quote
user_age_install.php
And now please use the user_age_install.php file, after adding it to your root directory, to add the additional field to your MySQL Database.

wäre nett, wenn du die datei anhängen könntest.

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #22 on: November 24, 2005, 04:46:13 PM »
hallo!
ich habe den fehler wohl gefunden!
<td class="row1">{user_age_missing} {user_birthday} {user_age}</td>

muss heissen

<td class="row1">{user_age_missing} {user_age_birthday} {user_age}</td>
in der member_profile.html

dann geht es bei mir...
 

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #23 on: November 24, 2005, 06:59:49 PM »
i've a ideia..maybe lil complicate, it's create a "Today's Birthday" on main page. Where show who have born(birthday) today !

 8)

Offline Darkness2001

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • photo-galerie-online
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #24 on: December 02, 2005, 12:28:43 PM »
Hallo,

hat jemand eine Idee wie man(n) das Geb. Datum auf der home.html etc. einbauen kann mit dem Zusatz :

<tr>
<td class="row2">Happy Birthday User: </td>
</tr>
<tr>
<td class="row1">User xy</td>
</tr>
</table>


Grüße Darkness

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #25 on: December 02, 2005, 04:59:00 PM »
but that when you've just few users, when you've thousand thats very hard  check all ....... so i've asked for some hack for it , taken that from this MOD code ;)

Offline Darkness2001

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • photo-galerie-online
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #26 on: December 07, 2005, 10:18:43 AM »
Hi,

I think for search 20.000 user for birthday ist not problem, on other sites it's working fin.

Greez Darkness  :mrgreen:

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Geburtstag ins Userprofil einbinden ///date of birth into the userprofile
« Reply #27 on: December 07, 2005, 04:19:31 PM »
Hi,

I think for search 20.000 user for birthday ist not problem, on other sites it's working fin.

Greez Darkness  :mrgreen:


check 1 by one  8O i don't think  so....  will be more easy if we've some like ssi function (like smf forum) take this info without check 1 by 1 manually  8)