News:

Wondering if this will always be free?  See why free is better.

Main Menu

Visible, Invisible and NoQuote Tags

Started by dougiefresh, July 06, 2015, 11:19:49 AM

Previous topic - Next topic

dougiefresh

Link to Mod



VISIBLE, INVISIBLE AND NOQUOTE TAGS v3.7
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:

[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...

[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:
[invisible u=1 g=2]Whatever goes here[/invisible]
If you wanted to make it invisible to just guests, you would use this:
[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:
[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 RC2, 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
QuoteCopyright (c) 2015 - 2019, 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.

njtweb

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.

dougiefresh

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....

dougiefresh

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....

dougiefresh

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....

Antechinus

Quote from: dougiefresh on July 06, 2015, 11:19:49 AM
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.

dougiefresh

Quote from: Antechinus on September 07, 2015, 08:28:01 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....

KungFuJoe

Great mod...but is there a way to add a button for the lazy users?  :)

dougiefresh

Quote from: kungfujoe on October 15, 2015, 06:13: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....

dougiefresh

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.



Quote from: KungFuJoe on October 15, 2015, 06:13:31 PM
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:
[visible u=1,2,3,4,5,6,7,8,9,10]Blah[/visible]
You could type a more general string, like this:
[blah]Blah[/blah]

dougiefresh

#10
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....

thepitster

Quote from: dougiefresh on August 19, 2017, 04:44:56 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


thepitster

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

you for got to put , $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;

dougiefresh

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!

thepitster

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.

dougiefresh

Uploaded v3.2 - August 31st, 2017
o Fixed invalid index error in Subs-VIVNQ.php.

thepitster

#16
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

efk


dougiefresh

Uploaded v3.4 - February 10th, 2018
o Added support for Split Forum Mod.

-Rock Lee-

It is very good modification @dougiefresh although I had to squeeze all my technical English to translate as correct as possible ::) and some parts I did not translate it because it is meant to point, also it is wrong to translate it.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Advertisement: