• Resolved justdave

    (@justdave)


    This is a PHP coding question about interacting with the Simple Calendar plugin from another plugin.

    I am attempting to use the simcal_get_calendar() function to load data out of a calendar and present it in a widget on the Admin Dashboard in WordPress. In this case it’s a bar chart with a bar for each of our chapters showing the percentage of organizations within each of those chapters who actually have scheduled events on the calendar, to remind chapter leaders to follow up with their members to get their meetings on the calendar if they haven’t yet. I have the same chart on a normal page and it works fine, but when putting it in the widget, it appears that the simcal_get_calendar() call is returning an empty calendar when called from an admin page.

    Looking at the code, it looks like it is purposely not loading the calendar retrieval code when loaded from an admin page, which is understandable because it’s probably a bit of bloat, so why load it when you don’t need it 🙂 I figured maybe there’s some way to trick it into loading when my widget is invoked, but I haven’t figured out how yet, so I figured I’d ask.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Contributor Nick Young

    (@nickyoung87)

    I believe you are correct in that it won’t load admin side because those functions are loaded only on the public facing side. So you would need to figure out a way to get the calendar by ID/post object/ or whatever method on the admin side. Without modifying the plugin directly I wouldn’t be exactly sure how to do that without looking deeper into the code for you, and that unfortunately is a bit out of the scope of the support offered here.

Viewing 1 replies (of 1 total)

The topic ‘Admin Widgets’ is closed to new replies.