PDA

View Full Version : Signatures on/off per member


Smoothie
07-23-2002, 02:00 AM
I really need this hack. Anyone else need to restrict signature use on a per member level?

Please!!!

Xenon
07-23-2002, 09:04 AM
wouldn't be such a problem

add a new field to the usertable called isallowedsig default='1'

then just add an editfield in your admin-cp to change it from 0/1
nowhere else, just in admincp.

then in newreply.php find this:
if ($signature) {
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
$previewmessage.=$post['signature'];
}

and replace it with this:
if ($signature and $bbuserinfo[isallowedsig]) {
$post['signature'] = bbcodeparse($bbuserinfo['signature'],0,$allowsmilie);
eval("\$post[signature] = \"".gettemplate("postbit_signature")."\";");
$previewmessage.=$post['signature'];
}

you surely want to add that lines small modificated to editpost.php and newthread.php also.

i haven't tested, but it should work.

it just disables new signatures, signatures in old posts aren't infected ;)
run a query if you want to do it for old posts to ;)

Boofo
07-23-2002, 09:10 AM
Smoothie, is you get it all figured out, I'd like to have it. I'm still not sure enough with myself to do the adding of the table or the admin cp. :)

Chris M
07-23-2002, 10:27 AM
Great Xenon!:)

Satan

Smoothie
07-23-2002, 10:33 PM
Xenon-

Thanks. What is the exact command to:
"add a new field to the usertable called isallowedsig default='1'

And how do I add an editfield in my admin-cp?

Xenon
07-23-2002, 11:01 PM
ALTER TABLE `user` ADD `isallowedsig` SMALLINT(6) DEFAULT '1' NOT NULL;

open admin/user.php
find in edit section:
maketextareacode("Signature","signature",$user[signature],8,45);
below it add:
makeinputcode("Can use siganture","isallowedsig",$user[isallowedsig],0);

then find
$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupi d='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invi sible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cook ieuser=$cookieuser,nosessionhash=$nosessionhash,da ysprune='$daysprune',lastvisit=$lastvisit,lastacti vity=$lastactivity,lastpost=$lastpost,posts='$post s',timezoneoffset='$timezoneoffset',emailnotificat ion=$emailnotification,receivepm='$receivepm',emai lonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

change it to:
$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupi d='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',isallowedsig=$isallowedsig,adminemail=$adminemai l,showemail=$showemail,invisible=$invisible,userti tle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cook ieuser=$cookieuser,nosessionhash=$nosessionhash,da ysprune='$daysprune',lastvisit=$lastvisit,lastacti vity=$lastactivity,lastpost=$lastpost,posts='$post s',timezoneoffset='$timezoneoffset',emailnotificat ion=$emailnotification,receivepm='$receivepm',emai lonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

should be all ;)

Boofo
07-23-2002, 11:31 PM
Xenon, than you for the update. How and what do I change in the editpost.php? I couldn't find anything that even resembled the code I changed for the newthread.php and the newreply.php. And what would I need to add this to the private messages, too? :)

Xenon
07-24-2002, 01:02 AM
in editpost you have to find this:
$signature=iif($signature=="yes",1,0);
after that add:
if(!$bbuserinfo[isallowedsig]) $signature=0;

for privat messages:
you have to do the same thing as in editpost.php ;)

i think this should be all, test it if it works ok, if not ask more ;)

Boofo
07-24-2002, 01:10 AM
Thank you. I will test it out and let you know. :)

Smoothie
07-24-2002, 03:29 AM
Xenon-

1 is for yes allow, 0 is for no, right? This just has an affect on img signatures, right?

BTW, anyone know the querie to set all users to no signatures?

Smoothie
07-24-2002, 03:37 AM
didn't work. img sig shows for a user that isn't allowed, and didn't have one before.

Xenon
07-24-2002, 10:03 AM
the query:
UPDATE user SET isallowedsig=0

no it has an effect on using signatures complete!
you didn't say anything about just disable img use in sigs

Boofo
07-24-2002, 10:20 AM
Is there a way to make it not allow ANY signature if enabled, no matter what is in it?

Originally posted by Xenon
the query:
UPDATE user SET isallowedsig=0

no it has an effect on using signatures complete!
you didn't say anything about just disable img use in sigs

Xenon
07-24-2002, 10:28 AM
that's what i said.
it just enebles or disables signatureuse for users completly

Originally posted by Boofo
Is there a way to make it not allow ANY signature if enabled, no matter what is in it?

Boofo
07-24-2002, 10:45 AM
Oh, Ok, I'm sorry. I guess I misunderstood what Smoothie was talking about with the images then. :) This is what I wanted anyway. :)

Originally posted by Xenon
that's what i said.
it just enebles or disables signatureuse for users completly

Smoothie
07-24-2002, 05:51 PM
Xenon-

Sorry about that! But, i just tried again, and with the allow sig set to 0 in the admin cp under edite user, the user is still able to use a signature. I think I have understood what this does, but as far as i can tell, it still allows any kind of signature, text, or img code.

Xenon
07-24-2002, 06:12 PM
@smoothie: try to apply the changes i told boofo for editpost to to also at newreply.php:
after
$signature=iif(trim($signature)=="yes",1,0);
add:
if(!$bbuserinfo[isallowedsig]) $signature=0;

seems i have forgotten this line ;)

Boofo
07-24-2002, 08:29 PM
Does this go in WITH the change you told me or instead of the changes?

Originally posted by Xenon
@smoothie: try to apply the changes i told boofo for editpost to to also at newreply.php:
after
$signature=iif(trim($signature)=="yes",1,0);
add:
if(!$bbuserinfo[isallowedsig]) $signature=0;

seems i have forgotten this line ;)

Chris M
07-24-2002, 08:33 PM
As well as...

Satan

Boofo
07-24-2002, 08:42 PM
I added the code to newthread.php, also. :)

Xenon
07-24-2002, 08:45 PM
yes ;)

i hope it works now ;)

Smoothie
07-24-2002, 08:47 PM
Xenon-

Seems to be working fine. Now, if there would be some way to allow text, and not the img tag, that would be the best.
Like this in the edit user:
Signature text: on
Signature text: off
Signature img code: on
Signature img code: off

Xenon
07-24-2002, 08:55 PM
i think it'll be doable, too ;)

add another field to user table called is isallowedimgsig
in your admin/user.php do the same changes as you've done for allow sigs in general, just replace all isallowedsig with isallowedimgsig

then open member.php find:// check max images
if ($maximages!=0) {
$parsedsig=bbcodeparse($signature,0,$allowsmilies) ;
if (countchar($parsedsig,"<img")>$maximages) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}

and replace it with:// check max images
if ($maximages!=0) {
$parsedsig=bbcodeparse($signature,0,$allowsmilies) ;
if (countchar($parsedsig,"<img")>$maximages or (countchar($parsedsig,"<img")>0 and !$bbuserinfo[isallowedimgsig])) {
eval("standarderror(\"".gettemplate("error_toomanyimages")."\");");
exit;
}
}

i think it should do all ;)

Boofo
07-24-2002, 09:19 PM
If you have this set to no, that would do it, without adding the code above, right?

Allow vB IMG code in signatures?

Xenon
07-24-2002, 09:28 PM
yes, if this is set to no img use in sigs is generally off ;)

but if you want to allow it to some users you had to set this setting to yes and apply my changes :)

Smoothie
08-06-2002, 07:21 AM
add another field to user table called is isallowedimgsigIs this correct?ALTER TABLE `user` ADD `isallowedimgsig` SMALLINT(6) DEFAULT '1' NOT NULL;

Smoothie
08-06-2002, 07:24 AM
in your admin/user.php do the same changes as you've done for allow sigs in general, just replace all isallowedsig with isallowedimgsigis this correct?makeinputcode("Can use siganture","isallowedimgsig",$user[isallowedimgsig],0);

Smoothie
08-06-2002, 07:28 AM
I'm not to sure about this part, admin/user.php$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupi d='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',isallowedsig=$isallowedsig,adminemail=$adminemai l,showemail=$showemail,invisible=$invisible,userti tle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cook ieuser=$cookieuser,nosessionhash=$nosessionhash,da ysprune='$daysprune',lastvisit=$lastvisit,lastacti vity=$lastactivity,lastpost=$lastpost,posts='$post s',timezoneoffset='$timezoneoffset',emailnotificat ion=$emailnotification,receivepm='$receivepm',emai lonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");What do I add?

Xenon
08-06-2002, 11:41 AM
yes correct both ;)

$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupi d='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',isallowedsig=$isallowedsig,isallowedimgsig=$isal lowedimgsig,adminemail=$adminemail,showemail=$show email,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cook ieuser=$cookieuser,nosessionhash=$nosessionhash,da ysprune='$daysprune',lastvisit=$lastvisit,lastacti vity=$lastactivity,lastpost=$lastpost,posts='$post s',timezoneoffset='$timezoneoffset',emailnotificat ion=$emailnotification,receivepm='$receivepm',emai lonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

Smoothie
08-06-2002, 03:37 PM
Xenon-

Many thanks. I will let ya know how it goes!

isman
09-11-2002, 12:50 AM
Is this supposed to affect posts that already have signatures in them? I tested it on a user with a signature and the signatures still show in her posts.

Smoothie
09-11-2002, 07:25 AM
it just disables new signatures, signatures in old posts aren't infected
run a query if you want to do it for old posts to

rstark
02-20-2003, 07:01 AM
Can someone release a hack for this that will work on all posts (old/new)?

Frozen Dreams
05-17-2003, 11:05 AM
Ok I put in all the changes u guys mentioned here - however when I set allow sig to 0 in the user profile in acp - and then go back to the same user the sig is back to 1 again ...
any idea someone ...