Page 1 of 1

Calendar X FrontEndusers

Posted: Fri Sep 22, 2006 9:48 pm
by tamlyn
I've started a module to allow frontenduser users to add events to the calendar module. I want to avoid duplicating code wherever possible to preserve compatibility however I've got a bit stuck. The add_admin_event action prints out a nice form but only when logged into the admin and with the wrong form action. I can correct the form action by doing a search & replace on the whole page using ContentPreRender but how can I trick Calendar into thinking an admin user is currently logged in?

Any tips much appreciated.

Re: Calendar X FrontEndusers

Posted: Fri Sep 22, 2006 10:04 pm
by calguy1000
I could really use this module too... 
There's an easy way to do this, get the module instance of the calendar module, and call AddEvent

Re: Calendar X FrontEndusers

Posted: Fri Sep 22, 2006 11:06 pm
by tamlyn
That's more or less what I'm doing (unfortunately Calendar is quite a complex module). The trouble is I want to use high-level methods so that low-level changes to the calendar module don't break my module but the high level methods don't work when an admin user is not logged in...

Re: Calendar X FrontEndusers

Posted: Fri Sep 22, 2006 11:37 pm
by calguy1000
Actually, Calendar isn't that bad..... feusers is way more complex :)

You can't call an admin action from the frontend, the url's are completely different..... the best way would be to
a) modify the calendar to put the form into a function,
b) call that function from the admin_add_event action
c) call that same function from within your module, and
    have that form call your action (somehow), that calls calendar->AddEvent

but it may just be easier to write your own form.  I was thinking of writing this module as well, and I would have just written my own form.

Re: Calendar X FrontEndusers

Posted: Fri Sep 22, 2006 11:55 pm
by tamlyn
Gotcha. This is only my second CMS module and my first was purely backend. I've got lots to learn :)

Re: Calendar X FrontEndusers

Posted: Wed Sep 27, 2006 2:20 pm
by tamlyn
OK I've had a go at it. Pending the CMS forge project approval, here's an XML file of FeuCalendar 0.1 alpha. Please test and comment.

[gelöscht durch Administrator]