Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 08:34 am EST

Geeklog Forums

Modding the "default" calendar


beeblebrox

Anonymous
artistic
I would like to make a modification to the "default" calendar in Geeklog. What I want to do is this: leave the "main" calendar "event submission" alone, but modify the routine for "personal events" so that when a user adds a personal event, they ALSO add the same event to the main calendar itself.

I'm sure it's a pretty simple mod, but I just can't quite figure out how to do it. Anyone have some guidance?

Thanks!
 Quote

beeblebrox

Anonymous
Nobody, 'eh? I've tried a few simple things (such as trying to do the same MySQL statement "twice," basically), all to no avail. I'm kind of stumped...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Well, if both calendars are going to contain the same events anyway, why not switch off the personal calendar entirely?

Otherwise, you'll have to realize that the two calendars are in two separate tables. So duplicating the code was the right idea, but you'll also have to adjust the table name for the copy.

bye, Dirk
 Quote

beeblebrox

Anonymous
cheerful
Quote by Dirk: Well, if both calendars are going to contain the same events anyway, why not switch off the personal calendar entirely?


No, not entirely - the "main" calendar entries will not be propagated into the "personal" calendars, but the personal entries WILL go into the main calendar.


Quote by Dirk:Otherwise, you'll have to realize that the two calendars are in two separate tables. So duplicating the code was the right idea, but you'll also have to adjust the table name for the copy.

bye, Dirk


Thanks. Now it's just a matter of nailing it down and getting it in there right. Thanks!
 Quote

beeblebrox

Anonymous
confused
Okay, I'm stumped on how to do this. I thought that I could edit calendar-event.php, the saveuserevent function, and basically just change this:

Text Formatted Code
        $result = DB_query ("SELECT eid FROM {$_TABLES['events']} WHERE (eid = '$eid')" . COM_getPermSql ('AND'));
        if (DB_numRows ($result) == 1) {

            $savesql = "INSERT INTO {$_TABLES['personal_events']} (eid,uid,title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon) SELECT eid," . $_USER['uid'] . ",title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['events']} WHERE eid = '{$eid}'";
                       
            DB_query ($savesql);
           

 


to this:

Text Formatted Code
        $result = DB_query ("SELECT eid FROM {$_TABLES['events']} WHERE (eid = '$eid')" . COM_getPermSql ('AND'));
        if (DB_numRows ($result) == 1) {

            $savesql = "INSERT INTO {$_TABLES['personal_events']} (eid,uid,title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon) SELECT eid," . $_USER['uid'] . ",title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['events']} WHERE eid = '{$eid}'";

                        // mod to add double-posting into main cal at the same time
                        $savesql2 = "INSERT INTO {$_TABLES['events']} (eid,title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon) SELECT eid," . $_USER['uid'] . ",title,event_type,datestart,dateend,timestart,timeend,allday,location,address1,address2,city,state,zipcode,url,description,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['events']} WHERE eid = '{$eid}'";
                        // end mod
                       
            DB_query ($savesql);
           
            // mod again
            DB_query ($savesql2);
            // end mod
 


But it doesn't seem to work... still adds to the personal_events table just fine, but it doesn't write ANYTHING to the events table (I checked in phpMyAdmin).

My PHP skills are not top-notch, that's for sure... and I'm clearly doing something wrong. Can anyone offer some insight?
 Quote

All times are EST. The time is now 08:34 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content