It may be that this works and I'm not thinking correctly, but in the FCK Editor settings, one can make several profiles which depend on role. I have one for group owners, the same role I use this module for to apply that role to users. I don't see FCK's interface changing for users with the group owner role while they're in their group, but it seems to me that it should. I think that FCK does not know that they have the role for that group.
Also, holy crap! I can't believe you have another version again already. You certainly move much faster than I do. Where do you find the time?
Lastly, thanks for the links to my modules on your project page. Did you get a chance to check them out?
Cheers.
Comments
Comment #1
rconstantine commentedWait a minute. Nevermind. On a whim I changed one FCK setting and now it works. Sorry.
Edit: Scratch that!@#$%^ I was accidentally logged in as super user, not group owner. My original report stands. This doesn't work.
Comment #2
rconstantine commentedComment #3
somebodysysop commentedI think I still need to create those links. I know I haven't sat down to see how these two modules work together.
With respect to FCK editor, I don't have it or use it. What are the URL's that are in question? That is, what are the urls where you should have group context but do not?
For example, like "node/366/fck"?
Thanks!
Comment #4
rconstantine commentedSorry to not clarify. It isn't URLs that are the problem. FCK is the alternative to TinyMCE and replaces all (or as you set it) text areas with a WYSIWYG editor. So it needs to have a context in which to identify which profile (based on role) to use. For example, for my authenticated users, they see one profile which has a minimum of buttons such as bold, italic, bullet, and just a few more essential text editor functions. My admins have the full capability of the editor, as do a few roles that are assignable by admins and aren't handled via og_user_roles. A third profile splits the difference and includes many more text editor functions but leaves off those that will be least used - some of which are meant for the HTML/CSS savvy. I have assigned this last profile to the role that I give to group owners - a role which is auto-assigned by og_user_roles and specific to the group (of course).
The problem is simply that FCK is "unaware" that while in the group, this editor should show the buttons corresponding to profile three for this particular user, the group owner, rather than the minimal buttons of the standard authenticated user. So, the issue isn't in link generation, but in somehow communicating to FCK that in the group context, the role is valid. It may be that the FCK maintainer will need to accommodate your module as well - i.e. open up a tunnel of communication to accept input from og_user_roles.
As a side note to that last thought in the preceding paragraph - have you had any discussions related to context-sensitive roles being added to core? I think that although your module aims to get roles to be specific to each OG, that what you have really accomplished is context-sensitive roles. I would imagine that such a thing could be abstracted and applied in a variety of other circumstances and sort-of consolidate a lot of contrib modules, or at least make it easier for them to do what they do. I know you have had various discussions about access control and wondered if this was discussed.
Anyway, is that more clear?
As for the links, fourth from the bottom before "Notes" is mine (Compatibility with Content Type Administration by Organic Group module) and you also mention og_forum, which is mine.
Comment #5
somebodysysop commentedI was told by Gerhard that Drupal officially does not support permission changes "on-the-fly". http://drupal.org/node/170524#comment-597878
I don't use the FCK editor so I can't talk about it specifically. However, I am familiar with this sort of problem. Most of the permission problems in OGR are caused by the Drupal core cache system. See this as well: http://drupal.org/node/165723
My solution has been to turn on the OGR cache setting and apply the patch referred to here: http://drupal.org/node/177948
If this doesn't work, then we need to look at the URL. I recently resolved a similar issue with IMCE. I resolved it using this code, which, as you see, is URL specific. It basically says that if we are at this URL, and can't get the group context normally, then get it from the og_last session code.
I've also resolved similar URL issues by getting the group context from the referrer.
So, if clearing the cache doesn't work, then we'll need to know what the URLs are that are being passed when FCK loses group context. You'll need to turn on the OGR debug: http://drupal.org/node/164038. This will show us what the group context is, where's it's being lost, and what the URL(s) are at that point. Attached is an example from the IMCE debug output I created which helped me to resolve that issue.
Since I don't have FCK editor, you'll need to do the footwork on this. I wouldn't lodge an issue until we have a better idea of exactly where we're losing group context.
Comment #6
rconstantine commentedHmm. I think you must be coming at this problem from a different angle. I understand what you're saying in your last message but don't understand why you think it applies. OGR gets the group context just fine on the pages in question. I'll have to check what FCK is looking for, but it isn't concerned about group context - only roles. Does OGR set the roles on the $user object? I think FCK looks to the $user object to determine the role of the user. IIRC, I have already applied the cache patch you mentioned due to another issue I had previously. I'll double check. I'll also double check what FCK is looking for.
Thanks for the attention anyway. I'm also going to open an issue at FCK and point them here. Perhaps the maintainer has some ideas.
Comment #7
somebodysysop commentedYes. But, OGR can't modify the $user object if it doesn't have a group context.
If OGR is returning the correct group context, but the correct role isn't reflected in the application, then my guess would be that this is definately a cache issue.
Then again, because I don't know FCK, I could be totally off base. See what they say and let me know.
Comment #8
somebodysysop commentedI actually looked into this and wrote some conclusions below. Then, when I finally located fckeditor_profile_load, I realized what the problem might be.
This basically the code which determines the correct editor profile:
OG User Roles adds group roles to the user object. Because user_roles() is called directly here, OGR can't work it's magic.
If you could come up with a patch that works which will call $user->roles to get the roles here, that should theoretically resolve your problem.
Here are my original theories before I hit upon the above. Leaving just in case:
===========================================================
Looked into this a bit more. Have you reviewed this issue: http://drupal.org/node/203533
When "$user->roles" is called OGR adds group roles to whatever sitewide roles a user has.
So, if this problem has been fixed, then the next issue is: What is the group context when "$user->roles" is called? If OGR has none, and can't determine the group otherwise, then you'll get the problem you're getting. Using the OGR test option I suggested earlier would help you determine this.
The final question I had was: where is fckeditor_profile_load() in the code? I couldn't find it.
Finally, I noticed that this appears to be the code that determines the profile elements to use:
If OGR is returning the correct group context, but you're still not getting the correct results, then it's a cache issue, and the solution would be the one I suggested about clearing the cache.
If it wasn't so big and complicated, I'd try to install it myself. But, I did download and look at the code search around a bit. This is as much as I could come up with for now.
Comment #9
somebodysysop commentedWell, it gets even better. There are 3 places in fckeditor.module where "user_roles" is called. Search for it and you'll see. The first two should be easily replacable with $user->roles. But, the third looks like a problem:
This could be replaced with $user->roles and user_access('access fckeditor') code. However, the FCKEditor maintainer is going to have to want to make this module compatible with OGR for this change to happen.
Anyway, hopefully this gives you something to work with.
Comment #10
rconstantine commentedThanks so much for looking into this. I will roll a patch as soon as I can for the FCKEditor module. Hopefully, the maintainer will accept it. I wish I had time to go through your module's code more thoroughly so that I could have known that the compatibility issue was not with your module. I hope you found the exercise profitable; maybe you'll use FCK in the future...
Comment #11
somebodysysop commentedComment #12
sunAfter the rise of the rewritten OGUR 4.x for Drupal 6, in which many unrelated features of OGUR were removed, and nearing a release of Drupal 7, I'm closing down old issues.