Scheduler integration within member website

Hi, firstly I would like to say that the support on this forum is amazing and secondly I would like to ask for some help in configuring the scheduler within my member website. I currently have the shared events version of the scheduler installed on the website but I want the events to be saved according to the user id I have in my members table.
From the example shown in the source code, the initialisation of the scheduler is as follows:

scheduler.load(“calendar/samples/02_customization/shared_events/events.php?user=1”);
var dp = new dataProcessor(“calendar/samples/02_customization/shared_events/events.php?user=1”);
dp.init(scheduler);

However, where it says user=1 at the end I want to change it so that it takes the user id of the logged in user. Could you please tell me if there is a way to do this? I tried to pass a php variable in the javascript which gets the user id but then the calendar would not render properly on the page :confused:
Thank you in advance
:slight_smile:

You can try to change code as

var dp = new dataProcessor(“calendar/samples/02_customization/shared_events/events.php?user=<?php echo $userid; ?>”);

Also, it will be more safe to store userID value in session, and get it from there on server side.
With above code, it possible to alter user id and get access to events of other users, which, most probably, is unwanted behavior.

Thank you for the fast reply Stanislav, I tried to implement the code that you said but the calendar is not rendering properly. In the events.php file I changed the value of $userid to:
$user_id = $_GET[$_SESSION[‘id’]]; so that whenever a user logs in their id will be used to retrieve only their own events.
I am not sure if this is correct because I’m new to php but I guess in theory it should work. Also, I have not changed anything from the sql dump file so I doubt it would be a problem from there.

I think it must be

$user_id = $_SESSION['id'];

But if it works for you as is - never mind.

Did you recieve a error type load xml after adding those lines to events_rec.php. This was the only thing i changed in the code and now i get that error with the discription incorrect xml. what did you do that i didnt.