USER_ON_EVENT Mod
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexAdd-Ons & Blocks
Author Message
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: USER_ON_EVENT Mod
Posted: Sun Aug 02, 2009 4:35 pm
Reply with quote

I've manged to get DJSpAcEDeViL's 'USER_ON_EVENT' mod working for CPGNuCalendar (download here). It's a superb mod that allows your users to add themselves to events and show up as attending on the calendar page. It'll be very useful on my site so big thanks to DJSpAcEDeViL!

Some of the changes I've made to make it more multi-lingual and to allow different database prefixes (which were originally hard coded). I made the following changes referring to the user_on_event.txt file:

In cpgnucalendar/index.php

Two new lines added to the forms, the delete image file changed and language definitions used in place of hard coded German:

Code:
//User on Event Mod begin
		echo '<td rowspan="3"><fieldset><legend>'._USER_ON_EVENT.'</legend>';
		$sql = "SELECT uoe_id, user_id, user_name, event_id, event_date FROM ".$cal_prefix."_user_on_event WHERE event_id =".$id." AND event_date =".$date;
		$res = $db->sql_query ($sql);
		  if ( $res ) {
			while ($row = $db->sql_fetchrow ($res)) {
			$uoe_id = $row[0];
			$user_id = $row[1];
			$user_name = $row[2];
			$event_id = $row[3];
			$event_date = $row[4];  
			echo '<div style="float:left"><table><a href="'.getlink('Your_Account').'&amp;profile='.$user_name.'">'.$user_name.'</a>';
			//Delete function
			if ($user_name == $userinfo['username'] || can_admin($module_name) || in_group($cal_config['admin_events']-3)) {
			echo ' <form method="post" action="'.getlink("coppermine&amp;file=delete").'">
  				<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
	  			<input type="hidden" name="what" value="del_user_on_event" />
	  			<input type="hidden" name="uoe_id" value="'.$uoe_id.'" />
	  			<input name="submit" title="Delete" type="image" src="/images/delete.gif" />
				</form>';}
			//Delete function
			echo '</table></div> '; };}
		echo'</fieldset></ br>';
		if (is_user($user)){
		echo'<div style="float:left"><form method="post" name="post" action="'.getlink('coppermine&amp;file=db_input').'" enctype="multipart/form-data" accept-charset="utf-8">
  			<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
			<input type="hidden" name="event" value="add_user_on_event" />
  			<input type="hidden" name="event_id" value="'.$id.'" />
			<input type="hidden" name="user_id" value="'.$user_id.'" />
			<input type="hidden" name="user_name" value="'.$user_name.'" />
			<input type="hidden" name="event_date" value="'.$date.'" />
  			<input type="submit" class="comment_button" name="submit" value="'._WILL_ATTEND.'" />
			</form></div>'; }
		else {
		echo'<div style="float:left"><form method="post" name="post" action="'.getlink('Your_Account&amp;file=register').'" enctype="multipart/form-data" accept-charset="utf-8">
  			<input type="submit" class="comment_button" name="submit" value="'._WILL_ATTEND.'" />
			</form></div>';  }
//User on Event Mod end

There is no image file called 'noaccess.gif' so you need to supply one or just copy the delete.gif from the coppermine images folder and use that.

In modules/coppermine/delete.php

cal_prefix variable added and language redefines used:
Code:
//User on Event

case 'del_user_on_event':
		$uoe_id = intval($_POST['uoe_id']);
		$cal_prefix = Fix_Quotes($_POST['cal_prefix']);
  
			$result = $db->sql_query("SELECT event_id, event_date FROM ". $cal_prefix. "_user_on_event WHERE uoe_id='$uoe_id'", false, __FILE__, __LINE__);

			if (!$db->sql_numrows($result)) {
				cpg_die(_CRITICAL_ERROR, NON_EXIST_EVENT, __FILE__, __LINE__);
			} else {
				$ev_data = $db->sql_fetchrow($result);
			} 
			$redirect = getlink("CPGNuCalendar&amp;view=event&amp;id=".$ev_data["event_id"]."&amp;date=".$ev_data["event_date"]);
			if(isset($_POST['cancel'])) {
				url_redirect($redirect);
			}
			if (!isset($_POST['confirm'])) {
			$msg = CONFIRM_DELETE_ATTEND;
			cpg_delete_msg(getlink("&amp;file=delete"),$msg,'<input type="hidden" name="what" value="del_user_on_event" /><input type="hidden" name="uoe_id" value="'.$uoe_id.'" /><input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />');		
		
			} else {  
			if (is_admin()) {
				$query = "DELETE FROM ". $cal_prefix. "_user_on_event WHERE uoe_id='$uoe_id'";
			} elseif (is_user()) {
				$query = "DELETE FROM ". $cal_prefix. "_user_on_event WHERE uoe_id='$uoe_id' AND user_id=".is_user();
			} 
			$result = $db->sql_query($query, false, __FILE__, __LINE__);

			pageheader(INFO, $redirect);
			msg_box(INFO, ATTEND_DELETED, CONTINU, $redirect);
			pagefooter();
		}
		break;

In modules/coppermine/db_input.php

cal_prefix variable added and language redefines used:
Code:
//User on Event
	
	case 'add_user_on_event':
		if (!(USER_CAN_POST_COMMENTS)) cpg_die(_ERROR, PERM_DENIED, __FILE__, __LINE__);
		$cal_prefix = Fix_Quotes($_POST['cal_prefix']);
		$uoe_id = intval($_POST['uoe_id']);
		$user_id = intval($_POST['user_id']);
		$event_id = intval($_POST['event_id']);
		$event_date = intval($_POST['event_date']);
		$user_name = intval($_POST['user_name']);


		
		$result = $db->sql_query("SELECT user_id FROM ".$cal_prefix."_user_on_event WHERE event_id = '$event_id' ORDER BY uoe_id");
			if ($db->sql_numrows($result)) {
				$ev_data = $db->sql_fetchrow($result);
				$redirect = getlink("CPGNuCalendar&amp;view=event&amp;id=".$event_id."&amp;date=".$event_date);
				if ((USER_ID && $ev_data['user_id'] == USER_ID)) {
					pageheader(_ERROR, $redirect);
					msg_box(_ERROR, USER_ALREADY_ON_EVENT, CONTINU, $redirect);
					pagefooter();
				}
			} 


		 // Registered users, we can use Location to redirect
		$insert = $db->sql_query("INSERT INTO ".$cal_prefix."_user_on_event (user_id, user_name, event_id , event_date) VALUES ('".USER_ID."', '".CPG_USERNAME."','".$event_id."', '".$event_date."')");
			
			$redirect = getlink("CPGNuCalendar&amp;view=event&amp;id=".$event_id."&amp;date=".$event_date);

			
			pageheader(ATTEND_ADDED, $redirect);
			msg_box(INFO, ATTEND_ADDED, CONTINU, $redirect);
			pagefooter();
		
		break;

In modules/CPGNuCalendar/includes/functions.inc

cal_prefix variable added, correction to allow for apostrophe in tip and language redefines used:

Code:
//Print the specified event for the monthly view calendar
	function print_month_event ( $event, $date ) {
		global $db, $cal_prefix, $cal_module_name, $repeated_descriptions, $cal_config, $calcategories, $userinfo;

		$id = $event['eid'];
		$time = $event['time'];
		$duration = $event['duration'];
		$priority = $event['priority'];
		$view = $event['view'];
		$name = $event['name'];
		$description = $event['description'];
		$image = $event['image'];
		$categoryid = $event['category'];
		$result2 = $db->sql_query("select title FROM ". $cal_prefix. "_categories WHERE catid = '".$categoryid."'",false,__FILE__,__LINE__);
		$row3 = $db->sql_fetchrow($result2);
		$category= $row3['title'];
		$content = "";
		//Print event if...
		//is any user OR
		//is in the specified $view group OR
		//is a registered user OR
		//is a Calendar Admin
		//BBcode by SpAcEDeViL Emsland-Party.de
		$description = decode_bbcode(set_smilies(encode_bbcode(preg_replace("/\r|\n/s", "&nbsp;",$description))),1);
		$alttext = ($description) ? substr(htmlentities(strip_tags(stripslashes($description))),0,75): "";
			$content .= '
<script language="JavaScript" type="text/javascript">
<!--';
$content .= "
maketip('tip_".addslashes($name)."','".addslashes($name)."','".addslashes($description)."');
";
$content .= '// -->
</script>';
		if ($view == 0 || in_group($view) || is_user() || can_admin($cal_module_name)) {
			$content .= "<div><table width='100%' cellspacing='1' cellpadding='3' border='0'><tr><td><a onmouseover=\"tip('tip_".addslashes($name)."')\" onmouseout=\"untip()\"  href=\"".getlink($cal_module_name . "&amp;view=event&amp;id=$id&amp;date=$date") . "\"";
			$content .= (!empty($description) ? " title=\"\"" : "") . "><img src=\"modules/$cal_module_name/images/$image\" alt=\"Event\" style=\" vertical-align: middle; border:0;\" /> ";

			if ($cal_config['show_time'] == '1') {
				$timestr = "";
				if ( $time >= 0 ) {
					$timestr = display_time ( $time );
					$content .= $timestr . " ";
					if ( $duration > 0 ) {
						// calc end time
						$h = (int) ( $time / 10000 );
						$m = ( $time / 100 ) % 100;
						$m += $duration;
						$d = $duration;
						while ( $m >= 60 ) {
							$h++;
							$m -= 60;
						}
						$end_time = sprintf ( "%02d%02d00", $h, $m );
						$content .= " - " . display_time ( $end_time ) . " ";
					}
				}
			}
			$descs = count($repeated_descriptions);
			for ( $i = 0; $i < $descs; $i++ ) {
				if ($repeated_descriptions[$i]['eid'] == $id && $repeated_descriptions[$i]['date'] == $date){
					$name = $repeated_descriptions[$i]['name'];
					break;
				}
			}
		//	if ($calcategories[$category]['display'] == 1 || $image == "circle.gif" || $image == "blank.gif" )
				$content .= $name;

			$content .= "</a></td>";

//Add - Delete function
$getid = $db->sql_query("SELECT uoe_id, event_id, user_id, user_name, event_date FROM ". $cal_prefix. "_user_on_event WHERE event_id=".$id." AND event_date=".$date."");
while ($row1 = $db->sql_fetchrow($getid)) {
$uoe_id = $row1['uoe_id'];
$eid1 = $row1['event_id'];
$event_date = $row1['event_date'];
$user_id = $row1['user_id'];
$uoe_uname = $row1['user_name'];
//Besucherz�hler? $anzahl = mysql_affected_rows(); 
}

if (is_user($user)) {
			if ( $userinfo['user_id'] == $user_id && $event_id != $id && $date == $event_date) {
			$content .='<td><div align="right"><form method="post" action="'.getlink("coppermine&amp;file=delete").'">
  				<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
	  			<input type="hidden" name="what" value="del_user_on_event" />
	  			<input type="hidden" name="uoe_id" value="'.$uoe_id.'" />
	  			<input name="submit" title="'._WONT_ATTEND.'" type="image" src="images/checked_sm.gif" />
				</form></div></td>'; }
			else {
			$content .= '<td><div align="right"><form method="post" name="post" action="'.getlink('coppermine&amp;file=db_input').'" enctype="multipart/form-data" accept-charset="utf-8">
  			<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
			<input type="hidden" name="event" value="add_user_on_event" />
  			<input type="hidden" name="event_id" value="'.$id.'" />
			<input type="hidden" name="user_id" value="'.$userinfo['user_id'].'" />
			<input type="hidden" name="user_name" value="'.$username.'" />
			<input type="hidden" name="event_date" value="'.$date.'" />
  			<input name="submit" title="'._WILL_ATTEND.'" type="image" src="images/unchecked_sm.gif" /></form></div></td>'; } }
//Add - Delete function


			$content .= "</tr></table></div>";
		}
		return $content;
	}

in language/cpgnucalendar.php

Following definitions added:

Code:
# user_on_event
define("_USER_ON_EVENT", "Attendees");
define("_WILL_ATTEND", "Count Me In");
define("_WONT_ATTEND", "Cancel Attendance");
define("_ATTENDANCE", "will attend/attended these events:");
define("_NO_EVENTS", "is not listed at any events.");
define("_MORE_EVENTS", "More Events");

in language/coppermine.php

Following definitions added:

Code:
define('NON_EXIST_EVENT', 'The selected event does not exist.');
define('USER_ALREADY_ON_EVENT', 'You are already attending this event');
define('ATTEND_ADDED', 'You have been added to this event');
define('ATTEND_DELETED', 'You have been removed from this event');
define('CONFIRM_DELETE_ATTEND', 'Are you sure you no longer wish to attend this event?');

in Your_Account/blocks/5Events.php

cal_prefix variable added, table not produced if no result and language redefines used:

Code:
<?php
if (!defined('CPG_NUKE')) { exit; }

global $prefix, $cal_prefix, $db, $CONFIG;

$cpg_dir = 'CPGNuCalendar';

if (!is_active($cpg_dir)) {
   echo 'ERROR';
   return trigger_error($cpg_dir.' module is inactive', E_USER_WARNING);
}

$cpg_block = true;
$cpg_block = false;
$length=20; //Anzahl der Events
$userinfo = getusrdata($username);


// END USER DEFINABLES
$getaid = $db->sql_query("select event_id, user_id, event_date FROM ".$cal_prefix."_user_on_event where user_id = '".$userinfo['user_id']."' GROUP BY event_id ORDER BY event_id DESC LIMIT $length");
if (!mysql_num_rows($getaid)) { echo '<center><b>'.$userinfo['username'].'</b> '._NO_EVENTS.'<br><br></center>';}
		else {
echo '<center><b>'.$userinfo['username'].'</b> '._ATTENDANCE.' <br><br><table width="70%" cellspacing="1" cellpadding="3" border="0">';
while ($row1 = $db->sql_fetchrow($getaid)) {
$eid1 = $row1['event_id'];
$event_date =$row1['event_date'];

$result = $db->sql_query("select eid, name, image, category FROM ".$prefix."_cpgnucalendar WHERE eid = '".$eid1."' ORDER BY eid DESC LIMIT $length",false,__FILE__,__LINE__);

$row2 = $db->sql_fetchrow($result);
$name = $row2['name'];
$image = $row2['image'];
$categoryid = $row2['category'];
$result2 = $db->sql_query("select title FROM ".$cal_prefix."_categories WHERE catid = '".$categoryid."'",false,__FILE__,__LINE__);
$row3 = $db->sql_fetchrow($result2);
$category= $row3['title'];

   echo '<tr><td><center><img src="modules/CPGNuCalendar/images/'.$image.'" title="'.$category.'" alt="'.$category.'"></center></td><td><a href="' . getlink("CPGNuCalendar&amp;view=event&amp;id=".$eid1."&amp;date=".$event_date) . '" title="'.$category.'">'.$name.' </td><td> '.substr ( $event_date, 6, 2 ).'/'.substr ( $event_date, 4, 2 ).'/'.substr ( $event_date, 0, 4 ).'</a></td></tr> '; 
   }

	echo'</table>';}
	echo '<br><center>| <a href="'.getlink(CPGNuCalendar).'">'._MORE_EVENTS.'</a> |</center>';

Hope that helps someone else use this great mod!


rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
mierlo
Newbie


Joined: Jan 02, 2007
Posts: 8
Location: Valkenswaard, The Netherlands

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Wed Aug 05, 2009 11:37 am
Reply with quote

yes, great MOD DJSpAcEDeViL and very good/handy work Rosbif,


there is a little BUT;

when you are not logged in, you should not see the list of attenders nor can press the button in the event view window.
And yes, only logged in as admin you can't see the button.
I would reccommend this code in the

cpgnucalendar/index.php
Code:
//User on Event Mod begin
		if (is_user($user)){
		echo '<td rowspan="3"><fieldset><legend>'._USER_ON_EVENT.'</legend>';
		$sql = "SELECT uoe_id, user_id, user_name, event_id, event_date FROM ".$cal_prefix."_user_on_event WHERE event_id =".$id." AND event_date =".$date;
		$res = $db->sql_query ($sql);
		  if ( $res ) {
			while ($row = $db->sql_fetchrow ($res)) {
			$uoe_id = $row[0];
			$user_id = $row[1];
			$user_name = $row[2];
			$event_id = $row[3];
			$event_date = $row[4];  
			echo '<div style="float:left"><table><a href="'.getlink('Your_Account').'&amp;profile='.$user_name.'">'.$user_name.'</a>';
			//Delete function
			if ($user_name == $userinfo['username'] || can_admin($module_name) || in_group($cal_config['admin_events']-3)) {
			echo ' <form method="post" action="'.getlink("coppermine&amp;file=delete").'">
  				<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
	  			<input type="hidden" name="what" value="del_user_on_event" />
	  			<input type="hidden" name="uoe_id" value="'.$uoe_id.'" />
	  			<input name="submit" title="Delete" type="image" src="/images/delete.gif" />
				</form>';}
			//Delete function
			echo '</table></div> '; };}
		echo'</fieldset></ br>';
		echo'<div style="float:left"><form method="post" name="post" action="'.getlink('coppermine&amp;file=db_input').'" enctype="multipart/form-data" accept-charset="utf-8">
  			<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
			<input type="hidden" name="event" value="add_user_on_event" />
  			<input type="hidden" name="event_id" value="'.$id.'" />
			<input type="hidden" name="user_id" value="'.$user_id.'" />
			<input type="hidden" name="user_name" value="'.$user_name.'" />
			<input type="hidden" name="event_date" value="'.$date.'" />
  			<input type="submit" class="comment_button" name="submit" value="'._WILL_ATTEND.'" />
			</form></div>'; }
//		else {
//		echo'<div style="float:left"><form method="post" name="post" action="'.getlink('Your_Account&amp;file=register').'" enctype="multipart/form-data" accept-charset="utf-8">
//  			<input type="submit" class="comment_button" name="submit" value="'._WILL_ATTEND.'" />
//			</form></div>';  }
//User on Event Mod end

_________________
kind regards,

Martijn

mierlo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.4.21-57/Apache 2.0/MySQL 4.1.15/PHP 5.2.4/CMS 9.2.1
Back to top
View user's profile Visit poster's website
Emsland-Party.de
Nice poster


Joined: May 24, 2005
Posts: 76
Location: Lummer Land (Germany)

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Fri Aug 07, 2009 3:40 pm
Reply with quote

Hy Thx for the praise.
mierlo,

i can not so good english,

mh, yes,

I was wondering whether I do with a purely functional. A variable has been given ... must only be used

search in includes/functions.inc:
//Besucherzähler? $anzahl = mysql_affected_rows();

this is the option to show how many people goes to the event.


Emsland-Party.de's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / PHP: 4.4.1 / SQL: 5.0.18-log (client: 5.0.18) / 9.1.0.8 CVS
Back to top
View user's profile Visit poster's website
mierlo
Newbie


Joined: Jan 02, 2007
Posts: 8
Location: Valkenswaard, The Netherlands

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Tue Aug 11, 2009 6:30 am
Reply with quote

Hallo,

I don' know what you mean by this.

_________________
kind regards,

Martijn

mierlo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.4.21-57/Apache 2.0/MySQL 4.1.15/PHP 5.2.4/CMS 9.2.1
Back to top
View user's profile Visit poster's website
Emsland-Party.de
Nice poster


Joined: May 24, 2005
Posts: 76
Location: Lummer Land (Germany)

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Tue Aug 11, 2009 11:44 am
Reply with quote

hehe sorry,

i have your thread misunderstand Wink


Emsland-Party.de's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / PHP: 4.4.1 / SQL: 5.0.18-log (client: 5.0.18) / 9.1.0.8 CVS
Back to top
View user's profile Visit poster's website
mierlo
Newbie


Joined: Jan 02, 2007
Posts: 8
Location: Valkenswaard, The Netherlands

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Fri Aug 14, 2009 1:49 pm
Reply with quote

so now I also changed the
/modules/Your_account/Blocks/5Events.php

This because my site did not display the text properly and MORE_EVENTS was displayed but no events were attended.

Code:
<?php
if (!defined('CPG_NUKE')) { exit; }

global $db, $CONFIG, $prefix, $cal_prefix;

if (is_active('CPGNuCalendar')) {
$length = 10; //Number of Events
//$userinfo = getusrdata($username);
	get_lang('CPGNuCalendar');

// END USER DEFINABLES
$result = $db->sql_query("select event_id, user_id, event_date FROM ".$prefix."_cpgnucalendar_user_on_event where user_id = '".$userinfo['user_id']."' GROUP BY event_id ORDER BY event_id DESC LIMIT $length");
	if ($db->sql_numrows($result) > 0) {
		echo '<br />';
		OpenTable();
        echo '<div align="left"><b>'.$username.'\'s '._ATTENDANCE.'</b><ul>';
        while ($row1 = $db->sql_fetchrow($result)){
        	$eid1 = $row1['event_id'];
        	$event_date =$row1['event_date'];
        	$result1 = $db->sql_query("select eid, name, image, category FROM ".$prefix."_cpgnucalendar WHERE eid = '".$eid1."' ORDER BY eid DESC LIMIT $length",false,__FILE__,__LINE__);
        	$row2 = $db->sql_fetchrow($result1);
        	$name = $row2['name'];
       		$image = $row2['image'];
        	$categoryid = $row2['category'];
        	$result2 = $db->sql_query("select title FROM ".$prefix."_cpgnucalendar_categories WHERE catid = '".$categoryid."'",false,__FILE__,__LINE__);
        	$row3 = $db->sql_fetchrow($result2);
        	$category= $row3['title'];
        	echo '<li><img src="modules/CPGNuCalendar/images/'.$image.'" title="'.$category.'" alt="'.$category.'"> <a href="' . getlink("CPGNuCalendar&amp;view=event&amp;id=".$eid1."&amp;date=".$event_date) . '" title="'.$category.'">'.$name.' '.substr ( $event_date, 6, 2 ).'/'.substr ( $event_date, 4, 2 ).'/'.substr ( $event_date, 0, 4 ).'</a></li>'; 
   		}
        echo '</ul></div>';
        echo '<br/><Div align ="left">| <a href="'.getlink('CPGNuCalendar').'">'._MORE_EVENTS.'</a> |</div>';
        CloseTable();
	}
}

Also for the Dutch lang code in cpgnucalendar.php

Code:
define('_USER_ON_EVENT', 'Deelnemers');
define('_WILL_ATTEND', 'Ik doe mee');
define('_WONT_ATTEND', 'Annuleer deelname');
define('_ATTENDANCE', 'evenementen waar aan deelgenomen wordt:');
define('_NO_EVENTS', 'staat niet geregistreerd voor een van de evenementen.');
define('_MORE_EVENTS', 'Meer evenementen');


mierlo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.4.21-57/Apache 2.0/MySQL 4.1.15/PHP 5.2.4/CMS 9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Mon Aug 17, 2009 8:58 am
Reply with quote

Have just discovered that this throws up an error 'User already on event' if you are trying to select a 'recurring' event and you are already attending one of the events of the series.

This means that the comment must be added to a combination of the event_id and the event_date. I think (please check this - it does seem to work) that you need to change this line in db_input.php:

Code:
$result = $db->sql_query("SELECT user_id FROM ".$cal_prefix."_user_on_event WHERE event_id = '$event_id' ORDER BY uoe_id");


to
Code:
$result = $db->sql_query("SELECT user_id FROM ".$cal_prefix."_user_on_event WHERE (event_id = '$event_id') AND (event_date = '$event_date') ORDER BY uoe_id");

in /modules/Your_account/Blocks/5Events.php change

Code:
$getaid = $db->sql_query("select event_id, user_id, event_date FROM ".$cal_prefix."_user_on_event where user_id = '".$userinfo['user_id']."' GROUP BY event_id ORDER BY event_id DESC LIMIT $length");

to
Code:
$getaid = $db->sql_query("select event_id, user_id, event_date FROM ".$cal_prefix."_user_on_event where user_id = '".$userinfo['user_id']."' ORDER BY event_date ASC LIMIT $length");

(I'm not sure why the 'Group By' bit was there - have I missed something?)


rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Tue Aug 18, 2009 4:35 pm
Reply with quote

Made a quick change to cpgnucalendar/index.php so that multiple attendees display properly (they were printing over each other)

Code:
		  if ( $res ) {
		  	echo '<div style="float:left"><table><tr><td>';
			while ($row = $db->sql_fetchrow ($res)) {
			$uoe_id = $row[0];
			$user_id = $row[1];
			$user_name = $row[2];
			$event_id = $row[3];
			$event_date = $row[4];  
			echo '<a href="'.getlink('Your_Account').'&amp;profile='.$user_name.'">'.$user_name.'</a>';
			//Delete function
			if ($user_name == $userinfo['username'] || can_admin($module_name) || in_group($cal_config['admin_events']-3)) {
			echo ' <form method="post" action="'.getlink("coppermine&amp;file=delete").'">
  				<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
	  			<input type="hidden" name="what" value="del_user_on_event" />
	  			<input type="hidden" name="uoe_id" value="'.$uoe_id.'" />
	  			<input name="submit" title="Delete" type="image" src="/images/delete.gif" />
				</form>';}
			//Delete function
			echo '</td></tr>'; }
			echo '</table></div> ';}
		echo'</fieldset></ br>';


rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Thu Sep 03, 2009 8:14 am
Reply with quote

Is there any way of getting the delete image and the username on the same line? Using the code above they always appear on different lines, presumably because of the form element?

rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Mon Sep 07, 2009 10:55 am
Reply with quote

There's an problem with the code in cpgnucalendar/functions.inc in that if more than one person is attending an event and you are not the last in the table then the monthly event block will incorrectly display the tick box. To correct this use this code..

Code:
//Add - Delete function
$userpresent = '0';
$getid = $db->sql_query("SELECT uoe_id, event_id, user_id, user_name, event_date FROM ". $cal_prefix. "_user_on_event WHERE event_id=".$id." AND event_date=".$date."");
while ($row1 = $db->sql_fetchrow($getid)) {
$uoe_id = $row1['uoe_id'];
$eid1 = $row1['event_id'];
$event_date = $row1['event_date'];
$user_id = $row1['user_id'];
$uoe_uname = $row1['user_name'];
//Besucherz�hler? $anzahl = mysql_affected_rows(); 

if (is_user($user)) {
			if ( $userinfo['user_id'] == $user_id && $event_id != $id && $date == $event_date) {
			$userpresent = '1'; }
}
}

if (is_user($user)) {
			if ( $userpresent =='1' ) {
			$content .='<td><div align="right"><form method="post" action="'.getlink("coppermine&amp;file=delete").'">
  				<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
	  			<input type="hidden" name="what" value="del_user_on_event" />
	  			<input type="hidden" name="uoe_id" value="'.$uoe_id.'" />
	  			<input name="submit" title="'._WONT_ATTEND.'" type="image" src="images/checked_sm.gif" />
				</form></div></td>'; }
			else {
			$content .= '<td><div align="right"><form method="post" name="post" action="'.getlink('coppermine&amp;file=db_input').'" enctype="multipart/form-data" accept-charset="utf-8">
  			<input type="hidden" name="cal_prefix" value="'.$cal_prefix.'" />
			<input type="hidden" name="event" value="add_user_on_event" />
  			<input type="hidden" name="event_id" value="'.$id.'" />
			<input type="hidden" name="user_id" value="'.$userinfo['user_id'].'" />
			<input type="hidden" name="user_name" value="'.$username.'" />
			<input type="hidden" name="event_date" value="'.$date.'" />
  			<input name="submit" title="'._WILL_ATTEND.'" type="image" src="images/unchecked_sm.gif" /></form></div></td>'; } }
//Add - Delete function


rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Wed Dec 30, 2009 2:50 pm
Reply with quote

Have discovered that bots are throwing up multiple SQL errors with this mod like:

Quote:
On /CPGNuCalendar/view=event/id=606/MReviews=/op=show/rid=14/newlang=english.html
While executing query "SELECT uoe_id, user_id, user_name, event_id, event_date FROM chantill_cpgnucalendar_user_on_event WHERE event_id =606 AND event_date ="

the following error occured: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

In: /home/chantill/public_html/modules/CPGNuCalendar/index.php on line: 859

Any ideas what might be allowing the mix of modules in that first line (it's a random module)? Presumably it's because some definition of $module is wrong somewhere


rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
layingback
Forum Admin


Joined: Apr 19, 2004
Posts: 750

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Wed Dec 30, 2009 2:54 pm
Reply with quote

The value in $module reflects the _current_ module. So if you are running as a block, then $module will not be the name of your module, but that of another! You'll probably have to use the module name.
_________________
Pro_News: The complete module for Dragonfly - now available as version 3.3

layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.4.21 - 2.6.22 / 1.3.39 - 2.2.8 / 4.4.7 - 5.2.5 / 9.1.2.1 - 9.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Wed Dec 30, 2009 3:03 pm
Reply with quote

Thanks LB - I am presuming that the error is in the CPGNuCalendar hack not the other modules that are throwing up the errors... Can't see where it would be though - presumably somewhere in the block code (although the error seems to come from modules/CPGNuCalendar/index.php)

rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
macuserau
Newbie


Joined: May 18, 2006
Posts: 49
Location: South Coast Australia

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Sun Jun 13, 2010 5:38 am
Reply with quote

Does these suggested code changes work with CPGNuCalander 2.1.0 or are these meant for an older version?

macuserau's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
unix / Apache 2.2.15 / MySQL 5.0.90 / PHP 5.3.2/ CMS 9.1.2.1
Back to top
View user's profile Visit poster's website
rosbif
Dragonfly addicted


Joined: Jan 13, 2005
Posts: 435
Location: Paris, France

PostPost subject: Re: USER_ON_EVENT Mod
Posted: Sun Jun 13, 2010 5:35 pm
Reply with quote

Works fine with the latest version..

rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/5.0.77/5.2.8/9.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexAdd-Ons & Blocks All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Dedicated Server & Bandwidth Sponsored by DedicatedNOW
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Dansk
Deutsch
Eesti
Italia
Norsk

Testimonials [x]
I just did the phpNuke 7.4 to CPG-Nuke CVS conversion. Was very easy. ... Found everything I needed to help me along the way with a few searches.
The most unexpected and best thing I have found after switching was the increased speed. I used to think I needed to change hosts--since switching to CPG-Nuke all my users have commented on how much faster pages load

Whit

i was running phpnuke and have almost 30,000 members apache and sql both running at 99% usage, server crashed when 50 ppl online, Host wanted me off shared hosting as many customers complaining i was crashing a p4 3.2 with 2gig ram, i converted to cpg and now i have less than a 50% server load cpg saved me $300 USD a month offshore dedicated servers cost $$ thx guys
one decision i dont regreat is CPGNUKE

Korben
www.datastreamz.net
It's like this - I was working with Oldsmobiles when I was workin with HTML. Then I moved up to Mazda's and Audi's with PHP Nuke. But now my friends I am riding in style with Benz's and Porche's. The diffrence is that noticable immediatly. The Install is so simple once you get it and the site is so secure its like fort knox. Thank you - And you all can expect to see alot more of me around - suggesting ideas and helping where I can. Peace out all - and enjoy newbies. It's really worth it to use CPGNuke.
- Kid_Creation

One thing I've noticed about CPG-Nuke... it is fast and clean. Impressive. One of my 'customers' liked it so much she wanted everything changed to CPG-Nuke!
- valis
awebware.com

The conversion from phpNuke 7.4 to CPG-Nuke (CVS) was a piece of cake. The data conversion took about two hours. Hit a few snags--but nothing a few forum searches couldn't fix. Probably the best compliment I got from my users--"Did you change hosts?" The speed improvement over phpNuke is quite noticable. Kudos to the developement team! Thanks for helping me get away from the phpNuke tease.
- Whit
endofropegang.com

Thanks for the Great program! I never regret migrating from PhpNuke. My site is so much faster and more secure. Now I spend time managing my site instead of the site software. Keep up the good work!
- Rod
www.gentle.org

Now that we are running CPG Nuke this is the first time I've travelled without having to worry about hacking, monitoring the site daily, etc. Thanks for CPG Nuke and everyone that made it possible. We are running a consumer advocacy site at householdwatch.com and the site is very busy. CPG Nuke is doing the job and doing it well.
NukeFind

CPG is Fast, Secure & Free Since installing it's been much easier to work with as an admin. Better admin features but not as many modules that phpnuke offers. Built for speed and reliability. Admin of 3 prominent sites that combined receive 6 million hits annually. CPGnuke is hands down the best CMS out there.
- djdevon3

I just made the switch to CPG, from phpNuke.
The install was easy, simple when following well written instructions. My site has dramatically increased in speed, it really is a day and nite difference.
Thanks to everyone who is a part of the CPG-Nuke project and for offering this CMS as a great alternative to the other *Nukes.
I look forward to being a part of the community.
Kristin
"I made the switch!"

I managed to stumble onto this remake of phpnuke type CMS and have been VERY pleased ever since... I'm very glad it's the system I'm using to make a web site.
4est
Great sense of community around CPG Nuke! Thanks for your hard work Cheers!
roRisc
To the Dev team. You guys rock keep up the good work. Hopefully I'll get good enough at this quickly so that I'll be able to start posting some solutions and tips as well. Cup-A-Cino
I want to thank everyone who help me to build my cpgnuke, know the final layout look great, makes the user want to register.....thanks alot guys
TRANCEBUDHA
Hey thanks for the quick replies..hehe.. ya I am trying to check out cpg-nuke on the same server.. anyways.. www.sizzle.no-ip.com /ufo just a test site main php-nuke is www.sizzle.no-ip.com and forums www.sizzle.no-ip.com /forums It seems so far that cpg-nuke is quit a bit faster than php-nuke.. thanks again
sixpack
CPG-Nuke and its support community ROCKS!
James D Kirk
CPGNuke is making phpnuke look like hammered dog-crap so far...
Persistence
Just installed the latest version of CPG and I'm lovin' it!
square
love CPG!
Mecro
man i just took a look at the demo ADMIN and you guys truly did a remarkable job.. this blows PHPNuke away...
dirtbag
Thank You, cpgnuke. Thank You All that are behind that wonderful script.
Truden
Excellent Coppermine with safemod :) Work fine with safemod nice Job
Reha
Thank You, cpgnuke. I am amazed at what CPG Nuke has to offer...
JamesSelvage
Great site. Great software.
ShermD3
Well I got my first CPGNuke site up! (huzzah?) I must say of the 5 site I run, 4 of which are PHP-Nuke sites I'm most impressed
GeoffM
This install was SOOO smooth. Great job guys! I love it!
dcorwin
Hey CPG-Nuke Dev Team!! Wow!!!!...pretty much sums it up. I love cpgnuke and I've only had it a couple days now.
sabione
Great system you developed here. Thanks !
cwweb

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.6925 seconds with 19 DB Queries in 0.0644 seconds
Memory Usage: 3.43 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy