Mod Name / Version: Eventspal.php v1.0
Description: Ok I can now
Get Yearly public dates and filter them correctly even recurring yearly
Get Monthly public dates and filter them correctly even recurring Monthly
Get Birthdates and filter them correctly
Lastly I can now get dates from the post table and calendar according to usergroup.
Added a check so that if you have no events, it will spit out so.
Working Under: UBB.Threads 6.4 and 6.4.1
Mod Status: Beta
Any pre-requisites: IIP because you will not authenicated without it unless you add a function for that.
Author(s): scroungr
Date: 01/13/04
Credits: David Lozier for original IIP, Joshpet for updating IIP
Files Altered: eventspal.php
New Files: eventspal.php
Database Altered: No
Info/Instructions: Just change extension from .txt to .php upload this into the pals directory and overwrite existing eventspal.php and set the variables
// Setable variables
// should admins/mods see all dates
// 0 - yes
// 1 - no
$adminmodshow = '1';
// should all events for a given date show under one date
// 0 - yes
// 1 - no
$showdatesunderone = '0';
// show Group Dates on events pal
// 0 - Show Seperately Below the Events under a Group Heading
// 1 - Show Mixed in with the Events
// 2 or other means won't show at all
$groupshow = '0';
// show all Group Dates or just the users in events pal
// 0 - Show all dates for okay board's for all
// 1 - Show all dates for okay board's just for user
$showallgroupdates = '1';
// show Birth Dates on events pal
// 0 - Show Seperately Below the Events under a Birthday Heading
// 1 - Show Mixed in with the Events
// 2 or other means won't show at all
$birthdayshow = '2';
Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.
Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
if someone with a buset sight with alot of users and alot of events can try this I would appreciate it. it works fine on my site..
Very cool scroungr, nice job.
Will definitely be testing this out once I'm finished hacking away on my upgrade.
I can view the events for a private forum when I am not logged in (although when I click the event it does not show any details) is this by design or is it a bug?
thats what I needed to know.. try and clear your cookies when your not logged in and see if you can see the same.
Yep I can still see them when I have no cookies on the computer at all.
think it has to do with the $users['U_Group'];
okay this is fixed now.. had a logi problem.. now it shows all public dates whether they reccur yearly or monthly or never to anyone.. only show private dates to people within the same group as the user whether they reccur yearly or monthly or never and it also shows dates that are entered whether in calendar or events and also shows birthdays..
Someone with alot of events and alot of groups please try this..
would have been nice if I had put the correct one in there good thing I checked...
Ok it checks for login properly now but I can see stuff(topics) for groups that I am not a part of still.
I am betting you are part of those groups somewhere or they of yours.... make sure you are not in users just in admin and make sure you and they share no common groups. if say you have and users1 and a users2 group and a third group lets say users3 and a user from users1 is put into users3 he will see all events for all users in users1 and users3 even if there is a user in user2 and user3. Also MODS and ADMIN will see ALL events because they see ALL groups.. create a user and just put him in users2 group and he will only see events for people in users2.
I can probably put another switch in there so that the admin could choose NOT to see everyone's events?
I am not sure I follow that hehe.
The problem I have with this is that I can see topics for groups that I am not a member of. This makes the event pal usecure for events that are private for say a particulkar group that holds group events. although I can click on the event and get a blank enough information is normally in the title to figureout what is happening.
but your the admin or are you using a user account when you can see that?
I am admin but I have a lot of boards that I dont monitor, They are private forums for other gaming guilds that use our forums as a place to hang there hat and I only go there if it is absolutely necessary which is almost never. I am not a member of thsoe groups.
yeah but your an admin hence you see it all. So I will have to add a switch that is basically.. if your an admin or a mod do you WANT to see it all
OK - this is great.
A couple of things.
Indeed when you login as a regular user, you can see events for forums they don't have access to.
I didn't totally wrap my head around all that you did, but I don't see a query to the w3t_Boards table in there, so somewhere along the line, you've got to query the read permissions of the w3t_Baords table and see if whatever forum that event belongs to is seen by this group.
This is pretty complicated.
So I'm not sure exactly how to go about it, but if you study how it's done in the the calendar script, that should give a bit of an idea.
One other suggestion, and I'm not sure if it's easily possible.
But it would be great for the different event types to get 'grouped' under the date. So that the same date doesn't have to repeate if there are multiple things listed under a day.
Wonderful work on this.
As soon as this is set, we'll put out 5.4.5 with this inclluded. I'm finishing up some other IIP improvements.
thanks again!
thanx Josh I will take a look at the code and see what I can do.. and a regular user can only access events of people in his group bur yeah if that user is in another group he sees those also so yeah maybe I will have to look at using that from the w3t_Boards table first prior to figuring out what the user can actually see... I will work on this more this week
Well actually in my testing, if it helps, I posted an event in a forum only visible to the moderators group - and it was visible when I was logged in as a regular user, but not if I wasn't logged in.
ok I will have to change the function I am using a bit but yeah I can see where the w3t_Boards should be polled for the ones posted as an event in a post but there is not much can do with ones added to the calendar directly as an event.
I can just add a check when it grabs the events from the post table that if the user can't view the board it was posted in not to spit it out.
Okay did some more work on this can someone with alot of groups check this. I made it so you can select whether an admin can see all dates or just his and also did a query at the board level.
I think the last thing left now is to format it like Josh suggests so that all dates on a specific date will be under one date heading
I have aproximately 30 groups on my boards and I tested it with an unregistered user, a user member of all groups and my admin account. This works nicely, Thanks for fixing it
okay then one last thing and should be set...
I will also bring up another point with my mod.. since I handle end of the month Events correctly and UBBthreads does not.. If the event is scheduled for the last day of the month say the 31st.. Threads will only show the date if there is 31 days in the month and will not show them if there is less... My mod takes into account there is a last day of the month and it may not be 31...
you might want to bring that up to scream at ubbcentral... since it sounds like a bug
I looked at their calendar code and unfortunately it isn't a bug... but I will post it
When I just installed this (With default settings), I recieved the following error:
Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in .../forum/pals/eventspal.php(79) : eval()'d code on line 1
What's wrong here ?
try the non-default settings? May be the way your server is configured?
actually it could also be the fact you dont have those kind of events what else does the error say.
okay I emptied my tables and I see the error. it only happened when I had no events so I will have to add a check before the sort.
okay try this new one I added a check so that if no events you will get a message and not an error
added the show dates all under one heading.. please try...
Excuse me for my late answer, but last night it was already pretty late.
Ok, I tried it again and now it works!
Indeed I had no events listed yet.
How could I change the dateformat to what we are using ?
We use DD/MM/YY 10:19 AM
Also it would be good if an event could last for more day, but that's something for infopop
(we would like to post exhibitions which have a start & end date).
Keep up the good work!
you could alter the order it prints out. Look in the for loops at the end where it prints out and exchange the $outputyaddayadda[$i][0] and $outputyaddayadda[$i][1] variables but ONLY in the for loop.
mouse over anything important? I never got the thing about Mousing over?
I run it right out of the box and get this....
Fatal error: Call to a member function on a non-object in /home/drumlin/public_html/threads/pals/eventspal.php on line 230
Line 230 is:
$sth = $dbh -> do_query($query);
The query that this tries to run is:
SELECT Bo_Keyword <br /> FROM {$config['tbprefix']}Boards <br /> WHERE $Grouppostsquery <br /> ORDER BY Bo_Keyword ASC
I'm guessing it doesn't like the $Grouppostquery variable?
can you see what it is setting the $grouppostsquery to?...
you can see it usually by putting something next to the closing quote in that query so if its "; you can put ss"; and it will spit out the string. You may not have any group only events? Hmm let me know I may have to add a check in it.
$Grouppostsquery is set to
No wonder it doesn't like it.
Hmmm ok I just tried the query
SELECT Bo_Keyword
FROM w3t_Boards
WHERE Bo_Read_Perm = '0'
ORDER BY Bo_Keyword ASC
on two different threads database and I recieved no error can you try that in you phpmyadmin?
this is the line that sets it that way
if ($Grouppostsquery == ""){$Grouppostsquery = "Bo_Read_Perm = '0'";}
and thats only cause there are no groups for the person who is viewing the eventspal because he isn't logged in, but if he logs in and say is in group 4 the query should be
SELECT Bo_Keyword
FROM w3t_Boards
WHERE Bo_Read_Perm LIKE '%-4-%'
ORDER BY Bo_Keyword ASC
No error, but I don't understand why it's set to 0. I'm logged-in when I run the script. And when I comment out the line, it just returns the same error to the next line.
so thats also 0 when your logged in hmm ok.. that sheds some light on it..
only way for that to set to 0 is if $Grouppostsquery is empty that all relies on these lines..
[]
if (!$user['U_Groups']) { $user['U_Groups'] = "-4-"; }
$calGrouparray = split("-",$user['U_Groups']);
$calgsize = sizeof($calGrouparray);
$Usergroupquery = "(";
$Grouppostsquery = "(";
$calg = 0;
$calgroupcheck = 0;
for ($i=0; $i<$calgsize;$i++)
{
if (!preg_match("/[0-9]/",$calGrouparray[$i])) { continue; };
if ($adminmodshow == '0')
{
if ($calGrouparray[$i] == '1')
{
$calgroupcheck = 1;
}
if ($calGrouparray[$i] == '2')
{
$calgroupcheck = 2;
}
}
$calg++;
if ($calg > 1)
{
$Usergroupquery .= " OR ";
$Grouppostsquery .= " OR ";
}
$Usergroupquery .= "`U_Groups` LIKE '%-$calGrouparray[$i]-%'";
$Grouppostsquery .= "`Bo_Read_Perm` LIKE '%-$calGrouparray[$i]-%'";
}
[/]
so I am wondering if in fact this line $user['U_Groups'] is working for you. I have seen where some servers can get away with that line and some have to actually set it to a number like $user[2] depending on what element in the $user array has placed the groups function.
if your willing to try one more thing take any custompal box or heck even this script and somewhere towards the top place this
echo $user['U_Groups'];
and see if it returns anything.
thats what I thought. the $user['U_Groups'] is not working for you
hmm can you try one last thing.. do a print_r($user); somewhere near the top or in an empty pal and see if you see $user['U_Groups'].. should be around the 14th element. see if you see it whether your logged in or not..
my not logged in shows
Array ( [U_Username] => [U_PicturePosts] => [U_ShowSigs] => [U_Email] => [U_PictureView] => [U_Status] => [U_Privates] => [U_Name] => [U_Title] => [U_Totalposts] => [U_Visible] => [U_Laston] => [U_Language] => [U_TimeOffset] => [U_Groups] => [U_Picture] => [U_Number] => [U_TimeFormat] => [U_Password] => [U_SessionId] => [U_StyleSheet] => [U_FrontPage] => [U_Banned] => [U_SideBar] => )
while my logged in shows values for each element...
also make sure you re-download the new zip I just placed up there and try that.
This returned nothing both logged-in and logged-out. The new file doesn't work for me either. I get this:
Fatal error: Call to a member function on a non-object in /home/drumlin/public_html/threads/pals/eventspal.php on line 235
okay one more thing.. disable the eventspal.php and put the
print_r($user); in any other palbox. Let me know what happens because at this point I don't know how your running threads or IIP because everything is based off the array($user).
Disable the eventspal? I put the script in an empty pal box. Maybe I'm doing something wrong. How about you attach a file for me to run and I'll tell you what happens?
I sent you a PM. need ya to get rid of my evenetspal and just do a print_r($users) from any other box.
I probably missed a setting somewhere...but here is a question or clarification.
Events that are added to the calendar via the "Add an Event" button (ie not related to a post) are placed in the w3t_Calendars table.
When I run eventspal, everything looks good for me. If I log in as a regular user (non-admin), they cannot see PUBLIC events that were added in this way. Is this correct, or did I miss a switch somewhere?
I downloaded the eventspal off of post #1 in this thread.
Hmmm not sure I will check again tonite.
maybe related to
// show all Group Dates or just the users in events pal
// 0 - Show all dates for okay board's for all
// 1 - Show all dates for okay board's just for user
$showallgroupdates = '1';
Not sure if this will help or not...
#1 - settings I had were as follows, and this is viewing as an ADMIN:
$adminmodshow = '1';
$groupshow = '0';
$showallgroupdates = '0';
$birthdayshow = '0';
#2 - settings I had were as follows, and this is viewing as an ADMIN:
$adminmodshow = '1';
$groupshow = '1';
$showallgroupdates = '0';
$birthdayshow = '0';
#3 - same settings as #2 above, but viewing as a regular user. FYI this Regular User is the one that added the "test" event (visible in #2)...but even though he added it, he cannot see it.
Again...not sure if anything is wrong or not, I JUST started looking through the code. Hope this might help.
I think you need to turn showallgroupdates = "1" on it works with mine that way I think all group dates is the actual events from the calendar itself
With showallgroupdates set to 1....I get the same view as I get with #2 above (with showallgroupdates set to zero).
$adminmodshow = '1';
$groupshow = '1';
$showallgroupdates = '1';
$birthdayshow = '0';
This gives me view #2 from above...so I didn't see a visible change.
I will get back to looking at this once I finish the pollpal. I am one click away from the poll pal. it can do everything but display without hitting submit twice
Okay I have fixed Medar's issue. Can ya retry it not Medar? I left out a array merge in the original.
BTW it opens up a popup box of showday.php you can either remove the _blank from the line with showday.php in it or ask me for the popup box I used on my site at
www.couch-tomatoe.cc
Will try to get this uploaded this afternoon. Mondays are crazy sometimes.
Many thanks scroungr! I started to look in here to tinker with it myself...but you know how when you write something you tend to know where the potential issue is a LOT better than if you are just sorting through code?
That is where I was...felt like I was reading without my glasses, and figured I would let the pro handle it
Ok, two days later, finally got to tinker with this.
The issue is now fixed, it works great! I logged in under various people in and out of groups, and events are displaying properly. Cool deal
However! (hehe) It seems to be ignoring the $totalevents variable if you do are not part of a group that has private events. Here is what I did.
$groupshow = 0. Shows more than $totalevents in the "Upcoming Events" section...whether you are in a private group or not.
$groupshow = 1. Shows more than $totalevents in the "Upcoming Events" section, but ONLY if you are not in a private group.
$groupshow = 2. Shows more than $totalevents in the "Upcoming Events" section...whether you are in a private group or not.
Hope that makes sense. Browsing the code now to see if I can figure it out.
Thanks for the work on this.
Will take a look tonite. Thanx
ok try this Medar I forgot two array_slices.
fixed another small error. should be almost final.
Allrighty - the groupshow issue seems to be resolved, that works great.
The only issues I could find all have to do with the Javascript event popups. In the Upcoming Events section...the popups do not reference any particular page or event. I thought it had to do with possibly calling /pals/showday.php, so I removed the /pals piece, still did not work.
Messing with that a bit.
Other than that, there are some minor glitches in the showday popup, and I think that could be eventspal not pushing some correct variables across. But again, I have not looked at it in depth, just tinkered with it.
Very close now!
what you do with that showday is entirely up to you. You can just make it open the page itself by altering the line's
echo "','_blank','scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no,width=500,height=400,top=100,left=200');">";
to
echo "','toolbar=no,menubar=no,location=no,directories=no,status=no,width=500,height=400,top=100,left=200');">";
you can also remove the line's
echo " title=";you can also just create a box like I have on my site at
www.couch-tomatoe.ccthat output is entirely up to you. If Josh ever gets around to updating IIP he can include it if he wishes.
but if Josh doesn't get moving soon on updating IIP I may have to do it for him.
I've been waiting for this to get ready. Looks like you're almost there.
I've got some other fixes and such ready in IIP - so if this is good to go - I'll get it all posted.
Good work!
np would like to include the showdaypal popup I am using so let me know and I will send it to you.
Going to upload the latest and try some of the popup changes you mentioned scroungr...this will be a nice addition to IIP for the Calendar.
yeah I have a popup I have on my site that pops up using calendar or events.. it use to open the ubbthreads/showday.php but that also sent the header and footer and well... so I created a showdaypal.php without footer and header...
scrounger,
Two questions:
1) When was the attachment on the first post updated last?
2) Are you going to include your showdaypal file? The current eventspal links events to that non-existant file.
This is a handy pal. I'm just getting ready to roll out my "new and improved" site.
ah it was all included in the new IIP 5.4.5 so I never bothered. I will update this now though.
I downloaded it yesterday and it wasn't in there... That's why I grabbed this one.
Hmm, will have to look again when I get home could be I missed a setting, but I did compare the two eventspals and they were nothing alike.
Hmmm well I updated this one. the only difference is the settings for this version is listed in this pal and the settings for IIP's is listed in the configpal.php
I'll take another swing at it when I get home. I've been coding heavily the past two weeks trying to wrap up this project, so I can say I have at least one thing done. It's started affecting my mind... I'm writing code in my sleep again...
Chalk this up to user error.
I had downloaded the latest IIP and then proceeded to use the previous version, since they happened to be right next to each other in my threads hacks archive. I was one file off.
Sorry.