Advertisement:

Author Topic: Visible, Invisible and NoQuote Tags  (Read 3463 times)

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Visible, Invisible and NoQuote Tags
« on: July 06, 2015, 11:19:49 AM »
Link to Mod


VISIBLE, INVISIBLE AND NOQUOTE TAGS v3.2
By Dougiefresh -> Link to Mod


Introduction
This modification adds bbcodes that will make content visible or invisible based on criteria in the parameters of the bbcode, and a bbcode to prevent someone from easily quoting text within a post.

The new visible and invisible BBCodes take any of the following parameters:
Code: [Select]
[b]u={user ID}[,{user_ID}....][/b] => User ID(s) seperated by commas
[b]g={group ID}[,{group_ID}....][/b] => Membegroup ID(s) seperated by commas
[b]min_posts={number of posts}[/b] => Filter by minimum number of posts; valid: positive integer value
[b]max_posts={number of posts}[/b] => Filter by maximum number of posts; valid: positive integer value
[b]guests={answer}[/b] => Filters by guest status; valid: [b]1[/b], [b]0[/b], [b]true[/b], [b]false[/b], [b]y[/b], [b]yes[/b], [b]n[/b], or [b]no[/b].
[b]members={answer}[/b] => Filters by member status; valid: [b]1[/b], [b]0[/b], [b]true[/b], [b]false[/b], [b]y[/b], [b]yes[/b], [b]n[/b], or [b]no[/b].
[b]banned={answer}[/b] => Filters by ban status; valid: [b]1[/b], [b]0[/b], [b]true[/b], [b]false[/b], [b]y[/b], [b]yes[/b], [b]n[/b], or [b]no[/b].
[b]karma={minimum karma required}[/b] = Filters by amount of karma received; valid: integer value.
[b]replied={topic ID}[/b] = Filter by whether member has replied to given topic or current topic if value is 0; valid: topic ID or 0.
[b]warning={warning level}[/b] = Filter by whether member has maximum warning level; valid: integer value.

These parameters are also accepted, but the data supplied must be QUOTED and is treated as a partial regex search value.  For example, username="Doug" would match dougiefresh, freshdoug, weird_doug and doug...
Code: [Select]
[b]username={username}[,{username}...][/b] => Username(s) seperated by commas
[b]user={display name}[,{display name}...][/b] => Display name(s) seperated by commas
[b]group={membergroup}[,{membergroup}...][/b] => Membergroup name(s) seperated by commas
[b]lang={language}[,{language}...][/b] => Language(s) seperated by commas

For example, if you wanted to make the portion invisible to user # 1 and membergroup ID # 2, you would use this:
Code: [Select]
[invisible u=1 g=2]Whatever goes here[/invisible]If you wanted to make it invisible to just guests, you would use this:
Code: [Select]
[invisible guests=y]Whatever goes here[/invisible]Likewise, making things visible to only certain groups or people is equally easy.  Just replace invisible with visible!

In order to keep people from easily quoting part (or all) of your post, just surround the unquotable part like this:
Code: [Select]
[noquote]Whatever goes here[/noquote]
VERSION 2.1 adds the [else] bbcode for the [visible] and [invisible] tags.  When present and the conditions are false, the part after [else] will be displayed instead of nothing.

To-Do List
o [DONE] Add support for custom fields.... (?)
o Add support for search values as whole strings instead of partial strings.... :p

Admin Settings
There is a whole new admin area with three parts: Admin => Configuration => VIVNQ Settings!  The first part is the Shortcuts UI, where you can modify existing shortcuts.

The second area is the Create New Tags, where you can create new shortcuts for use within the forum.

The third area is the permission page, where you can set all the permissions of the mod easily in one spot (as opposed to going to the permissions area and setting it up per membergroup!)

There are 7 new permissions that one can assign the membergroups:
o Allow use of the "visible" tag"
o Quote the contents of "visible" tag
o Allow use of the "invisible" tag"
o Quote the contents of "invisible" tag
o Allow use of the "noquote" tag"
o Quote the contents of "noquote" tag
o Toggle filtering of "visible" & "invisible" tag

Other Notes
If you upgrade from v1.x of this mod to v2.0, this mod will not remove any "visible" or "invisible" tags that already exists within the messages table.  When a user doesn't have permission to use those tags, the tag is removed from the message before committing the message to the database.

Related Discussions
o Code to keep someone from quoting something in [noquote] tags....

Compatibility Notes
This mod was tested on SMF 2.0.10, but should work on SMF 2.1 Beta 3, as well as SMF 2.0 and up.  SMF 1.x is not and will not be supported.

Changelog
The changelog has been removed and can be seen at XPtsp.com.

License
Quote
Copyright (c) 2015 - 2017, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline njtweb

  • Jr. Member
  • **
  • Posts: 208
Re: Visible, Invisible and NoQuote Tags
« Reply #1 on: July 06, 2015, 11:31:33 AM »
I think I'm using something similar already. "Show BBCode To Guests"? Basically if you use a certain bbcode, like "quotes" tags, guests don't see it and are provided a registration or login link in order to view.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #2 on: July 30, 2015, 05:45:22 PM »
UPDATE: Yesterday, I was notified of a potentially "fatal flaw" in SMF's bbcode parser function.  The parser generates an array with all possible permutations of the parameters, and thus can run out of memory when dealing with a bbcode tag with a large number of parameters.  I've solved this problem in my Post and PM Inline Attachments mod, and I'm going to attempt to solve it for this mod as well....  It's a little more complicated because of the "alt" parameter in the mess of things....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #3 on: September 04, 2015, 07:49:43 AM »
NOTICE: In the nightly version found on GitHub, the SMF team has reworked the section of the parse_bbc function that used the permute function so that it no longer needs it, instead relying on a complete different implementation to address the issue brought up in the REPORT: Potentially "Fatal Flaw" in SMF's bbcode parser thread.....  In the next few days, I will release an update that will make that particular operation optional....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #4 on: September 07, 2015, 11:44:37 AM »
Uploaded v2.0 - September 6th, 2015
o Added "warning" parameter, based on the warning level the user is at.
o Performance increase due to modification of parse_bbc function to deal with memory issue found.
o Added "visible" and "invisible" tags without parameters to the mix.
o Poster, Admin and Moderators can now quote messages without the visible/invisible tags being removed.
o Poster, Admin and Moderators now have a button on Post Display page to turn filtering on/off.
o Poster, Admin and Moderators can now see "visible to you" messages with green background with filtering on.
o Poster, Admin and Moderators can now see "invisible to you" messages with red background with filtering on.
o Permissions added to control who can use the "visible", "invisible" and "noquote" tags.
o Permissions added to control who can quote the "visible", "invisible" and "noquote" tags.
o Permission added to control who can see through the "visible" and "invisible" tag filters.
o Added permissions not available to Guest membergroup, mostly for security reasons....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,136
  • Master of BBC Abuse
Re: Visible, Invisible and NoQuote Tags
« Reply #5 on: September 07, 2015, 08:28:01 PM »
In order to keep people from quoting part (or all) of your post, just surround the unquotable part like this:
Quote
[noquote]Whatever goes here[/noquote]

You'd still be relying on courtesy, since anyone could easily get around that if they wanted to (copy/paste to quote tag in reply, link to original post).

Apart from the performance hit this mod might cause, I could see it being useful sometimes.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #6 on: September 08, 2015, 05:08:30 PM »
You'd still be relying on courtesy, since anyone could easily get around that if they wanted to (copy/paste to quote tag in reply, link to original post).
Well, it's certainly not fool-proof, nor idiot-proof....  But it would make people wonder what they missed if one were to cut-and-paste the contents, no?

The only way I can think of to keep someone from copy-and-pasting is to download a "disable right-click" mod.  But all a user would have to do to disable that is to disable Javascript on their machine.....  There is no perfect solution....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline KungFuJoe

  • Semi-Newbie
  • *
  • Posts: 57
Re: Visible, Invisible and NoQuote Tags
« Reply #7 on: October 15, 2015, 06:13:31 PM »
Great mod...but is there a way to add a button for the lazy users?  :)

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #8 on: October 17, 2015, 07:18:31 PM »
Great mod...but is there a way to add a button for the lazy users?  :)
I could add a button for it, however, the options are complex and creating a GUI to deal with it would be difficult at the moment.  I would prefer not to at this time....
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #9 on: August 10, 2017, 09:46:48 PM »
Uploaded v2.1 - August 10th, 2017
o Removed support for SMF 2.1 Beta 1 and 2.
o Added support for SMF 2.1 Beta 3.
o Moved language strings to their own language file.
o Added hook for 3rd parties to add their own parsing conditions.
o Added [else] bbcode for alternate text within visible/invisible tags.


Great mod...but is there a way to add a button for the lazy users?  :)
GUI posting button options are being looked at.  I'm also working on the creation of an admin area where so-called "replacement" bbcodes can be created; so instead of typing a long condition string, like this:
Code: [Select]
[visible u=1,2,3,4,5,6,7,8,9,10]Blah[/visible]You could type a more general string, like this:
Code: [Select]
[blah]Blah[/blah]
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #10 on: August 19, 2017, 04:44:56 PM »
Uploaded v3.0 - August 19th, 2017
o Added admin area: Admin -> Configuration -> VIVNQ Settings.
o Fixed visible and invisible bbcode validation functions.



@Everybody:  Some opinions on this would be nice....
« Last Edit: August 19, 2017, 04:55:08 PM by dougiefresh »
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline thepitster

  • Semi-Newbie
  • *
  • Posts: 21
Re: Visible, Invisible and NoQuote Tags
« Reply #11 on: August 25, 2017, 09:26:46 PM »
o Added admin area: Admin -> Configuration -> VIVNQ Settings.

I end up with thsi when I go to the above:
PHP Fatal error:  require_once(): Failed opening required '/ManagePermissions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /Sources/Subs-VIVNQ_Admin.php on line 52


Offline thepitster

  • Semi-Newbie
  • *
  • Posts: 21
Re: Visible, Invisible and NoQuote Tags
« Reply #12 on: August 26, 2017, 03:46:03 AM »
Code: (Subs-VIVNQ_Admin.php) [Select]
function VIVNQ_Settings($return_config = false)
{
global $txt, $modSettings, $scripturl, $context, $options;
you for got to put
Code: [Select]
, $sourcedir on the end of that.

so this should work:

Code: (Subs-VIVNQ_Admin.php) [Select]
function VIVNQ_Settings($return_config = false)
{
global $txt, $modSettings, $scripturl, $context, $options, $sourcedir;

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #13 on: August 26, 2017, 07:20:27 AM »
Uploaded v3.1 - August 26th, 2017
o Fixed missing global variable in Subs-VIVNQ_Admin.php.



@thepitster:  Thank you for posting this bug report!  It's been fixed!
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline thepitster

  • Semi-Newbie
  • *
  • Posts: 21
Re: Visible, Invisible and NoQuote Tags
« Reply #14 on: August 26, 2017, 02:23:05 PM »
hey no problem, just trying to help out any way I can, and thank you for all the great work you do, as you have already noticed I use a few of your mods on my site and they come in VERY VERY handy.

Offline dougiefresh

  • SMF Hero
  • ******
  • Posts: 2,331
    • XPtsp.com Community
Re: Visible, Invisible and NoQuote Tags
« Reply #15 on: August 31, 2017, 11:29:05 PM »
Uploaded v3.2 - August 31st, 2017
o Fixed invalid index error in Subs-VIVNQ.php.
NOTICE:  My website is back up!

My Free Simple Machines mods on XPtsp.com and Simple Machines Customization Site!
My mods are being uploaded and are available at GitHub as well!

Offline thepitster

  • Semi-Newbie
  • *
  • Posts: 21
Re: Visible, Invisible and NoQuote Tags
« Reply #16 on: September 13, 2017, 09:26:21 PM »
this keeps filling up my error_log PHP Warning:  Invalid argument supplied for foreach() in /Sources/Subs-VIVNQ.php on line 492
and that line is:
   foreach ($tags as $tag)


never mind was not your mod's problem
« Last Edit: September 13, 2017, 09:47:57 PM by thepitster »

Offline efk

  • Semi-Newbie
  • *
  • Posts: 61
  • Gender: Male
Re: Visible, Invisible and NoQuote Tags
« Reply #17 on: September 14, 2017, 02:45:08 AM »
Any screenshot for this mod?