PDA

View Full Version : Miscellaneous Hacks - Disable BBCodes/Smilies Per Users/Usergroups


MarkFL
04-04-2016, 09:00 PM
Overview:

This product is in response to the request posted by The Mailman (https://vborg.vbsupport.ru/member.php?u=460452) here:

Disable bb code for specific user or usergroup? (https://vborg.vbsupport.ru/showthread.php?t=322274)

This product allows you to designate a list of BBCodes and a list of Smilies that will be disabled for the users/usergroups you select. You may also restrict users individually, with their own separate lists of restrictions. The affected BBCodes/Smilies will be disabled only in the areas you select, and you can elect to have them disabled in signatures and previews (corresponding to the other areas selected) as well. You can disable only the display of restricted content, or you can choose to prevent restricted content from being saved to the database altogether.

Updates:

Version 1.1:


Fixed HTML encoding issue.


Version 1.2:


Added option to disable smilies.
Added option to select usergroup membership type (primary only/secondary only/primary and secondary).
Added option for individual custom restrictions by username.
Replacement message can be set for BBcodes only, smilies only, both BBCodes and smilies, or turned off.
Quoted posts/PMs of restricted users now has BBCodes/smilies disabled.


Version 1.2.5:


Fixed bug with non-Latin characters.


Version 1.2.6:


Fixed reported issue with PMs.


Version 1.3:


Added the option to prevent restricted content from being saved to the database, and old restricted content to be removed.
Moved the code that parses content to an external script to avoid redundancy.


Version 1.3.1:


Fixed reported issue with Signatures.


Version 1.4:


Fixed multi-quote issue.


Compatibility:

Tested and working on VB 4.2.x and may work on all 4.x versions of vBulletin.

Backup/Warning:

This product does not alter your database on installation, however it is always good practice to make regular backups and you should make a backup before installing ANY new mod.

As always, products are USE AT YOUR OWN RISK. I will provide support and do my best to help but no absolute guarantee is offered.

To Install:


Download and extract the attached .zip file.
Upload the contents of the "upload" folder to your server's root directory.
Follow AdminCP -> Plugins & Products -> Manage Products -> Add/Import Product.
Click on "Choose File" and browse to the product .xml file that was packaged in the .zip file.
Click "Import."
You MUST enable the product in the settings before it will function.
Configure the remaining settings to your liking. Each setting has a detailed explanation of its use.


[img]https://vborg.vbsupport.ru/attachment.php?attachmentid=154674&stc=1&d=1460488388

Support for this product can be found here:


MHB - Disable BBCodes/Smilies Per Users/Usergroups (http://mathhelpboards.com/vbulletin-products-61/disable-bbcodes-smilies-per-users-usergroups-21807.html)
TAZ - Disable BBCodes/Smilies Per Users/Usergroups (https://theadminzone.com/threads/disable-bbcodes-smilies-per-users-usergroups.145077/)

Rhodium
04-06-2016, 04:04 PM
Any way to disable smileys too?

Regards

Alan_SP
04-06-2016, 05:20 PM
Excellent. This is something I was waiting. Something similar Abe1 had made, but it had it's own problems why I didn't used it (mainly the way all new BBcodes were disabled by default for all usergroups, what was PITA to set up and maintain, especially if you have a lot of usergroups, and especially that disabled using BBcodes for users who are in multiple usergroups and one can use BBcode, and one (or more) can't).

Does this mod has the last problem, for users in multiple usergroups? For example, does it allows use of BBcode for someone who has more than one usergroup and one allows, and one disallows using BBcode? If not, please enable best case scenario for that usergroup, so user can use BBcode if at least one usergroup allows use of BBcode.

There's also one use I was planning to use such mod: Having special BBcodes for staff members, that regular users can use, but of course, can see their effect.

Also, is it possible if user who can't use BBcode, when quoting post with disabled BBcode don't see that BBcode at all (BBcode and content within it)? Just to see empty space (last option suggests something like that, but not sure at the moment if it works that way).

Also, is it possible to have separate mod, but with inverted function, that we enter BBcode list and usergroups and/or users who can use them, and that this two mods can work together? Or, having one mod that could have different rules for different BBcodes, e.g.:

img|+6,7 - This means BBcode img can use only usergroups 6 and 7
b|-3,2 - This means that BBcode b (bold) can't use usergroups 3 and 2

Or something similar?

Anyway, great mod.

I had idea about making some posts "official", i.e. only staff members could make them. And that posts would look differently from normal posts (different background image, color, font..., basically different CSS). So users would know it is not "normal" post from staff members, but "official". Now I could make something similar, using BBcode that moderators can use, but regular users, which could have similar effect.

Which also leads me to idea, if I use image for that BBcode, can that image be disabled for users who couldn't use that BBcode? So moderators can use it in easier manner?

MarkFL
04-06-2016, 05:46 PM
This product uses the "is_member_of()" function when it comes to usergroups...and so no matter how many usergroups to which a user belongs, if he/she is a member of any usergroup which you select, then the BBCodes you set will be disabled for them. I don't see this as a "problem," because that's the way I intended this product to work. I can add the option to only have primary usergroups used though..

I will also look into allowing the specification of BBCodes that are by default disabled except for users/usergroups you set. :)

MarkFL
04-06-2016, 05:47 PM
Any way to disable smileys too?

Regards

I will see what I can do. :)

Alan_SP
04-07-2016, 05:42 PM
This product uses the "is_member_of()" function when it comes to usergroups...and so no matter how many usergroups to which a user belongs, if he/she is a member of any usergroup which you select, then the BBCodes you set will be disabled for them. I don't see this as a "problem," because that's the way I intended this product to work. I can add the option to only have primary usergroups used though..

I will also look into allowing the specification of BBCodes that are by default disabled except for users/usergroups you set. :)

Yes, I suspected something like this.

As I mentioned, I had that problem with Abe1's mod. But, if there would be mod that allows using BBcodes to only certain usergroups, then it would work as vBulletin permission system. Now it works as vBulletin permissions for banned usergroups.

I use multiple usergroups for many users and this system, for my intentions with it, would collide and break my system.

MarkFL
04-07-2016, 06:00 PM
Yes, I suspected something like this.

As I mentioned, I had that problem with Abe1's mod. But, if there would be mod that allows using BBcodes to only certain usergroups, then it would work as vBulletin permission system. Now it works as vBulletin permissions for banned usergroups.

I use multiple usergroups for many users and this system, for my intentions with it, would collide and break my system.

I have been working on this product, and so far I have included a setting for disabled smilies, and for the selection of usergroup type (primary only/secondary only/primary and secondary) and for replacement (None/BBcode Only/Smilie Only/BBcode And Smilie).

It was a massive rewrite. :eek:

I am going to figure a way to include BBCodes/Smilies that are restricted on an individual basis.

I have just come to realize that I need to account for other users who may quote the posts of restricted users.

So, it may be a while before an update is ready. :)

MarkFL
04-08-2016, 01:45 PM
Update - Version 1.2:


Added option to disable smilies.
Added option to select usergroup membership type (primary only/secondary only/primary and secondary).
Added option for individual custom restrictions by username.
Replacement message can be set for BBcodes only, smilies only, both BBCodes and smilies, or turned off.
Quoted posts/PMs of restricted users now has BBCodes/smilies disabled.

Alan_SP
04-08-2016, 02:46 PM
This sounds great. I can't like at the moment your posts, but you really improved your mod.

MarkFL
04-08-2016, 05:16 PM
Update - Version 1.2.5:


Fixed bug with non-Latin characters.


(Thanks Stratis!)

Rhodium
04-08-2016, 08:26 PM
Update - Version 1.2:


Added option to disable smilies.
Added option to select usergroup membership type (primary only/secondary only/primary and secondary).
Added option for individual custom restrictions by username.
Replacement message can be set for BBcodes only, smilies only, both BBCodes and smilies, or turned off.
Quoted posts/PMs of restricted users now has BBCodes/smilies disabled.


I love you!!! :p

Rhodium
04-08-2016, 08:57 PM
Hm, tested and working but breaks quotes in private messages and i need to input user name for make a reply :/

MarkFL
04-08-2016, 09:11 PM
Hm, tested and working but breaks quotes in private messages and i need to input user name for make a reply :/

I will look into this tonight...thanks for letting me know! :up:

MarkFL
04-08-2016, 09:30 PM
Update - Version 1.2.6:


Fixed reported issue with PMs.

Rhodium
04-08-2016, 09:44 PM
Update - Version 1.2.6:


Fixed reported issue with PMs.


https://vborg.vbsupport.ru/external/2016/04/3.gifhttps://vborg.vbsupport.ru/external/2016/04/3.gif

MarkFL
04-12-2016, 05:16 PM
Update - Version 1.3:


Added the option to prevent restricted content from being saved to the database, and old restricted content to be removed.
Moved the code that parses content to an external script to avoid redundancy.

MarkFL
04-13-2016, 04:40 AM
Update - Version 1.3.1:


Fixed reported issue with Signatures.

280ZX
07-03-2016, 07:43 PM
Hi Mark,

I installed your Add-on, but unfortunately it suppresses the display of all threads.
Maybe I used the BBCode Tag Names wrong. Could you give me an example or do you have any other idea?

Thank you,
Andre

MarkFL
07-03-2016, 09:29 PM
Hi Mark,

I installed your Add-on, but unfortunately it suppresses the display of all threads.
Maybe I used the BBCode Tag Names wrong. Could you give me an example or do you have any other idea?

Thank you,
Andre

How do you have the settings configured?

280ZX
07-04-2016, 07:03 AM
I used the following settings:

Usergroup: registered users
Usergroup Membership Type: Primary And Secondary Usergroups
Replace BBCodes/Smilies With Message? No
Active Areas: all
Suppression Type: display

For the BBCode Tag Names I tried different things: the complete BB code, BB code without [], ...
If I leave this field empty, everything is ok, so I guess, I'm doing something wrong with the name.

MarkFL
07-04-2016, 12:43 PM
For the BBCodes, your enter them without brackets as a comma-delimited list. for example, if you want to disable the CODE, HTML and PHP BBCodes, you could enter:

code,html,php

280ZX
07-04-2016, 05:11 PM
This is, what I have done. So, at least my settings seem to be right.
But nevertheless, if i turn on the script, no thread will be loaded. The only exception is, when I leave the field for BBCode Tag Names blank.

My vBulletin version is 4.2.2 Patch Level 5

MarkFL
07-04-2016, 05:39 PM
When you installed the product, did you follow step 2? Which is:

Upload the contents of the "upload" folder to your server's root directory.

280ZX
07-04-2016, 07:15 PM
Ok, we only uploaded the PHP to the root directory. Now we added the folder and everything is ok. So it was our fault...
Thank you for your help. :up:

MarkFL
07-04-2016, 09:10 PM
Ok, we only uploaded the PHP to the root directory. Now we added the folder and everything is ok. So it was our fault...
Thank you for your help. :up:

I'm glad it was something easy to fix! Thank you for your patience and for letting me know. :up:

280ZX
07-05-2016, 04:56 AM
Thank you for your patience and for letting me know. :up:

Thank you for all the effort! :up:

mx-5.de
08-01-2016, 03:19 PM
Hi Mark,

there seems to be a problem with your Add-on V1.3.1 and VB Suite 4.2.3 PL1.

We have a strange behaviour with multiple quotes after upgrading.

VB before: 4.2.2 PL 5 Suite
PHP before: 5.3

VB after: 4.2.3 PL 1 Suite
PHP after: 5.6

Update went fine and all seems to work properly, except multiple quoting. When selecting some posts for multiple quotes, only the last posting ist quoted, but as often as posts are selected.
Example:
Post 1, Author 1
Post 2, Author 2
Post 3, Author 3

-> all three posts selected for quoting

In the text area:
"Quote from Author 1: Text from Post 3"
"Quote from Author 2: Text from Post 3"
"Quote from Author 3: Text from Post 3"

In other words: when selecting multiple posts for quote, the number of quotes is correct, the quoted authors, too. Quoted text is always the same in all quotes; it's the text from the last qoute.

I've disabled all plugins selectively, and the error occurs when your add-on is active; independent from other plugins. And it's reproducible: your add-on active -> error, your add-on inactive -> all ok.

I would be glad if you find a solution for that. If I might help you, let me know.

Greets
Andreas

MarkFL
08-01-2016, 04:30 PM
I am able to replicate this issue, and will find a solution as time permits. In the meantime, please download and mark as installed. :)

mx-5.de
08-01-2016, 04:52 PM
In the meantime, please download and mark as installed. :)

Done :)

MarkFL
08-03-2016, 02:14 AM
Update - Version 1.4:


Fixed multi-quote issue.

mx-5.de
08-03-2016, 04:45 PM
Update - Version 1.4:

Thanks a lot! We installed the update and we even upgraded to 4.2.3 PL2. I'll let you know...

mx-5.de
08-04-2016, 03:50 AM
Hi Mark,

seems to work fine again. Thanks a lot!

draco.mf
09-03-2016, 03:57 PM
Hi Mark,

I encountered problem with this MOD.

Mod conflicts with vBulletin built-in double posts merge funtionality.

When Your mod is enabled and when any user use any BB code (even not restricted by this mod) - when user adds next post in sam thread, mod duplicates the post content after automatic double posts merging.

When Your mod is disabled it works correctly.

See attached screenshot to understand the problem:

http://dl.dropbox.com/s/exzrsfh8aupov1d/bug.png

Are You able to help?

MarkFL
09-03-2016, 04:22 PM
I will look into this soon. Right now I have a lot going on, so it may be a while before I can get to it. :)

You may want to actually download it and mark it as installed in the meantime.

MarkFL
09-03-2016, 05:10 PM
I just ran some tests, and I'm not able to duplicate the issue. You likely have another mod that is conflicting with this one.

draco.mf
09-03-2016, 07:34 PM
It is weird because when i disable Your MOD everything working fine...

vBulletin 4.2.3 Patch Level 2

Steps to reproduce:

1. Create a post
2. Add another post with BBCode
3. In result the latest post should be merged with another previous and content of merged post will be duplicated.

MarkFL
09-03-2016, 09:14 PM
Since my mod works as it should for me, I am left to assume that you have some mod installed that I don't, which in combination with mine, produces the issue you reported.

TheLastSuperman
09-04-2016, 12:51 AM
Mannnnnnnn I'mm'a just have to scroll your mods list on your profile one day for a good minute, how'd I miss this one? Useful which equates to being pretty nifty in my book! :cool:

draco.mf
09-04-2016, 01:01 AM
Since my mod works as it should for me, I am left to assume that you have some mod installed that I don't, which in combination with mine, produces the issue you reported.

OK. Thanks for You explanation.
In this case I need to uninstall it :(

MarkFL
09-04-2016, 01:21 AM
OK. Thanks for You explanation.
In this case I need to uninstall it :(

Or you could try turning off your other mods one at a time and see which has the conflict. Then you can let me know, and I will download it and install it on my dev site, and see if I can resolve the conflict.

I wish to get this working for you, but until I know which product is not playing well with mine, there's not much I can do. :D

draco.mf
09-04-2016, 01:38 AM
Will try to detect and let You know

MarkFL
09-04-2016, 02:01 AM
Will try to detect and let You know

Thank you! I appreciate it and apologize for the inconvenience. I am hoping you don't have a huge number of products installed and it won't be a Herculean effort to find it. :)

Tom_Jones
03-11-2017, 03:42 PM
I'm looking for a mod that does sort of the reverse of this one. I have a set of BBCodes that I only want specific users/usergroups to be able to use (and potentially a different set of users/groups per BBCode). In essence, I wish to enable, instead of disable, certain BBCodes per user/usergroup. Does something like this exist?

Alan_SP
03-12-2017, 06:22 PM
Yes, I also like this idea. Abe's mod does this, but it is pretty complicated to set up.

Peter Walker
12-17-2017, 12:49 PM
First of all, your instructions are confusing. You tell people to upload the file into the server root directory. Many people put vBulletin in a subdirectory like /forum and they would be confused as to where to put it. After experimenting, I found you meant the forum root directory. For example, if vbulletin is installed in www.mywebsite.com/forum, then the directory and contents has to be uploaded to www.mywebsite.com/forum/markfl_disablebbcodes and NOT www.mywebsite.com/markfl_disablebbcodes which would be the server directory.

I am trying to set this up so that members of a premium secondary usergroup (30) can use the bbcodes and everyone else cannot. This is to restrict access to videos, etc. to those that have permission. I am still working out how to get this to work with your mod. It would therefore be much easier if an extra setting could be added to switch to enabling the bbcodes for just selected usergroups instead of disabling for all, but.
I originally installed the first version of this mod, before discovering version 1.4 that I have now installed under vBulletin 4.2.5.

This is how I setup the mod:
Set whether product is active or not.: Yes
BBCode Tag Names: audiop,videomp4p,videomp4vttp
Smilies:
Usergroups: Marked all usergroups except: None,All,Administrators,Premium
Usergroup Membership Type: I tested all three variants - see below.
Usernames:
Individual Restrictions:
Replace BBCodes/Smilies With Message? Yes, For BBCodes Only
Active Areas: All ticked
Suppression Type: Display

As far as I could see, this should work. Everybody who has the Premium group activated as a secondary group should be allowed to see the content, everyone else should see the error message.

I tried setting Usergroups: ALL
This blocked access for everyone.
- Primary Usergroups Only: Blocked
- Secondary Usergroups Only: Blocked
- Primary And Secondary Usergroups: Blocked

I tested this with three users:

User: Administrator
Usergroup Primary : Administrator
Usergroup Secondary: Premium
Expectation: Should by able to use the bbcode as he belongs to the premium group.

User: PremiumUser
Usergroup Primary : Registered Member
Usergroup Secondary: Premium
Expectation: Should by able to use the bbcode as he belongs to the premium group.

User: NormalUser
Usergroup Primary : Registered Member
Usergroup Secondary:
Expectation: Should by blocked from seeing the bbcode and shown an error message, instead.


Test 1:
Usergroups: All marked except: None, All, Administrators, Premium
User: Administrator (should always have access)
- Primary Usergroups Only: BBCode Displayed
- Secondary Usergroups Only: Blocked
- Primary And Secondary Usergroups: Blocked

User: NormalUser (should be denied access)
- Primary Usergroups Only: BBCode Displayed, although should be blocked
- Secondary Usergroups Only: Blocked
- Primary And Secondary Usergroups: Blocked

User: PremiumUser (should have access)
- Primary Usergroups Only: BBCode Displayed, OK
- Secondary Usergroups Only: Blocked, although member of premium usergroup!
- Primary And Secondary Usergroups: Blocked

Test 2:
Usergroups: Premium usergroup selected, ONLY (Administrator and PremiumUser have this as secondary group)
User: Administrator (should always have access)
- Primary Usergroups Only: BBCode Displayed
- Secondary Usergroups Only: Blocked
- Primary And Secondary Usergroups: Blocked

User: NormalUser (should be denied access)
- Primary Usergroups Only: BBCode Displayed, although should be blocked
- Secondary Usergroups Only: Blocked
- Primary And Secondary Usergroups: Blocked

User: PremiumUser (should have access)
- Primary Usergroups Only: BBCode Displayed, OK
- Secondary Usergroups Only: Blocked, although member of premium usergroup!
- Primary And Secondary Usergroups: Blocked


As you can see, there is no combination that works correctly. What am I doing wrong?

Peter Walker
12-22-2017, 09:07 PM
I have solved my problem, but not with this Mod. It appears to be flawed and does not work properly, I uninstalled it.

It turns out that another similar Mod, by the same author, does work properly and with a minor change, will do exactly what I needed.

The Mod is Hide BBCodes/Signatures From Guests/Users (https://vborg.vbsupport.ru/showthread.php?p=2591746#post2591746) and I explain what needs to be changed, there in post #110 (https://vborg.vbsupport.ru/showpost.php?p=2591746&postcount=110). I even provide my updated product file.

So if you need to enable a BBCode in just some forums of your choice, that is the way to do it.
I have implemented it on my forum and it works well.

I hope this helps.

MarkFL
12-22-2017, 10:27 PM
I have solved my problem, but not with this Mod. It appears to be flawed and does not work properly, I uninstalled it.

Your use of the product was the inverse of the intended usage, so that was where the issue was. As far as I know, everyone who uses this for its intended purpose finds it works correctly. ;)

Peter Walker
12-22-2017, 11:32 PM
I tested it as it was intended, and even then it was not reliable. Now this could be something that was specific to my forum. Either way for me, the other mod was reliable from the start - this one was not.

MarkFL
12-23-2017, 04:41 AM
It could be your use of secondary usergroups gave you results you didn't expect. If a user is a member of an allowed group and also a member of a disallowed usergroup, the net result is they will be disallowed.

two dogs
03-10-2019, 04:21 AM
Hi Mark,

I've recently installed this excellent mod on a couple of vBulletin 4.2.5 forums that I administer.

As it was working well on the first one I installed it on, I installed it on the second one. Soon after, I was informed by a user that he was receiving the following requester on clicking on the Post Quick Reply button, after typing a response into the Quick Reply panel:

157371

This had never happened previously, and the normal behaviour returned on disabling the mod. A little more testing determined that with the mod enabled, but no tag names specified, the problem didn't occur!

I didn't notice the problem on the first forum, as I had disabled the Quick Reply option on it. When I temporarily enabled it there, the problem manifested itself.

Wondering if there was a conflict with some other mod, I tried disabling them all on a test version of the production forum, but the problem persisted.

I've just now done an install of a new, clean, V4.2.5 forum, with no changes to the default configuration. Yes, Click Not Required was the default for the Quick Reply option.

After creating a thread, and doing a couple of Quick Replies, without any problem, I installed the mod, and the problem manifested itself (again, only when a tag name was specified). So, it would seem that the problem isn't caused by any conflict with another mod?

Any ideas?

Cheers,
Julian

two dogs
03-10-2019, 04:39 AM
Mark,

Please hold off on investigating/answering this, as I may have since found the problem.

Cheers,
Julian

two dogs
03-10-2019, 08:38 PM
Hi Mark,

I haven't found the problem, but I was wrong in saying that I could reproduce it on a clean install of V4.2.5. In my haste, I hadn't copied markfl_disablebbcodes/disablebbcodes.php to the server! That resulted in the requester being displayed when I tried a Quick Reply to a post I had in my browser, prior to installing the mod. I later realised my error when I got a 500 error on responding to the requestor!

So, as it works fine on a clean install, I guess I'm going to have to try installing all the other mods I have on the other forums, one by one, on my new test system to see which one is in conflict. Or perhaps it's a vBulletin setting?

Any thoughts you have on what sort of interaction with mods/settings that could cause this would be appreciated.

Cheers,
Julian

autje
08-13-2019, 06:08 PM
Hi Mark,

I haven't found the problem, but I was wrong in saying that I could reproduce it on a clean install of V4.2.5. In my haste, I hadn't copied markfl_disablebbcodes/disablebbcodes.php to the server! That resulted in the requester being displayed when I tried a Quick Reply to a post I had in my browser, prior to installing the mod. I later realised my error when I got a 500 error on responding to the requestor!

So, as it works fine on a clean install, I guess I'm going to have to try installing all the other mods I have on the other forums, one by one, on my new test system to see which one is in conflict. Or perhaps it's a vBulletin setting?

Any thoughts you have on what sort of interaction with mods/settings that could cause this would be appreciated.

Cheers,
Julian

Hi Julian,

ever found a solution for this? Because I'm facing the same problem.

Thanks,
Marc