PEAK XOOPS - piCal Plugin for membership module in englishin japanese

piCal Plugin for membership module

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2005/9/9 3:25
sophistry  ÆóÅùʼ   Posts: 1
Thanks for an amzaing module GIJOE!

NOTE: This plugin file is for the membership module not the default system members module. Search Xoops modules repository for membership.

You can add this to your plugins to allow birthdays that are entered into membership to display in piCal. For extra points... add an image called dot_cake.gif to the piCal module images/default directory (next to the other dot_ gifs and then choose it in the Plugins manager to get a nice birthday cake icon.

Enjoy!

<?php
	// DEC 20050908
	// a plugin for membership that extracts birthdays
	// based on mylinks plugin
	//print_r("HEY");
	if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;

	/*
		$db : db instance
		$myts : MyTextSanitizer instance
		$this->year : year
		$this->month : month
		$this->user_TZ : user's timezone (+1.5 etc)
		$this->server_TZ : server's timezone (-2.5 etc)
		$tzoffset_s2u : the offset from server to user
		$now : the result of time()
		$plugin = array('dirname'=>'dirname','name'=>'name','dotgif'=>'*.gif')
		$just1gif : 0 or 1
		
		$plugin_returns[ DATE ][]
	*/
//print_r("HEY");
	// set range (added 86400 second margin "begin" & "end")
	//$range_start_s = date("Y-m-d", mktime(0,0,0,$this->month,0,$this->year) ) ;
	//$range_end_s = date("Y-m-d",mktime(0,0,0,$this->month+1,1,$this->year) );
	
	// setting absurd range allows all member's birthdays to show in every year
	$range_start_s = "1904-01-01";
	$range_end_s = "2030-01-01";
	//print_r($range_start_s . "<BR>");
	//print_r($range_end_s);
	// query (added 86400 second margin "begin" & "end")
	$result = $db->query( "SELECT lastname,uid,birth_date FROM ".$db->prefix("membership_info")." WHERE birth_date >= '$range_start_s' AND birth_date < '$range_end_s'" ) ;
	
	//$result = $db->query( "SELECT lastname,uid,birth_date FROM ".$db->prefix("membership_info")." WHERE birth_date >= $range_start_s AND birth_date < $range_end_s" ) ;
	//print_r(var_export($result,TRUE));
	while( list( $lastname , $id , $server_time ) = $db->fetchRow( $result ) ) {
		//print_r($server_time);
		$server_time = strtotime($server_time);
		$user_time = $server_time + $tzoffset_s2u ;
		
		if( date( 'n' , $user_time ) != $this->month ) continue ;
		$target_date = date('j',$user_time) ;
		$tmp_array = array(
			'dotgif' => $plugin['dotgif'] ,
			'dirname' => $plugin['dirname'] ,
			'link' => XOOPS_URL."/modules/{$plugin['dirname']}/memb_user.php?uid=$id" ,
			'id' => $id ,
			'server_time' => $server_time ,
			'user_time' => $user_time ,
			'name' => 'lastname' ,
			'title' => $myts->makeTboxData4Show( $lastname )
		) ;
		if( $just1gif ) {
			// just 1 gif per a plugin & per a day
			$plugin_returns[ $target_date ][ $plugin['dirname'] ] = $tmp_array ;
		} else {
			// multiple gifs allowed per a plugin & per a day
			$plugin_returns[ $target_date ][] = $tmp_array ;
		}
	}


?>
Votes:48 Average:1.67
Previous post - Next post | Parent - No child | Posted on 2005/9/9 18:41
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi sophistry.

It's a good idea to display member's birthdays.

Thank you for creating a good plugin!

I've just released piCal 0.83 and your plugin is included in the archive as "membership-birthday.php".


Votes:20 Average:5.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!