Sugar 6.1 just hit the streets a few weeks ago, and one of the more consistently heard critical comments is a change we made to not automatically invite people who organizers for calls and meetings ( meaning those who create the call or meeting ). This is a handy feature if you are a secretary or assistance and often schedule calls and meetings for other, so you would no longer need to remove yourself after the meeting is created or altered. But for everyone else it now requires the organizer to make sure they manually added themselves to each call or meeting they create if they wish to be invited. Fortunately, as pointed out on the forums, there’s an easy fix you can make via a logic hook to re-enable the old functionality that is perfectly upgrade safe. Let’s take a look.
To begin with, we will create the actual code that will encompass out logic hook. Since it will be shared by both the Calls and Meetings modules, we’ll put it at the top of the custom/ directory, and name it LogicHookAutoInvite.php.
set_accept_status($current_user, 'accept'); } }
The LogicHookAutoInvite::inviteCurrentUser() method does the simple task of invoking the set_accept_status() method for the current system user, setting it to ‘accept’ automatically. Now, so that our logic hook is executed, we’ll add definitions like the following in the custom/modules/Calls/ and custom/modules/Meetings/ directories, in the logic_hooks.php file.
<?php $hook_version = 1; $hook_array = Array(); $hook_array['after_save'] = Array(); $hook_array['after_save'] = Array(1, 'Auto invite user', 'custom/LogicHookAutoInvite.php','LogicHookAutoInvite','inviteCurrentUser');
Now, every time a Call or Meeting is saved the current system user with be auto-invited to the meeting, just as we did before Sugar 6.1.