Event Calendar RSVP

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

That sure is strange, I set my time to Pacific time as well and mine is coming in 2 days early as well.

This is a bug with the MOD, I am currently investigating this.

Thanks
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Cool, I'm glad we can work through it. Let me know when you'd like me to try any fixes.
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Open includes/ucp/ucp_alerts.php

FIND

Code: Select all

				// Get the right time and date organised
 				$time_now 	= getdate(mktime(0, 0, 0, $s_month, $s_day, $s_year) + $user->timezone + $user->dst - date('Z'));
   				$alert_time	= mktime(0, 0, 0, $time_now['mon'], $time_now['mday'], $time_now['year'], date('I'));
REPLACE WITH

Code: Select all

				// Get the right time and date organised
 				// $time_now 	= getdate(mktime(0, 0, 0, $s_month, $s_day, $s_year) + $user->timezone + $user->dst - date('Z'));
   				// $alert_time	= mktime(0, 0, 0, $time_now['mon'], $time_now['mday'], $time_now['year'], date('I'));

				$alert_time	= mktime(0, 0, 0, $s_month, $s_day, $s_year, date('I'));
That alone should make it work now. But also do this...

Sorry I can't be more specific here, I'm writing this post pretty quickly.

Find the line that begins with (around line 101):

Code: Select all

trigger_error(sprintf($user->lang['UCP_ALERTS_SUBMITTED'], $user->format_date...
Replace that whole line with:

Code: Select all

trigger_error(sprintf($user->lang['UCP_ALERTS_SUBMITTED'], date('j F Y', $alert_time), $alert_on_day . $alert_on_day_before . $alert_week_before . $alert_week_leading, "<a href='" . append_sid($this->u_action) . "'>", "</a>"));
Now find the line that begins with (around line 121):

Code: Select all

				'U_DATE'			=> $user->format...
And replace that whole line with:

Code: Select all

				'U_DATE'			=> date('j F Y', $row['alert_time']),


Does that fix the problem?
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

That fixed the date!

So when and where should I see the alerts? Is it a popup or is it displayed on the index page for the user? What does Global Alert mean?
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

I think I know what global does. A few of questions though:

How can I change the alert color from pink?

So any user can set the alert to global and it would appear on every users index page?

Wouldn't this get rather long if about 20 users set alerts?

Is there a way to set this same alert from within the thread so that it does not clog up the index page? The main reason this is important is becuase members would likely set regional events in their alerts that would not be appropriate for every member in other places to receive.
Attachments
Alerts.pdf
(184.83 KiB) Downloaded 385 times
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Regarding the colour, see how in index_body.html it says: class="rules"
In one of the .css files (maybe colours.css, I'm not sure - I'm not a good person to ask with regards to styles and css :lol:) look for rules and you should be able to change the hex code for the colour in there. Don't forget to clear the cache.

Also, this might have confused you earlier (it will be changed in future versions) but it takes a while for the alerts to appear because of the cache. If you purge the cache in the ACP it will appear immediately, but as I said I am working on this.

With global alerts (an alert everyone can see), only admins can set global alerts. But for your RSVP to work I imagine we will need to change this to allow anyone to submit a global alert - is this correct?

If you are worried about this list getting too long, what if we used a javascript where the user clicks a button to show the list (and then clicks it again to hide it). Would this work?
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

battye wrote:Regarding the colour, see how in index_body.html it says: class="rules"
In one of the .css files (maybe colours.css, I'm not sure - I'm not a good person to ask with regards to styles and css :lol:) look for rules and you should be able to change the hex code for the colour in there. Don't forget to clear the cache.

Also, this might have confused you earlier (it will be changed in future versions) but it takes a while for the alerts to appear because of the cache. If you purge the cache in the ACP it will appear immediately, but as I said I am working on this.

With global alerts (an alert everyone can see), only admins can set global alerts. But for your RSVP to work I imagine we will need to change this to allow anyone to submit a global alert - is this correct?

If you are worried about this list getting too long, what if we used a javascript where the user clicks a button to show the list (and then clicks it again to hide it). Would this work?
On topics:
1. I'll check it out. I'm sure I could figure out the color.
2. It did, it scared me at first because I thought I was going to have a permanent pink banner on the index page. lol Once I purged it was gone.
3. Hmmm...I'm trying to wrap my head around this one because I would like for only those that the event applies to to be able to see the alert. Ideally, it should be in the thread but is this possible: Say within the group I create a local group like southern California riders. An event being global to all of the members in the group would make sense since they can geographically participate in the ride. What I am trying to avoid is broadcasting an event for Southern California to members in North Carolina.
4. JavaScript touch would be cool to minimize the amount of alerts. If the user were to RSVP no to the alert does it go away?

I wish I could help more on the development of this mod but I am horrible at coding. I'm a copy and paste kinda guy. lol
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Sorry about the delay, I haven't had a chance for any coding this weekend. I just wanted to let you know that I've seen your reply and will hopefully have a reply ready for you tomorrow morning (about 15 hours from now)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

No worries,

I'm in no rush. I completely understand as I am usually swamped with work myself.
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Okay, on index.php FIND:

Code: Select all

            'U_RSVP_LINK'   => append_sid('alerts_rsvp.'.$phpEx),
AFTER ADD:

Code: Select all

'U_POPUP_LINK'            => '<a href="' . append_sid('make_rsvp.'.$phpEx, 'alert=' . $row['alert_id']) . '" onclick="window.open(\'make_rsvp.'.$phpEx.'?alert=' . $row['alert_id'] . '\',\'popup\',\'width=400,height=400,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=50,top=0\'); return false">Click here to submit your RSVP</a>',
 
Open index_body.html and FIND

Code: Select all

<a href="{alerts.U_RSVP_LINK}">Click here to send your RSVP</a>
REPLACE WITH:

Code: Select all

{alerts.U_POPUP_LINK}

Now open a new Notepad file, and save it as make_rsvp.php

make the contents:

Code: Select all

<?php
echo '<html>';
echo '<head><title>Make RSVP Here</title></head>';
echo '<body bgcolor="#CADCEB">';
echo 'Content to go here...';
echo '</body>';
echo '</html>';
?>
I just want to get the structure right, once you confirm this is working I'll work on the PHP code. Don't forget to refresh the cache.
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

The Index Box Alert displays:
Test Alert
17 February 2010

RSVP Yes:
RSVP Yes: 0
Click here to submit your RSVP

When clicked a new window opens and "Content to go here" is displayed. I'd say it works. :) (Though, I don't see were there is an RSVP no. 1 has a 0 and the other is blank. Is this normal?)
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Sorry for the delay, if you can pick a time where you can be online at CricketMX for an hour or so we could finish this in real time :)
I'll be online for the rest of today (another 6 or 7 hours from the time of this post).

Open make_rsvp.php and replace the contents with this:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

$alert_id = request_var('alert', 0);

	// html
	echo '<html>';
	echo '<head><title>RSVP Page</title></head>';
	echo '<body bgcolor="#CADCEB">';

if( $alert_id > 0 )
{
	echo '<form action="' . append_sid('make_rsvp.'.$phpEx, 'mode=submit') . '" method="post">';
	echo '<h3>RSVP:</h3><br />';
	echo '<input type="radio" name="rsvp" value="1" /> Yes <br />';
	echo '<input type="radio" name="rsvp" value="0" /> No <br /><br />';
	echo '<h3>Explanation:</h3>';
	echo '<input type="text" name="explain" size="255" />';
	echo '<input type="hidden" name="alert_id" value="' . $alert_id . '" />';
	echo '</form>';
}

else if( request_var('mode', '') == 'submit' && request_var('alert_id', 0) > 0 )
{
	$rsvp_array = array(
    	'alert_id'				=> request_var('alert_id', 0),
		'user_id'				=> $user->data['user_id'],
		'username'				=> $user->data['username'],
		'rsvp_text'				=> request_var('explain', ''),
		'rsvp_yes_no'			=> request_var('rsvp', 0),
		'rsvp_time'				=> time(),
	);

	$rsvp_sql = 'INSERT INTO phpbb_alerts_rsvp ' . $db->sql_build_array('INSERT', $rsvp_array);
	$db->sql_query($rsvp_sql);

	echo 'Your RSVP has been submitted to the database';	
}

else
{
	echo 'Invalid id';
}

	// html
	echo '</body>';
	echo '</html>';
?>
Then try it and let me know what happens :)
If you have a phpMyAdmin window open it would be good to check there to make sure things are being entered into the database correctly when you submit :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Done...it has errors. I included the screenshots. I will try and stay up a little longer but it is 0130 here and Im passing out ;)
Attachments
Alerts.pdf
(28.69 KiB) Downloaded 381 times
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

In that file find:

Code: Select all

 echo '<input type="text" name="explain" size="255" />';
Replace with:

Code: Select all

 echo '<input type="text" name="explain" maxlength="255" />';

EDIT: in the database, is the rsvp_id column set to AUTO INCREMENT?
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
havocwreaker
Frequent Poster
Frequent Poster
Posts: 39
Joined: Tue Feb 02, 2010 5:04 am

Fixed: The DB was not set to auto increment.

I changed/updated the code and was able to submit an RSVP. A page opens with "Your RSVP has been submitted to the database".

The only issue is that the Index page alert box displays:

Test Alert
21 February 2010

RSVP Yes: 1
RSVP Yes: 0
Click here to submit your RSVP


Should the second box be RSVP No? How do I see the explanations? Lastly, will this be able to be "globally" set for groups instead of every member? Thanks for the continued help.
Post Reply