1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Making "spoiler" not searchable?

Discussion in 'Styling and Customization Questions' started by Nutz, Mar 21, 2016.

  1. Nutz

    Nutz Member

    We have an annual scavenger hunt on our forum and were using the spoiler feature. We have found that many members were cheating their way around this by searching the word "spoiler". :D

    Is there a way to exclude the word "spoiler" from xenforo's search or change the title of the word spoiler to a word three letters or less so that it is not searchable?

    Thank you in advance.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    They would still be able to work around it using the browser console.
     
    Nutz likes this.
  3. Mr Lucky

    Mr Lucky Well-Known Member

    How about instead using white text on a white background, like this:

    Can you find this?

    Or: very small
     
    Nutz likes this.
  4. Nutz

    Nutz Member

    I think the browser console would be a far stretch for the majority of members. Would there be a way to exclude it from searches?

    The white text is an extremely creative idea, thank you. If I don't find a non searchable option that might work. :)
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    There's unlikely to be a way that doesn't require custom development or an add-on.
     
    Nutz likes this.
  6. Nutz

    Nutz Member

    Well, it didn't hurt to ask. :D

    Thank you very much for your replies.
     
  7. Daniel Hood

    Daniel Hood Well-Known Member

    Not sure if you're comfortable editing files (and it's usually frowned upon). If so, at the bottom of /library/XenForo/Search/SourceHandler/MySqlFt.php you can change
    PHP:
    public static $stopWords = array(
    to
    PHP:
    public static $stopWords = array('spoiler'
    * this won't do anything if you use ElasticSearch though.
     
    Chris D and Nutz like this.
  8. Nutz

    Nutz Member

    Thank you. I'm not completely uncomfortable editing files however I have another staff member that makes these decisions with me.

    We also have our test board for possible disasters. :LOL: Many many thanks Daniel.
     
    Daniel Hood likes this.
  9. Mr Lucky

    Mr Lucky Well-Known Member

    It doesn't look like you have actually hadny replies to this yet.

    The answer is yes, you can change the world spoiler to anything by simply editing the phrase spoiler in ACP > Appearance > Search phrase. Change it to and or ***, I don't think people will have much luck doing a search either with xenforo search or browser console.
     
  10. Chris D

    Chris D XenForo Developer Staff Member

    That wouldn't actually work.

    The text in messages is still going to be:
    [SPOILER="Title"]Some text inside...[/SPOILER]

    Searching for "spoiler" will find any message that uses the spoiler tag.
     
    Nutz likes this.
  11. Nutz

    Nutz Member

    Yes, this is what we encountered when using that method.
     
  12. Mr Lucky

    Mr Lucky Well-Known Member

    My thinking was that if your spoilers are called something else visually (ie what people see, not the SPOILER bbcode) then they won't think to search for the word spoiler. However I suppose by now they have twigged as you say so I can see why that won't work.

    Another thing would be to make it an image they have have to search for. I have done that it it works quite well asa competition.
     
    Nutz likes this.
  13. Nutz

    Nutz Member

    I do admire their deviousness. :LOL: We have quite a dedicated cast of members.

    The images are another great idea although this time I'm hoping to use the "timed spoiler" add on to limit the early starters.

    Hopefully I've thought of everything. ;)
     
  14. Mr Lucky

    Mr Lucky Well-Known Member

    Great idea, and @AndyB gives good addon.
     
    Nutz likes this.
  15. Nutz

    Nutz Member

    This worked perfectly. Thank you for taking the time to reply.
     
    Daniel Hood likes this.
  16. Nutz

    Nutz Member

    @Daniel Hood

    The addition of "spoiler" to the stop words seems to be a bit inconsistent. I can't search for it on my desktop but can on my phone. I had some other mods test the function and some can search it and some get the error. Any idea as to why it's not acting as a permanent stop?
     
  17. Nutz

    Nutz Member

    Figured I'd update this as I figured out another way.

    Adding spoiler to the stop words worked for some members and devices although it really acted inconsistently and I could not find a cause.

    What did work was adding spoiler to our censor list. ;) The spoiler tags still work as they should and they are completely unsearchable.

    Thanks everyone!
     

Share This Page