Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Auo link plugin
audioshop
New
Hello,
some strings auto link while others do not , anyone know of this ?
Tagged:
0
Comments
Can you provide examples?
http://www.nzgirls.kiwi/discussion/72/nz-massage-parlours
Half don't auto link , all are set in .php file
Code used : http://textuploader.com/8y74
Running private forum on Vanilla 2.1.11 VBS3 theme. I also see the random effect.
Here are the definitions within the plugin code:
Here is a sample test discussion body (there are no html tags in the text):
And here is the resulting discussion display:
ibm apple google ibm motorola facebook twitter vanilla ibm hp ibm.
Did you read the read me file?
Each word to search for must be between 4 and 15 characters.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thanks @vrijvlinder, I didn't see that file - I wrongly assumed that the description in the forum is all I needed and then proceeded directly to class.autolink.plugin.php to set it up.
But that brings up at least two follow up observations/questions:
I presume the 4-character minimum is designed to prevent false positives since tagging by users is uncontrolled. But the url links are only set by the admin, in which case the risk for false positive is minimal. So for example, if I wanted to support "IBM" and "HP", which are shorted than 4 characters, while limiting the tagging autolinks to more than 3 characters, how would I do that (and I admit not being a programmer, I don't understand how the search function works in the code).
I also have the PrefixDiscussion plugin modified to search prefixes across the title and discussion body (not the comments). Is this a bad approach as now I have two different plugins that search content before displaying the discussion list (or perhaps I don;t understand how the system works and there is really no double-search)?
Somehow there is some formatting error above - the two questions both have #1, the second appears as a nested question...
The function to look at is this one:
It mainly consists of three lines of code and if you look at them, you'll see that there is more than one time
{4,15}
in the second line. That's where you have to make changes.Each plugin will fire up extra, so if you have a plugin that auto links, another replaces smilies, another one that does other markup, they are all fired one after the other. It might be faster if you are able to do all this replacements in one loop, but that a) isn't always possible and b) would make each function hard to maintain and c) wouldn't speed up your page significantly.
Each plugin has its own function and if you would mix up your version of PrefixDiscussion and AutoLink, you would have to overwork your version if the author of one of those plugins releases a new version with bugfixes or other improvements.
Thanks @R_J , so I won't concern myself with the performance and stick to the functionality. I even see the 4 and 15 in the code you included (though I don't pretend to understand it). But if I change 4 to 2 there will be many false positives because users can tag anything at will, so how do I change it to 2 only for urls but keep the 4 for urls?
Sorry, I do not understand and I think I wouldn't be able to tell you so. But you can find it out yourself, I guess: there are only three regexes in the code.
(\/?-?\??\=?\b\p{L}{4,15}\b)
(\b\p{L}{4,15}\b \b\p{L}{4,15}\b)
(\b\p{L}{4,15}\b \b\p{L}{4,15}\b \b\p{L}{4,15}\b)
You can get try them with an example text and find out what each of there regexes stand for by using some regex helper like that: https://regex101.com/
@R_J , I fully understand that if I change the "4" to "2" then the plugin will autolink 2-character words and thus HP and IBM urls will work. Alas, the plugin also a autolinks tagged words, and since many forum users can add tags at will, there will be a lot of false autolinks (e.g. people will create tags like "do" and then that word will be auto-linked all over the place). Having 4-character minimum minimizes that risk.
Now to my question, given how the plugin is designed, it seems to my unprofessional eyes that logic change may be required, beyond my minimal skills. I am basically asking "how could the plugin require 4-character minimum for tagged words while 2 for urls".
I am now in the process of duplicating the plugin, calling a second version with a different name, and changing the second to support 2-characters. My intent is to use the second to urls only and the first for tags only. I don't know if this would work, but even if it does, it looks like a kluge...
First off - Hi @vrijvlinder
You made a good point, I can't even begin to fathom how people install plugins and themes without reading the readme's or documentation. Seems like a no-brainer if you don't.
second.
a few suggestions to some new users I've seen recently.
try experimenting and creating a test forum, so you can test and experiment yourself without putting a burden on volunteers with "I'm not a programmer" please do it for me.**
@rbrahmson
I removed autolink plugin because it could affect performance on a big forum,
but gave Vrijvlinder permissions to redistribute and maintain as she wants.
but on a small forum
you could go a couple of ways.
learn how to do this in vanilla
http://stackoverflow.com/questions/6807231/querying-where-condition-to-character-length
and modify the sql statement to only pick up tags greater than a certain number of characters.
The sql statement to modify should be obvious as it starts with sql.
within the program.....
the {4,15) has absolutely nothing to do the auto tagging. It only affects auto-linking.
auto-tagging - is linking to tags in tag table.
auto- linking - is linking your self entered single word to 3 word phrases.
change the population of the array to only use tags from tag dabase that are 4 or more characters.
from
to
as usual
peregrine sez:
click here for FAQ http://vanillaforums.org/discussion/28420/faq/p1
click here for http://vanillaforums.org/discussion/20231/how-to-become-somewhat-adept-at-modifying-vanilla-to-meet-your-needs-for-free
since many answers just lead to a litany of more questions, I'll stop here and say your questions have been answered rbrahmson.
As rj said and vrijvlinder said to change to 2 characters for self links just change to {2,15} or better yet find out the max characters and min characters in your searchwords in wordarray and use those as the delimiters.
and since you are only using one word you can remove the matches for two and 3 word phrases.
as an admin if you have tags that make no sense e,g, "do" as an admin it would make sense to delete them.
over and out.......
Also remember - just because a plugin or theme doesn't do what you want it to do, doesn't mean it is broken.
Ofter the developer picks constraints and artificial boundaries to meet the requirements of what they say the plugin or theme will do. Just because a person wants another feature doesn't necessarily mean a plugin or theme is better with that feature, nor does it mean the developer should feel obliged to change, add or provide help.
People should be glad that at least someone took the time to provide something that worked as specified.
P.S. Anyone who feels that this answer is rude and insulting, please feel free to attack, since it will be another six months or more before I respond again.
This discussion should have been split by a moderator and the title corrected. oh well.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine -I appreciate your suggestions and I will definitely search for readme files from now on. It may have been obvious to you (I mean the programmer community) but was not to the unprofessional and therefore your above list of suggestions/mini-guide is most welcome!
As to the specific plugin at hand - I also appreciate your note on the performance hit. Fortunately our contemplated forum for which I've been asked to evaluate Vanilla will be made up of small number of users and posts - nothing like what I gather from the participants in this forum. So I can live with the performance hit.
I will certainly look at the coding hints you mentioned, but just in case some other poor soul like me is interested (possibly the gentleman who started this discussion), as an interim solution I duplicated the plugin, called it by a different name, made the appropriate changes to form variables as well, and modified the number from 4 to 2. I then set the original plugin to search for tags only (which will work on tags greater than 4 characters), and the new one on URLs only (which will match URL keywords on 2-15 characters). That is probably a worse solution from a performance point of view, a real quick and dirty solution, but it works.
And a short follow up: Going further with @Peregrine's suggestion, I went and played with the code. The first method to change the SQL didn't work. This is what I did:
That returned no rows even though I had rows with tags longer than 3. I'm not sure why.
I then went to the second option, and it worked flawlessly:
Thus I was able to do it all in one modified plugin, and discarded the temporary 2-plugin method. Again, thank you @Peregrine!
because you have incorrect syntax, it should be like this
that said, one would need to test which is faster. option1 (restrict via sql) vs option2 (ignoring sql and during loop and population of tagarray )
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks again @peregrine, my mentor! When you say that I should check the performance I'm sure you are directing me to some new mountain of knowledge. So first let me say that we're running in a shared hosted environment where we can't install products so I won't be able to install any monitoring tools. BTW, I'm running under PHP Version 5.4.40.
So I searched a little bit and found this bit of code which I could add to the plugin and check which works faster:
I could easily do that, but I'm not convinced that running on a shared server this would be reflecting much, and how many times do I have to do that to get enough samples that I can average and rely on.
I probably need to replace the "echo" with something that writes to a log file.
This entire performance research is more educational than practical since my forum is small and neither methods would affect performance, but now I got curious...
@peregrine certainly not only knows about log files, but already has shared his knowledge!vanillaforums.org/discussion/26786/tutorial-how-to-enable-a-debug-log-and-collect-debugging-information
To your question how often you have to test that: the higher the better. Try to loop it as many times before you get a timeout.
I agree that a shared hosting server is a bad test environment. Why don't you create a local copy of your forum so that you can really test things without having to fear you break something?