Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

plugin devel. docs?

Quote Reply
plugin devel. docs?
Is there documentation available on how to develop plugins for GT Forum? Specifically, I'm looking for all of the hooks that I can interface with.

I'm looking to connect GT Forums with an existing user and group system; I'm hoping that I can avoid mirroring all of my existing group and group membership information in the Forum system. I'd prefer to have the forum system query my existing user database in order to determine whether a particular user can access a particular forum. Has anyone else done something like this?
Quote Reply
Re: [cmurtaugh] plugin devel. docs? In reply to
Hi,

No, there isn't a complete list unfortuantely. A good rule of thumb, is every do=xxxx action has an accompanying plugin hook called do_xxxx.

If you want to make an authentication plugin, I would recommend downloading Gossamer Community, install it and look at the private/Plugins/GForum/Auth_Community.tar plugin. This will override all of Gossamer Forum's user functions and authenticate a user off of another sql database.

Hope this helps,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] plugin devel. docs? In reply to
OK - I've worked out a solution to my authentication problem based on Michael Coyne's AutoLogin plugin. Users who I've already authenticated using my own system are automatically logged into GT Forum. The AutoLogin plugin automatically creates a GT Forum account for each user the first time they access the forum.

The remaining problem is how to authorize users for specific forums based on the user's group memberships in my own group system. I have thousands of groups and don't want to have to mirror all of this information in the GT Forum database. Instead, I'd just like to replace the code that checks a user's permissions with code that queries my own system.

It appears that I could just modify GForum::Forum::permission() to do this, but I'm wondering if there's a better way. I'm concerned that if I start making direct modifications to GT code, I'll be unable to upgrade in the future (without a significant amount of pain). However, I don't see a way to use the plugin system to accomplish this. Am I missing something?
Quote Reply
Re: [cmurtaugh] plugin devel. docs? In reply to
You probably want to set a PRE hook on 'auth_forum_permission' to overwrite the sub auth_forum_permission in GForum/Authenticate.pm. The interesting bit is hidden in the sub _load_forum_perm_cache.

Like this, you don't need to change the core code.

I hope this helps.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] plugin devel. docs? In reply to
Yes - that sounds like exactly what I need. I didn't realize I could override the auth_forum_permission sub with a plugin. I'll give that a try.

Thanks!
Quote Reply
Re: [cmurtaugh] plugin devel. docs? In reply to
I've written a plugin to (hopefully) override the auth_forum_perm sub, and I've configured it to be a 'PRE' plugin. Now, I can see my sub being called, but the original auth_forum_perm sub is still being called right after. I have this in my sub:

GT::Plugins->action('STOP');

but this seems not be working as I expect it to. How can I stop the original auth_forum_perm sub from being executed?
Quote Reply
Re: [cmurtaugh] plugin devel. docs? In reply to
Hi,

Remove the quotes around STOP, it's a constant which should get imported as long as you have:

use GT::Plugins;

at the top. Should look like:

GT::Plugins->action(STOP);

Turn debug on and tail the error log to see if it gets stopped properly.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] plugin devel. docs? In reply to
Yeah - I realized that shortly after my last post. It's working like a charm now. Thanks for your help.