PDA

View Full Version : HTML allowed for certain groups


w596
04-11-2004, 03:37 PM
Would like to see a hack to allow only admins (by group or user ID) to post HTML in threads with VB3.

-W596

accyroy
04-11-2004, 04:02 PM
I'd also like something like this, but I need to be able to just let one user do it who is not an admin or moderator. At the mo I keep having to enable/disable html in the forum for when he posts his league tables from excel!! :-)

Scrub
04-12-2004, 09:37 PM
This may work, tested it and it worked, but I'd test it first to be sure. :)

Open /includes/functions_showthread.php

Find


else
{
$parsed_postcache['skip'] = false;
$post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
}


Replace with:


else
{
$parsed_postcache['skip'] = false;
if ($post['usergroupid'] == 6) {
$post['message'] = parse_bbcode2($post['pagetext'], 1, 1, $forum['forumid'], $post['allowsmilie']);
} else {
$post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
}
}



To make it for just one person, all I'd think you have to do is change:

$post['usergroupid'] == 6

to

$post['userid'] == X


Change X to the user's ID you're wanting.


This was not my work, as I used two other hacks from vB2 to figure this out. Entourage (https://vborg.vbsupport.ru/showthread.php?t=43207&highlight=html) and Palmer ofShinra (https://vborg.vbsupport.ru/showthread.php?s=&threadid=32015&highlight=html) are the original creators of this hack.

w596
04-12-2004, 09:40 PM
Thanks Scrub, I'll give this a try. ;)

Rapy Zeon
04-13-2004, 09:52 AM
what changes would be nessary for multiple groups and or individuals?

eg 2 groups + 2 individuals

BarHopper
04-13-2004, 09:57 AM
This may work, tested it and it worked, but I'd test it first to be sure. :)

Open /includes/functions_showthread.php

Find


else
{
$parsed_postcache['skip'] = false;
$post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
}


Replace with:


else
{
$parsed_postcache['skip'] = false;
if ($post['usergroupid'] == 6) {
$post['message'] = parse_bbcode2($post['pagetext'], 1, 1, $forum['forumid'], $post['allowsmilie']);
} else {
$post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
}
}



To make it for just one person, all I'd think you have to do is change:

$post['usergroupid'] == 6

to

$post['userid'] == X


Change X to the user's ID you're wanting.


This was not my work, as I used two other hacks from vB2 to figure this out. Entourage (https://vborg.vbsupport.ru/showthread.php?t=43207&highlight=html) and Palmer ofShinra (https://vborg.vbsupport.ru/showthread.php?s=&threadid=32015&highlight=html) are the original creators of this hack.

Worked for me. Maybe you should release this as a mini mod. ;)

Scrub
04-13-2004, 10:24 AM
what changes would be nessary for multiple groups and or individuals?

eg 2 groups + 2 individuals


Change


if ($post['usergroupid'] == 6) {


To


if (in_array($post['usergroupid'], array(X,X))) {


Change X to your usergroupids you'd like to be able post HTML

If you'd like it for just cerrtain users.

Change:

if ($post['usergroupid'] == 6) {


To


if (in_array($post['userid'], array(X,X))) {


Change the X's to the userid.

I've tested it and it works, but I suggest you test it first before actually making it live. :). I am unsure how to make it so you can have both a usergroup and a certain member to be able to use it. But I will play around with it some more later on today and see what I can come up with.

And BarHopper, this is not my creation to release. :)


Before someone says why not use is_member_of, I tried it and couldn't figure it out. :p

w596
04-15-2004, 07:06 PM
Thanks Scrub, it worked.

MediaHound
06-13-2004, 06:45 PM
Hey thanks a lot!

Worked for me, exactly what I needed.

I used the array so that in the future, I can add more people as I decide who can post html.

This is a no-brainer modification!

3DChipset
10-05-2004, 04:04 PM
Damn! This works like a charm on 3.0.3...

It says though, "HTML Code is OFF" though under my tag. Still allows me to post in HTML which is cool!!!!!!!

h75
10-12-2004, 12:20 AM
Awesome :beard: :lick: <installed>

TCB
10-23-2004, 09:47 PM
But what happens when somebody (that isn't allowed to use html) quotes a post of an admin?

vBFreak
11-06-2004, 01:00 AM
Yes, works fine. Can someone tell me what I have to change if I want the same thing for user signatures? So that only one usergroup (admins for example) can use HTML, but users not

bendigo-tech
11-06-2004, 05:49 AM
I found a problem with this...

All the HTML is displayed properly in the actual thread itself however, when I user (administrator or not) goes to reply, all the HTML code is shown in the 'Topic Review' area.

Is there anyway to fix this???

vBFreak
11-06-2004, 02:33 PM
Yes, that's right... I got the same thing if I try that...

the HTML-code isn't parsed in the thread review...

I think you have to change on both things for the review and for the signatures a place in the code that is similiar to this example... But where?

bendigo-tech
11-08-2004, 08:30 AM
But what happens when somebody (that isn't allowed to use html) quotes a post of an admin?
They see the HTML code and if they were to post the message, the HTML wouldn't be parsed which in turn makes for a pretty ugly post/quote.

Please... does anyone have a fix for this???

Thanks :)

akoj
11-08-2004, 06:55 PM
Thanks. Installed on my forum. The one thing that I noticed was that it posted the html wonderfully on my forum but when the post fed into my portal (vbadvanced) the html would not post correctly. For now, I just redirected the post to a forum that doesn't feed into the portal. Otherwise, all works great! Thanks for the help. I will check back for any updates.

Link14716
11-08-2004, 07:03 PM
Here's my version. It should work everywhere BBCode is parsed and the post array is $post (which should be everywhere you actually post).

In includes/functions_bbcodeparse.php, find this:
function parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg = 0, $donl2br = 1)
{
// parses text for vB code, smilies and censoring

global $DB_site, $vboptions, $bbuserinfo, $templatecache, $smiliecache;
global $html_allowed;
Add under that:

global $post;
if ($post['usergroupid'] == 6) {
$dohtml = 1;
$dobbimagecode = 1;
$dosmilies = 1;
$dobbcode = 1;
}
Replacing $post['usergroupid'] == 6 (which means any administrator) with whatever you want (such as the in_array($post['userid'], array(X,Y) example.)

akoj
11-08-2004, 10:51 PM
Link,
I tried using your code above but it isn't working on my forums. I took out the code I had originally placed from the original posts. Does that need to be in place as well?

Link14716
11-09-2004, 12:53 AM
Link,
I tried using your code above but it isn't working on my forums. I took out the code I had originally placed from the original posts. Does that need to be in place as well?
No.

Either way, it works for me. HTML is off in the forum and is still parsing on my dev board.

bendigo-tech
11-09-2004, 06:26 AM
No.

Either way, it works for me. HTML is off in the forum and is still parsing on my dev board.
So if an Admin posts HTML and then a member quotes it, will it be parsed or will the member see the HTML??

vBFreak
11-12-2004, 09:56 PM
At my board the version of Link14716 is working and better... HTML in signatures is now also only allowed for admins, yet that what I wanted first, thanks Link:)

But html code in quotes of normal users, in the signature editor preview (low priority, because only admins can't see their html-code in the preview, for users it's correcly not parsed as it should be if html is disabled and ok so) and in the Topic Review area isn't still parsed...

gurgi
11-29-2004, 04:50 PM
For some reason Link's solution doesn't work unless I use if ($post['usergroupid'] == 0), but I am definately an admin.. no other value works.

charlesk
12-09-2004, 12:10 AM
Link, thanks very much for that simple solution.

Question for anyone: is there any easy way to modify that code so it works using say, the number of posts the user has? I'm still kind of new to this. :) Thanks.

Charles

charlesk
12-21-2004, 12:17 AM
Perhaps a simpler question.. is there a way to have this work based on a secondary usergroup rather than the primary?

Thanks...

Charles

Quarterbore
05-15-2005, 01:00 PM
Here's my version. It should work everywhere BBCode is parsed and the post array is $post (which should be everywhere you actually post).

In includes/functions_bbcodeparse.php, find this:
function parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg = 0, $donl2br = 1)
{
// parses text for vB code, smilies and censoring

global $DB_site, $vboptions, $bbuserinfo, $templatecache, $smiliecache;
global $html_allowed;
Add under that:

global $post;
if ($post['usergroupid'] == 6) {
$dohtml = 1;
$dobbimagecode = 1;
$dosmilies = 1;
$dobbcode = 1;
}
Replacing $post['usergroupid'] == 6 (which means any administrator) with whatever you want (such as the in_array($post['userid'], array(X,Y) example.)

THANK YOU!!!

Foolish me was looking at doing this in a different way before I found this thread... This is an AWSOME hack and it is working great for me on two of my vBulletin installs!

paul41598
09-23-2005, 11:45 AM
how come this affects other BB code tags? I have a [showtogroups] tag that now isnt displayed because of this

vBFreak
10-15-2005, 12:48 AM
Anyone who modded this for vB 3.5.0?