I've been searching the forum and haven't been able to get the answer I'm looking for so I'm putting this out there to see what I am missing.
I've created a widget and I'd like to make it so the tab would only show up for those people in a specific group. Where can I modify the code for generating the tab to do this. There isn't something already built in I missed to do this?
Also I'd like to also deny access to this widget if a person tried to go directly to it. Now in the widget itself do I have to set the current group someway to do the tests if that person is a member using the functions a normal group would. Should I be placing this widget in the groups directory? Also I tried just using XN_Profile::current() to then grab group and look myself if they are a member of that group but when I print_r that I don't see group there, is there some other way I can get the groups a profile is attached to that I am missing?
Okay so I figured out why I'm not seeing what I want for the profile, it's because it's part of the user content. So now I have done a query using XN_Profile::current()->screenName against the title of the Content Store. Is this the way I should be grabbing this info?
Take a look at the /widgets/group/models/Group.php -> userIsMember( groupID)
It looks like you can skip telling the function who the member is - it will work it out for itself.
You could put a test for the group membership in the _before() function call in all of the widget controllers. This is run before the actual action is performed, so you could redirected the call if the user is not a member of the key group.
Cool, I'll definitely look into that to see how it handles it.
Any idea on the tabs? I'd prefer not to have to write my own new header just to replicate that so hoping there is some way to integrate with what is there.
Not sure exactly what you're asking there, Richard.
The easiest way to add a tab is to edit the file /lib/XG_ModuleHelper.php - you'll see where the various tabs are being added. Just replicate, say, the invite tab code, but using the name of your new widget. You could even put the group test around it so it is only shown to people who have access to it.