Your ultimate PunBB resource!
You are not logged in.
Sorry for all the suggestions, I have heaps, so tell me to go away if you like! Not really things that are essential, but 'nice to haves'.
Probably not so relevant in geeky types of forums but it would be great to have a function where people can put their birthdays in their profile and when people have a birthday it either displays it in their details with the post count etc or at the bottom of the forum in a section in a group like users online etc. Make sense?! It would be cute with a little birthday cake icon.
Can you tell I am a chick? hahah...
Offline
BellyBelly wrote:
when people have a birthday it either displays it in their details with the post count etc or at the bottom of the forum in a section in a group like users online etc.
I would like to know how to put the day's calendar event(s) onto the forum's main page somewhere, too!
Rob
Offline
Yeah thats the main purpose of my request, so you can quickly and easily see who's birthday it is and pass on birthday wishes, than have to go through calandars or lists.
Offline
Hmm.. It's the same problem as with events. I am willing to look into it.
Only the my time is very limited the next few weeks and big changes will have to wait till PunBB 1.3
Offline
I also want plain and simple Birthday Mod, only to show on footer main page today's birthdays, nothing more...
Offline
I have a portal on my site with a birthday list block.
You can find the code below, see if it helps.
<?php
// Do not display if user not logged in
if(!$pun_user['is_guest'])
{
// include the Cache-Lite package
require_once(PUN_ROOT."include/cache/Lite.php");
// set some variables
$options = array(
"cacheDir" => "/tmp/Cache_Lite/",
"lifeTime" => 3600
);
// create a Cache_Lite object
$objCache = new Cache_Lite($options);
// test if there exists a valid cache,
// the <acronym>ID</acronym> will be the basename of the block
$blkfilename = __FILE__;
$fileid = basename($blkfilename,".php").'-'.$pun_user['language'];
if ($blkcontent = $objCache->get($fileid))
{
// add a message indicating this is cached output
$blkcontent .= "<!-- [".$options['lifeTime']."s cache] --> ";
}
else
{
// do the whole work here...
// Check if language file already loaded
if (!isset($lang_blk_birthdaylist))
// Attempt to load this page's language files
@include_once PUN_ROOT.'lang/'.$pun_user['language'].'/blk_birthdaylist.php';
@include PUN_ROOT.'lang/'.$pun_user['language'].'/profile.php';
@include PUN_ROOT.'lang/'.$pun_user['language'].'/calendar.php';
// Check if language files loaded successfully
if (!isset($lang_profile) || !isset($lang_calendar) || !isset($lang_blk_birthdaylist))
error('There is no valid language pack \''.$pun_user['language'].'\' installed. Please contact an administrator.', __FILE__, __LINE__);
$datetoday = date("Y-m-d",time());
$date = explode("-",$datetoday);
$year = intval($date['0']);
$month = intval($date['1']);
$day = (count($date)=='3')? intval($date['2']) : date("j");
// if the year length is short than add 20 to the front
if(strlen($year)=="2")
$year = "20".$year;
$blkcontent =
'<div class="block">'.
'<h2><span>'.$lang_blk_birthdaylist['blkBirthday List'].'</span></h2>'.
'<div class="box">'.
'<div id="birthdaylist" class="inbox">'.
'<ul>';
$result = $db->query('SELECT id, username, birthday, DAYOFMONTH(birthday) as day FROM '.$db->prefix.'users WHERE DAYOFMONTH(birthday) = '.$day.' AND MONTH(birthday) = '.$month.' ORDER BY username') or error('Unable to fetch birthday list', __FILE__, __LINE__, $db->error());
if($db->num_rows($result))
{
while($bday_list = $db->fetch_assoc($result))
{
list($bday_year,$bday_month,$bday_day) = explode('-', $bday_list['birthday']);
$age = (strlen($bday_year)!='4')? $lang_profile['Unknown']: $year-$bday_year;
$blkcontent .=
'<li><a href="profile.php?id='.$bday_list['id'].'">'.$bday_list['username'].'</a> - ('.$age.')</li>';
}
}
else
$blkcontent .=
'<li>'.$lang_calendar['No_Bday'].'</li>';
$blkcontent .=
'</ul>'.
'</div>'.
'</div>'.
'</div>';
// ...and save it in the cache for future use
$objCache->save($blkcontent, $fileid);
}
echo $blkcontent;
}
?>Offline
MrMister wrote:
I have a portal on my site with a birthday list block.
You can find the code below, see if it helps.
....
I think he meant a stand-alone mod - without having to install the Calendar mod.
DimOK wrote:
I also want plain and simple Birthday Mod, only to show on footer main page today's birthdays, nothing more...
It might be useful for some to have this as a stand-alone mod, so I decided to put something together. It includes parts of the code taken from the Calendar mod - with some small changes; and also some code I wrote a while ago that displays the birthdays in the board stats on the forum's main page.
Remember Birthday statistics will only be displayed when it is someone's birthday today. Also: make sure 'yes' is selected in the admin options for 'Users online'.
Screenshot
Download Birthday Mod-1.0
Offline
and how to add birthday mod to register.php
im try to add some code into register.php but
after i'm try to register
in Personal Page is not show my birthday
User must edit birthday again ![]()
thank.
Last edited by xper (2008-05-24 10:22:31)
Offline
xper wrote:
and how to add birthday mod to register.php
Making the following modifications will allow one to enter his/her date of birth when registering to your forum. Note that you should first install the Birthday Mod.
#
#---------[ 1. OPEN ]---------------------------------------------------------
#
lang/English/birthday.php
#
#---------[ 2. FIND (line: 4) ]---------------------------------------------
#
$lang_birthday = array(
#
#---------[ 3. AFTER, ADD ]---------------------------------------------------
#
// Registration
'Birthday legend' => 'Enter your date of birth',
'Birthday info' => 'Only enter day and month of birth if you want to hide your age.',
#
#---------[ 4. OPEN ]---------------------------------------------------------
#
register.php
#
#---------[ 5. FIND (line: 27) ]---------------------------------------------
#
require PUN_ROOT.'include/common.php';
#
#---------[ 6. AFTER, ADD ]---------------------------------------------------
#
require PUN_ROOT.'lang/'.$pun_user['language'].'/birthday.php';
#
#---------[ 7. FIND (line: 91) ]---------------------------------------------
#
$email1 = strtolower(trim($_POST['req_email1']));
#
#---------[ 8. AFTER, ADD ]---------------------------------------------------
#
// Setting birthday var for update
if(isset($_POST['bday_year']) && isset($_POST['bday_month']) && isset($_POST['bday_day']))
$birthday = $_POST['bday_year']."-".$_POST['bday_month']."-".$_POST['bday_day'];
else
$birthday = "0-0-0";
#
#---------[ 9. FIND (line: 206) ]---------------------------------------------
#
$db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
#
#---------[ 10. REPLACE WITH ]-------------------------------------------------
#
$db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit, birthday) VALUES(\''.$db->escape($username).'\', '.$intial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.', \''.$birthday.'\')') or error('Unable to create user', __FILE__, __LINE__, $db->error());
#
#---------[ 11. FIND (line: 905) ]---------------------------------------------
#
<div class="inform">
<fieldset>
<legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>
<div class="infldset">
#
#---------[ 12. BEFORE, ADD ]-------------------------------------------------
#
<div class="inform">
<fieldset>
<legend><?php echo $lang_birthday['Birthday legend'] ?></legend>
<div class="infldset">
<!---------------------------->
<!-- Start of Gizzmo's Code -->
<!-- justgiz@justgizzmo.com -->
<!---------------------------->
<label><?php echo $lang_birthday['Birthday info'] ?></label>
<div>
<select name="bday_month">
<option value="0" selected='selected'><?php echo $lang_birthday['Month'] ?></option>
<?php
$month_name = array('',$lang_birthday['January'],$lang_birthday['February'],$lang_birthday['March'],$lang_birthday['April'],$lang_birthday['May'],$lang_birthday['June'],$lang_birthday['July'],$lang_birthday['August'],$lang_birthday['September'],$lang_birthday['October'],$lang_birthday['November'],$lang_birthday['December']);
for($x=1;$x<13;$x++)
{
echo"\t\t\t\t\t\t\t\t\t<option value='".$x."'>".$month_name[$x]."</option>\n";
}
echo "\t\t\t\t\t\t\t\t\t</select>\n";
echo "\t\t\t\t\t\t\t\t\t<select name=\"bday_day\">\n";
echo "\t\t\t\t\t\t\t\t\t<option value='0' selected='selected'>".$lang_birthday['Day']."</option>";
for($x=01;$x<=31;$x++)
{
echo "\t\t\t\t\t\t\t\t\t<option value='".$x."'>".$x."</option>\n";
}
echo "'\t\t\t\t\t\t\t\t\t</select>\n";
echo "\t\t\t\t\t\t\t\t\t<select name=\"bday_year\">\n";
echo "\t\t\t\t\t\t\t\t\t<option value='0' selected='selected'>". $lang_birthday['Year'] ."</option>\n";
for($x=date("Y")-5; $x>date("Y")-110; $x--)
{
echo "\t\t\t\t\t\t\t\t\t<option value='".$x."'>".$x."</option>\n";
}
?>
</select>
</div>
<!------------------------->
<!-- End of Gizzmo's Code-->
<!------------------------->
</div>
</fieldset>
</div>
#
#---------[ 13. SAVE/UPLOAD ]-------------------------------------------------
#As I mentioned earlier: when it is nobody's birthday today, nothing will be displayed in the board stats. If you want to display a message saying: "No members are celebrating a birthday today", make the following changes:
#
#---------[ 1. OPEN ]---------------------------------------------------------
#
lang/English/birthday.php
#
#---------[ 2. FIND (line: 4) ]---------------------------------------------
#
$lang_birthday = array(
#
#---------[ 3. AFTER, ADD ]---------------------------------------------------
#
'Bdays_info' => 'No members are celebrating a birthday today',
#
#---------[ 4. OPEN ]---------------------------------------------------------
#
index.php
#
#---------[ 5. FIND (line: 224) ]---------------------------------------------
#
// list today's birthdays
if ($num_bdays_today > 0)
echo "\t\t\t".'<dl id="bdayslist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_birthday['Bdays_today'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $bdays_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<div class="clearer"></div>'."\n";
#
#---------[ 6. REPLACE WITH ]-------------------------------------------------
#
// list today's birthdays
if ($num_bdays_today > 0)
echo "\t\t\t".'<dl id="bdayslist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_birthday['Bdays_today'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $bdays_today).'</dd>'."\n\t\t\t".'</dl>'."\n";
else
echo "\t\t\t".'<dl id="bdayslist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_birthday['Bdays_today'].': </strong></dt>'."\t\t\t\t".$lang_birthday['Bdays_info'].'</dd>'."\n\t\t\t".'</dl>'."\n";
#
#---------[ 7. SAVE/UPLOAD ]-------------------------------------------------
#Offline