I've switched to the -dev version to get alter_links for Advanced Forum, and now some weird things are happening. Among them are issues with the "edit" and "delete" links not showing up when I know I have the permissions. As an administrator, I should be able to edit all comments, but I can only edit my own. I've also heard complaints from my users (who can normally edit their own comments) that they can't find the "edit" button. I don't know if I'm having this issue with the "delete" button; I'm not as an administrator. Nodes are unaffected. This may or may not be related, but for some reason AF is not theming the "edit" button and is adding two <span>'s around the "delete" button. I've confirmed, though, that AF is not causing the issue by disabling it.

Comments

salvis’s picture

What are the permissions that should give you the 'edit' and 'delete' links? What makes you "an administrator"?

I must create a user like yours so I can look into this. Don't make me guess — tell me what I need to do to create such a user.

Oh, and double-check the "Permissions information" on the forum administration page to verify that you really have the settings that should give you the desired results.

meustrus’s picture

I am a member of a role which has all available permissions for the "comment" and "node" modules. I remember giving all Forum Access permissions in all forums to this role as well, but now it's grayed out (but still checked) the way the local moderator role is. The comment links display exactly as they should for user/1.

salvis’s picture

I cannot reproduce this issue. My administrator (not user 1) gets the 'edit' and 'delete' links on the comments just fine.

Please try this on a virgin test site (only forum and forum_access and acl).

meustrus’s picture

Hey, it just occurred to me...do I need to have the dev version of ACL installed, too?

Also...this is very strange, but I just deleted a comment and the "edit" link on the remaining comment displayed correctly. There were only two comments, and I confirmed that it's not because there was only one comment left...it had something to do with having just deleted another post.

salvis’s picture

Strange things going on indeed...

I don't think I can help you, that behavior is not part of Forum Access.

Again, try this on a virgin test site (only forum and forum_access and acl). Then build up from there towards your production set-up to find out where things start to go wrong.

ACL is used for the moderator functionality only, so this can't make any difference here.

meustrus’s picture

I'm looking into the issue myself now, so I'll post what I'm finding out.

I'm beginning to suspect that Forum_Access might not be the cause for the weird thing with the edit link not showing up when it should, although I don't know. What I do know is that a problem I was having in the combination with Advanced Forum, that the <span> tags got added twice, is being caused by Forum_Access in the link_alter function. Under the circumstances I detail here, the links get completely rebuilt and when the links are rebuilt with this code:

      if (!isset($user1)) {
        $user1 = user_load(1);
      }
      $saved_user = $user;
      session_save_session(FALSE);
      $user = $user1;
      $admin_links = module_invoke_all('link', 'comment', $comment, array_search('comment_parent', $links) !== FALSE);
      drupal_alter('link', $admin_links, $node, $comment);
      $user = $saved_user;
      session_save_session(TRUE);

The hook_link_alter functions of other modules, including Advanced_Forum, are being called. If those functions alter the output of forum_access_link_alter, the link gets altered twice. I think this function could do with some major redesign, because while this part of the code is supposed to create links that the user has permission for but aren't in link_alter, it really recreates ALL links, and may be ignoring permissions from other modules because when it builds the links that are eventually returned those other modules think they are building it for user/1.

Update: It looks like the issue with the edit link is most likely a problem with Authcache, which was exposed by the the combined update of Advanced_Forum and Forum_Access both switching to a link_alter based mechanism instead of a preprocess_comment mechanism.

salvis’s picture

Title: Links not handling permissions properly on comments » [Authcache] Links not handling permissions properly on comments
Status: Active » Closed (cannot reproduce)
Issue tags: +authcache

Now you're finally mentioning Authcache? You're wasting our time here.

The Authcache front page specifically says that it only works if all pages are the same for all users with the same role. Authcache gives you static pages per role (it is unclear whether it can deal with users having more than one role). You can't expect dynamic content on static pages...

Please, don't ever post an issue or follow-up again based on what you see while Authcache is running, in any queue (except the Authcache queue, of course).

This thread is moot. If you'd like to discuss misbehavior while Authcache is NOT running, then please open a new issue.

meustrus’s picture

Status: Closed (cannot reproduce) » Active

Now hold on there, the thing with Authcache only applies to the edit link. There's no need to be such an asshole. If you bothered to read what I said, there is a legitimate and easily reproducable problem with the links being processed with hook_link_alter twice. This is present on the delete link and the quote link when using advanced forum; advanced_forum_link_alter is called twice and therefore the <span> tags are added twice, producing wrong behavior.

I wish that you paid as much attention to my other issue as you did to bashing this one. It would seem that you're only interested in addressing an issue by claiming it is completely invalid, and not by ever actually helping.

meustrus’s picture

Title: [Authcache] Links not handling permissions properly on comments » hook_link_alter being called twice under certain situations
Issue tags: -authcache
salvis’s picture

Status: Active » Closed (won't fix)

There has been strangeness in this thread that I have not been able to understand, and I don't know where to draw the line.

It would seem that you're only interested in addressing an issue by claiming it is completely invalid, and not by ever actually helping.

Thank you, we're done.

meustrus’s picture

Status: Closed (won't fix) » Active

You can't just ignore a standing issue. I'm willing to fix it all by myself if I have to; all I want is to know the original intent of that code, and I can produce a patch that preserves the original intent and fixes the issue of calling hook_link_alter twice every time.

salvis’s picture

Status: Active » Closed (won't fix)

You underestimate me — I can.

And I don't accept your abuse in #8. If you want to apologize, then you can reopen this issue.

meustrus’s picture

Status: Closed (won't fix) » Active

I'd like to believe you'll take this statement seriously, but history suggests you won't. Nevertheless I'm not comfortable getting into a shit fight over this, so I'll try to explain myself as calmly as possible.

In my entire experience on your issue queue, my bug reports have followed this pattern: Post issue, get asked questions, answer questions, get told the issue isn't there/can't be reproduced/won't be fixed. The first time your "solution" was that I separate the issue into two separate issues. I did that, and was told again that you couldn't fix the issue. I was only mildly annoyed at this point, but I understood that you have finite time to be dealing with my issues so in good faith, I looked into it myself. It turns out that the entire issue I'm having, which is now in two issues, comes from the exact same place with very nearly the same problem, so I feel at this point that it was wrong to split the issue in the first place. Besides ending up being wrong, I feel that your demand unnecessarily wasted both of our time in reading/writing new issues and waiting for new responses.

Now the brick wall I'm coming up against is that despite my specific and concise descriptions of the underlying problem and a potential solution, you refuse to consider anything I have to say because I'm using a module that has obviously caused you plenty of grief in the past. I can understand how Authcache makes you mad when trying to deal with issues people post to Forum Access; I've created an Authcache issue (that still hasn't been addressed) that directly addresses its compatibility with modules like Forum Access that redefine permissions for the links. That problem seems to be the core of the issue on this page, but there's still another arguably smaller problem with the 6.x-dev code that converts Forum Access to hook_link_alter.

I'd like to have some kind of redress for your obstinate refusal to maintain your project. In the absence of any obvious moderation features in the issue tracker, I feel like harassing you like a 4chan asshole. Instead I'm typing this out in the possibly misguided hope that you will take me seriously just once.

Having explained myself, I am willing to apologize for what I said in #8. It was a quick vent of my frustrations described above, and I felt I was just returning your own attitude back at you. I'm sorry for being mean myself, and I hope you can understand why I felt that way at the time. I also hope that I am mistaken in the opinion I've gathered of you, and I'm willing to revise it based on how you respond (not that my opinion matters to you in and of itself, but if we can understand each other better this incident hopefully won't become more than a passing annoyance and we can move on to what both of us really want: to make Forum Access better)

salvis’s picture

Your "history" with me is infinitesimal compared to my history here on d.o. I think you are the third person that I'm having trouble with in more than four years. That seems to indicate that the problem is not necessarily on my side.

Based on the little that you know of me, sentences like

I'd like to believe you'll take this statement seriously, but history suggests you won't.

are completely uncalled for. Even if you had reason for such a statement, it is not helpful if you're trying to re-establish communication. You have to work on yourself there...

Of the four threads where you participated in this issue queue, one was a duplicate (you failed to check before posting), one was a hijack (the OP had closed it), and the other two are the result of what you should have done in the first place and they're still pending.

In my entire experience on your issue queue, my bug reports have followed this pattern:

You have no experience in this issue queue.

The first time your "solution" was that I separate the issue into two separate issues.

I did not provide a solution. I simply restored the previous status to fix the AdvancedForum thread that you had hijacked. (#1042746-9: Incorrect handling of comment links (interraction with Advanced Forum alpha4))

I was only mildly annoyed at this point, but I understood that you have finite time to be dealing with my issues so in good faith, I looked into it myself. It turns out that the entire issue I'm having, which is now in two issues, comes from the exact same place with very nearly the same problem, so I feel at this point that it was wrong to split the issue in the first place. Besides ending up being wrong, I feel that your demand unnecessarily wasted both of our time in reading/writing new issues and waiting for new responses.

What you feel is irrelevant. Fact is, that we have two simpler issues now rather than a complicated and hijacked one, and if what you write is true, we need to solve only one of the two simpler issues and then the second one will go away all by itself. This is more progress than I had hoped for and definitely worth your inconvenience.

Further fact is (I presume) what you wrote in #8:

[...] the thing with Authcache only applies to the edit link. [...] there is a legitimate and easily reproducable problem with the links being processed with hook_link_alter twice. This is present on the delete link and the quote link when using advanced forum;

This means we haven't split it up sufficiently yet. We need to split between 'edit' and 'delete'/'quote'. If you had done your homework in the first place, you would have set up a virgin test site and found out exactly what (mis-)behavior is caused by which module combination, rather than sending me on a goose chase by posting a mixed bag of problems that I may or may not be able to reproduce.

After we (actually you) said good bye to AdvancedForum for this issue (#1042746-8: Incorrect handling of comment links (interraction with Advanced Forum alpha4)) you're dragging it back in? Sorry, but the onus of remaining focused and boiling this down to the bare essentials is on you, not on me. I have plenty of other more focused issues to deal with.

I can understand how Authcache makes you mad when trying to deal with issues people post to Forum Access

Not at all. I had never heard of Authcache before, but when you read its front page text then it's obvious that it can cause all sorts of problems of the type that you come here to post as FA bugs. Do you really think it's plain stupidity on the part of the Drupal core developers that they prepare each page specifically for the logged-in user, if it could just as well be prepared and cached only once for each role? The description is quite clear: Authcache essentially breaks Drupal, but you may be able to get away with it, if all the pages are the same for all users with the same roles. This is obviously not the case when you give moderator rights to one user, and there's no way to know what other odd side-effects the (unreleased!) Authcache can have.

How can you expect to get any support when you willingly break your installation and you don't bother to restore normal Drupal operation before shouting "bug"? If you don't understand this, then keep rereading it until you do...

I'd like to have some kind of redress for your obstinate refusal to maintain your project.

This is ridiculous. I'm spending hundreds of hours maintaining this project. I just refuse to deal with issues that are posted with an uncooperative attitude. I may very well put in a couple of hours of time (that I could otherwise spend with my family) to look into this very issue when the next person comes along and reports it in a reasonable way, but so far you seem to be the only one with this problem, out of 7000+ known installations of Forum Access. I'm sure you understand that other things like porting my other modules to Drupal 7 have higher priority than dealing with this obscure and unpleasant issue here.

I feel like harassing you like a 4chan asshole. Instead I'm typing this out in the possibly misguided hope that you will take me seriously just once.

I've always taken you seriously, maybe too much so. In fact I've just today spent an enormous amount of time and energy, definitely more than I ought to spend for one out of 7000.

Oh, and do learn to express yourself with proper vocabulary. If you want to be taken seriously, then restrain yourself.

Having explained myself, I am willing to apologize for what I said in #8.

Thank you, I accept your apology, and this post is what you got in return — certainly more than what you paid for. Now please repeat for #13 and make it shorter, cut out all the snide remarks, and we may finally be able to get to the technical issue.

You wrote in #6

I'm looking into the issue myself now

and in #13

I was only mildly annoyed at this point, but I understood that you have finite time to be dealing with my issues so in good faith, I looked into it myself.

I'm not sure how you meant this, but based on the other things that you wrote I got the impression that you think I have an obligation to work for you, and that you're doing me a favor by 'looking into the issue yourself now.' The opposite is true.

Contributing is the normal case. You are expected to contribute in some form or other. If you can do PHP, you are expected to 'look into issues yourself' and to provide patches to fix the bugs that you find, especially bugs that no one else reports. In return you get to use our software for free.

If you need support, assistance, bug fixing, etc. you can try to ask nicely and fully cooperate on our terms, then you may get what you need. If you don't, especially if you're unable to sustain a pleasant and productive relationship, then you'll have to pay someone to work for you, and then you can be as nasty as your funds allow.

Not only do I only have 'finite time to be dealing with [your] issues', I have no obligation whatsoever to spend any minute of my life for your issues. Instead, we'll soon have plenty of contributors (all following your good example) who are standing by, ready to help anyone who might come along. I've spent quite some time on you now, because I hope that you'll eventually see the light — don't disappoint me...

So, please, change your attitude completely, work for Drupal, and then Drupal will work for you.

meustrus’s picture

Status: Active » Needs work

Alright then, I'm sorry for all the misunderstanding and I'm sorry that I made you expend so much effort explaining yourself. That message you wrote was a beast. I only expect you to maintain your project so far as any new patches don't break anything, and in this case since it seemed you either couldn't identify my problem or (as I leaned towards before) refused to do so, I identified the problem myself. The only reason Advanced Forum factors into this is because it's the module that uses hook_link_alter that I have the most experience dealing with. The problem is not in integration with that module specifically, but with any project that uses hook_link_alter.

I would really like to start over without all the nastiness that I'm primarily responsible for. Since the issue remaining in this thread is relatively small and closely related to the other active issue, at this point I would like to mark this as a duplicate of the other issue and merge the one true issue with FA - that hook_link_alter ends up being called twice under specific circumstances - with that other issue (#1055672: hook_link_alter quirks (removing links and causing other modules to alter twice)). Or, I could start an entirely new issue. Either way the subject would end up as "Quirky effects from new hook_link_alter code" and encompass the double-call of hook_link_alter and the removal of links other than "edit," "reply," and "delete." To clarify, I intend to take responsibility for writing patches myself and only want to know the original intent of the author of that particular code. I assure you that despite any social failures, I am more than competent with PHP.

salvis’s picture

Status: Needs work » Closed (duplicate)

Thank you, it's nice to see that we found common ground.

So let's continue with #1055672: hook_link_alter quirks (removing links and causing other modules to alter twice).