HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Marking on "words" not strings within words
Am I wrong in that the "Discussion Marker" plugin marks the discussion even if the term is within another word? If so it is pretty unusable for us.
Is there a way to make it look for words (which of course could be delimited by spaces,commas, etc.).?
Tagged:
0
Comments
According to the source here: https://github.com/bleistivt/DiscussionMarker/blob/27544291eaef7062ada00ce2942a22f79520ae3b/class.discussionmarker.plugin.php#L67
The regex uses the word boundry character
\b
on the beginning and end so it should not match in words withing words.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Yes, it does
...in the new version I just uploaded.
@rbrahmson You can try out if the new version works for you
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Should have checked that commit time.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
To @hgtonight and @Bleistivt: Thank you -- this new version corrects the issue.
So a bit of confession -- I am not a programmer, not even an aspiring one, and I wanted the discussion marker plugin to also search the body of the discussion, not just the title. I decided to take a look at the 1.7 source and try something out- sort of a gamble. If it worked I figured I'd put it on this discussion as a suggestion. Well, the gamble worked for a very short while - until I discovered the substring issues which were fixed in Ver 1.8 but broke my code (if you can even call my amateurish changes code).
Here is what I did on Version 1.7 (changed marked with //PA):
and later on
and the next line changed to:
if (is_numeric($pos) || is_numeric($posbody)) {
These are all my changes to 1.7. I didn't expect it to work but it did. But now, these won't work any more because Version 1.8 changed the function...
Can someone implement this feature (possibly as an admin set option - performance was fine for my small forum) on the new Ver 1.8 (and I'm sure in a more professional way than I attempted).
I "inherited" this plugin from peregrine and had not changed anything until now, so when I applied the fix I also adapted it to the new coding standard and shortened the function a little.
With your extended functionality (wich doesn't look amateurish at all), it would look like that from line 63:
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanks @Bleistivt , before I test it just a thought - instead of searching twice in both the body and the title, would it be more efficient to concatenate the two (with a period in between to prevent inadvertent string matching) and perform one search on the concatenation?
(I do remember something from a PL/1 coding class thirty years ago;-)
I don't know, probably. I wrote it like that, because it's shorter and that is all that counts.
Minimal performance improvements are neglible if you can achieve cleaner code that is easier to maintain.
Most of the plugins execution time is probably spent dispatching to the event handlers or some other PHP magic, anyway.
Note that it loops over all the markers, so the number of markers you have has a direct influence on the speed.
I did a small test with 1000 markers. I didn't notice a speed difference.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
I want to thank @hgtonight and @Bleistivt for helping in directing, correcting, and updating this plugin. I took the most recent version 1.8.1, added @Bleistivt suggestion to modify the plugin to search the body of the discussion as well, and then I made a change to the options screen adding that body search as an admin option. Thus the update may be useful to all. Here are the changes:
To discussionmarket-settings.php:
To the class.discussionmarker.plugin.php:
Hope this will help someone and perhaps the plugin author (Peregrine?) may find it useful to add to the next version.
A clbuttic mistake.
My shop | About Me