Add user_id when creating an event

Hello,

First, i’m sorry for my not perfect english, but i hope everything will be clear for you.

I explain the situation.

I want to use the scheduler without the lightbox when creating an event. The user has to double click, or click and drag a zone to create an event.
Everything works perfectly when i use only the 3 standard fields : start_date, end_date and text.

But, i would like to add a field user_id and i try giving user_id= 2 to begin.

I found some leads on the net and you can see my php code below :

$user_id = 2;

$res=mysql_connect("localhost","root","root");
mysql_select_db("pgi_pilota");

$scheduler = new schedulerConnector ( $res );
function default_values($action) {
	global $user_id;
	
	$action->set_value ( "user_id", $user_id );
}

$scheduler->event->attach ( "beforeProcessing", "default_values" );

$scheduler->filter ( "user_id", $user_id );

$scheduler->render_table("events", "id","start_date,end_date,text,user_id");

I don’t know why, when the line with “event->attach” is not commented, nothing is inserted in the db when i create an event.
When i comment the line, the event is created, but user_id is 0.

I already read some topics about sections in the lightbox, but i don’t want to use the lightbox.

Help would be appreciated :s.

If you need more code (i mean js code), let me know it.

There are two way to implement such behavior

If you have problem with server side operations, try to enable logs for connector. They may provide some info about a error.

docs.dhtmlx.com/connector__php__errors.html

I thank you for your answer Stanislav.

I successfully did what i wanted to try by moving the line “$user_id = 2;” in the default_values function.

Now i have to do more complicated things (and delete the user_id because i didn’t need it, it was a test), and i will first try to do it by myself before reposting on the forum.

But thx again for your help.