Fork me on GitHub
Current releases are 2.1.3 (9 Sept 2014) and 2.0.18.13 (5 Aug 2014)

Ready for 2.1? Find out if your plugins are compatible. 2.0 will no longer be updated after Dec 2014.

Comment Links

2

Comments

  • MarkMark Vanilla Staff
    Found a bug with this extension where it will requery the comment table for every comment on the page when viewing discussions with multiple pages. Had someone email me about it when a 32 page discussion was insanely slow the further into it you got. Did some extension switching on/off and discovered that this extension is the culprit. I haven't looked into it any further than that.
  • MarkMark Vanilla Staff
    Ahh - I see it's where you look for prior whispers && deleted comments.

    I wonder if there's a better way to do this?
  • Yep, thats needed to properly number comments on subsequent pages...

    Maybe something like SELECT COUNT (*) FROM lum_Comment WHERE DiscussionID = x CommnetID < y AND WhisperToUserID > 0 OR Active > 0

    where X is the discussion, y is the comment id of the first comment on that page... we must TEST! ::laughs like an evil scientist::
  • MarkMark Vanilla Staff
    Thought about this some more overnight. Why not use the Focus querystring parameter like the search page does? The way that one works is: you give it a comment id and the discussion id like this: http://lussumo.com/community/discussion/5649/?Focus=70586#Comment_70586 What that will do is search through discussion 5649 until it finds a page with comment 70586 in it and then it will stop and jump down to the inline anchor #Comment_70586. That way you don't need to do any extra queries - it is all handled during the focus.
  • I didin't use focus because it requires a discussion ID, and I wanted a method that would always link a comment in case it was moved from one discussion to another. Also wanted links that wouldn't break if friendly URLs is later turned on or off.

    side note: focus reveals a bug in comment links: this page starts numbering comments from 1 despite the comment being on page 8. I know its possible to fix that, but have been too busy lately to do much non-work related coding.


    Regardless, using focus still wouldn't speed up loading large paged discussions. Commenting out lines 84-98 (if block after 'count the whispers' comment), then setting $Number = $Context->GetDefinition('CommentLinks_Permalink'); on line 104 (just before 'uncounted comments should not be numbered' comment) will remove the numbering and its calculations and speed up the comments page loading.

    I got some promising results with some ad-hoc SQL, still need to test on a discussion with more than two pages... also should use the date posted time instead of CommentID in the where clause. I suppose it would be a good idea to make this an option in the next version, so that it can run without any extra DB queries.
  • Comment Links broken in Safari 3...
    Fatal error: Cannot redeclare commentlinks_locatecomment()
    (previously declared in /path/to/forum/extensions/ReportPost/default.php:45)
    in /path/to/forum/extensions/CommentLinks/default.php on line 135

    Posted: Wednesday, 13 June 2007 at 8:50AM

  • I think you'll find that issue arises from use of the ReportPost extension and CommentLinks at the same time cause I was too lazy to rename the function names used to locate the comment. I'm pretty sure i fixed it in the latest version of ReportPost though...?
  • Yah, I took a look, its fixed in Report Post 1.1

    Javascript bugs that keep the copy menu appearing a second time are still around in Safari. Maybe with this Safari for Windows I will be able to squash them.

    Wanderer, didin't you have problems with CommentLinks causing slowdowns also? Were they on discussions with many comments in them?
  • I am happy to say that Comment Links (tested on this forum) works perfectly with Safari 3! (The copy menu appears every time!)

    I'm not sure Comment Links was the cause of the slowdowns, it might have been coincidental.

    Posted: Thursday, 14 June 2007 at 5:06PM

  • MarkMark Vanilla Staff
    I didn't use focus because it requires a discussion ID, and I wanted a method that would always link a comment in case it was moved from one discussion to another.

    Well, considering that isn't a feature of the core package, I wouldn't concern myself with it - unless I was the author of an extension that allowed such a feature.

    Also wanted links that wouldn't break if friendly URLs is later turned on or off.

    It won't break if you use the GetUrl function.

    Regardless, using focus still wouldn't speed up loading large paged discussions.

    Yes it would - because there would be no need to parse through previous pages looking for inactive or whispered comments - this parsing would be done on the fly by the focus after the click.
  • URLs would still break in this scenario, using focus:
    1. Users make a posts with a link to comment X, Y and Z while Friendly URLs is turned on.
    2. Forum admin turns off Friendly URLs and removes the .htaccess file.
    3. URLs embedded in posts are now broken.

    I still stand by my speed argument, as the parsing through prior pages happens not only when following a link but also when the extension needs to know what to begin numbering of comments with on pages > 1. Its not as simple as multiplying number of comments per page by the page number when you throw whispers and deleted comments in the mix, because page 2 should start on discussion comment number 45 if page one had 4 whispers in it.

    I attempted to get consistent numbering across pages for all users--so that if somebody says "John, in comment #45, you said 'blah'", and John happened to be whispering to someone else earlier in the discussion he would see comment number 45 on page 2, while everyone without whispers would see it on page 1.

    The slowdown is actually caused by code I borrowed from your focus routine--although in retrospect my use of that code in regards to numbering is inappropriate because a more efficient solution is possible with a SQL query. Another solution that wouldn't require the extra query or looping through prior pages would be to expose the CommentID visibly in the comment link, (Woot does this, as all Community Server forums) but I preferred to keep things clean and number the comments starting from one in each discussion. Woot's huge IDs are really ugly, IMHO.
  • Wallphone - numbering consistent between users due to skipping whispers works for a particular moment, but isn't stable over time if people are free to whisperize and dewhisperize comments.

    Where does this lead? Use of comment IDs if you want unbreakable identification. I guess it puts number-within-thread in the category of an informal name - useful, but dangerous if people think it's fully reliable.

    Don't think it implies need to change the extension - just state of awareness of users.
  • Yah, true. Even if an administrator deletes a comment it will change the numbering.

    I don't feel there really is an appropriate way around this, as changing the numbering to count whispers and deleted comments will leave a odd gap in the numbering that would hint a comment has been whispered or deleted there.

    I'm also in the camp that says you shouldn't reveal database IDs... (a lot of recent discussions complaining about showing them in URLs) but some times it's unavoidable. Showing comment IDs wouldn't reveal whispers as the numbers are not going to be entirely sequential anyway... so maybe I will make this an option in the next version.
  • Hi, I do like this add-on. Strange thing I've found is that the 'Copy URL as...' JS dropdown has stopped functioning for me, although the permalink functionality still remains.

    I'm thinking it is the fault of another extension so I will try testing this extension whilst turning off the others...will post again with results...
  • JQ Thickbox and UserInfo ToolTip once conflicted with it. In those cases, it had to do with the onload body function conflicting. There is a workaround method I have used in Code Prettify to attach to this without conflicting, but haven't tested enough and have two other complex issues to roll into it before another release. Yes let me know what you find, I may be able to straighten it out.
  • How can I disable the popup menu? All I want is to have the hyperlinked comment ID number next to each comment.
  • Near the top of the default.php is this line: define('CommentLinks_CLIPBOARD', 1);

    Change that one to a zero
  • "Hi, I do like this add-on. Strange thing I've found is that the 'Copy URL as...' JS dropdown has stopped functioning for me, although the permalink functionality still remains.

    I'm thinking it is the fault of another extension so I will try testing this extension whilst turning off the others...will post again with results..."
    Hey, I discovered that the Notify extension must be causing this behavior - turning it on/off disables/enables the dropdown.

    Not sure why though. I'm having other difficulties with the Notify extension (when you click to subscribe or unsubscribe, the three green loading dots appear but the change never completes) so perhaps the Notify extension is unstable... I'll have a sniff over on it's discussion.
  • This is just a suggestion.

    Can you integrate the permalinks to work with the Add This button which will be located at the bottom of every comment?

    I believe this combo will create something more useful and versatile than the social bookmarking extension(the icons are just too much, too small and some links dont work well among other problems).

    Humbly awaiting your reply.
  • You want the AddThis button to appear inside the menu? Or just appear alongside the comment links using the same URL structure? Interesting idea.
  • I want it to appear alongside the comments links using the same url structure.


    But out of curiosity, I'll love to know how to make it work if it appears inside the menu
  • image
    As you can see, it actually works quite nicely inside the menu, but it is extra work.

    To get it in there, you have to edit the CopyMenu.js file, and change the last line of the BuildMenu() function, I just used boilerplate AddThis code, so yours may look slightly different. To link to the comment instead of the page itself, note that I used BaseUrl+'?CommentID='+CommentID instead of document.href in the AddThis code:return Menu+'<dt>Bookmark</dt><dd><a href="javascript: location.href='http://www.addthis.com/bookmark.php?pub=addthis&url='+encodeURIComponent(BaseUrl+'?CommentID='+CommentID)+'&title='+encodeURIComponent(document.title);"><img src="http://s3.addthis.com/button2-bm.png"; title="Bookmark using any bookmark manager!" border="0" height="24" width="160"></a></dl>';
    The <dt> tags denote a menu title, which includes a bottom border line so you may want to just skip the extra code in those and just add the <dd> tags.

    Next thing I had to do is make the menu wider to fit the button. To do this, edit CopyMenu.css, and change the middle two lines, width and left. I am using px instead of em since the button is sized in pixels instead of font character widths:.CopyMenu dl {
    background: #fef9e9;
    border: 2px outset #ffedae;
    position: absolute;
    width: 188px;
    left: -188px; /* Always should negative value of the menu's width */
    overflow: hidden;
    font-size: 12px;
    line-height: 150%;
    z-index: 65535;
    }





    Now, putting it alongside is much less work. To do that, edit the default.php file, and around line 125 you will see this code:$CommentList .= $Link .'">#&nbsp;'. $Number .'</a>';

    Make a new line underneath that, and modify your AddThis code to look something like this:$CommentList .= '<a href="javascript: location.href=\'http://www.addthis.com/bookmark.php?pub=addthis&url=\'+encodeURIComponent('. $Url .')+\'&title=\'+encodeURIComponent(document.title);"><img src="http://s3.addthis.com/button2-bm.png"; title="Bookmark using any bookmark manager!" border="0" height="24" width="160"></a>';

    Take note that again location.href was replaced with '. $Url .' and single quotes already inside the addThis code got escaped with slashes before them.
  • Thanks man. I really appreciate your prompt help.

    You should prolly integrate the addthis button with your extension with options in the admin whether to use it below the the permalink or in the menu or not to use the addthis button at all.

    You can even port the sharethis plugin for wordpress since addthis is more like a third-party.
  • sorry if I sound too demanding . But I've just realised that having a addthis button in every comment is not the best thing.

    I think I'll prefer it if it only appears in the comment at the top of every page in a discussion.
  • For that, there is a RowNumber that you can easily check:if ($RowNumber == 1) {
    $CommentList .= '<a href="javascript: location.href=\'http://www.addthis.com/bookmark.php?pub=addthis&url=\'+encodeURIComponent('. $Url .')+\'&title=\'+encodeURIComponent(document.title);"><img src="http://s3.addthis.com/button2-bm.png"; title="Bookmark using any bookmark manager!" border="0" height="24" width="160"></a>';
    }
  • JQ Thickbox and UserInfo ToolTip once conflicted with it.

    In those cases, it had to do with the onload body function conflicting. There is a workaround method I have used in Code Prettify to attach to this without conflicting, but haven't tested enough and have two other complex issues to roll into it before another release.

    Yes let me know what you find, I may be able to straighten it out.
    could you give it a go?
  • Yah, I think its about time I dusted that one off.
  • Hi! Trying this extension and it doesn't work on my set up. Fresh install of vanilla and comment links, moved /extensions/CommentLinks/CommentLinksTheme/search_results_comments.php to /themes/vanilla/styles/default/, edited :var BaseUrl = '/my_vanilla_dir/' in /extensions/CommentLinks/CopyMenu.js and still nothing... Using FF 3 on Mac OS X 10.5.6, comment links work here but not on my test install. Any idea what might be wrong? Thanks in advance! Ricardo
  • The theme is only needed if you need the links on the search results pages, and you shouldn't have to edit the .js... What isn't working? Does the number appear but not the menu?
  • FF 3.0.10 Windows Vista
    Copying to clipboard doesn't work here at getvanilla and at my own install (using comment links version 1.3.1). It works with the IE7 though.
2
Sign In or Register to comment.