Okay, this is likely to be much easier than I thought it would be.
The first part is done. I cloned the mod_events_cal module and called it mod_events_cal_user, added the "_user" to all of the names and renamed DisplayCalendarMod() to DisplayCalendarModUser(), and then added one extra line to the main SQL statement:
- Code: Select all
. "\n AND #__events.created_by = $my->id"
And that did it. Now I have a module that shows the calendar only for the logged-in user.
I've also cloned this and made it into a Community Builder plugin that, instead of using $my->id uses $user->id so that a CB user can have their calendar displayed on their profile. This lets anyone view anyone else's calendar summary.
The next step will be to add a parameter to the links into the component that tell it to only show the current user's entries, also constrained via the extra SQL line, and that will make it so that users can see the whole calendar, with everyone's entries as well as a constrained calendar with only their entries.
I can then use that parameter to allow ANYONE to invoke the calendar component constrained to a single user to see that user's calendar.
No database changes required, since the created_by field handles this for me. Since for what I have in mind all calendar entries are public, I'm then done. If I wanted to, though, I could add a new field to the jos_events table, "public_entry" as a boolean value and allow users to set or clear that if they want. In my case, however, I have a different application that will store all of the ancillary data I need and simply reference the id of a calendar entry.
So for cases where one does not necessarily need a separate table per user, this is a reasonably easy modification.
Unless I missed something?