PDA

View Full Version : Request - Users can edit a post, until an Admin notifies it is not editable?


Chris M
07-01-2002, 07:51 PM
Ive got a Request...

Normally, if you didnt want users to edit their posts, you would turn the settings off...

Now...I could go and invidually disallow them to edit posts in that forum, but that isnt what I want either...

I want a little Tick Box to appear in Edit Post, and when an Admin or a Mod ticks it, the user cannot edit that post again until it is un-ticked...

Now...Can this be done?

Satan

Xenon
07-01-2002, 08:21 PM
hmm, i hope i can code it without testing it :)

first of all make a new fiel in the post-table called editable small int standart 1

then open your editpost.php

find this:
if ($bbuserinfo[userid]!=$postinfo[userid]) {
// check user owns this post
show_nopermission();
} else {
replace withif ($bbuserinfo[userid]!=$postinfo[userid] or $postinfo[editable]==0) {
// check user owns this post
show_nopermission();
} else {


eval("dooutput(\"".gettemplate("editpost")."\");");

before add:
if ($bbuserinfo[usergroupid] == 6 or $bbuserinfo[usergroupid]==5) {
eval("\$admineditpost = \"".gettemplate("admineditpost")."\";");
} else {
$admineditpost = "";
}

thats part of my "More Functions in Edit Post if you are an Admin" hack :)

create new template $admineditpost contains:<tr>
<td bgcolor="#DFDFDF" nowrap><normalfont><b>Post editable</b>
<input type="radio" name="editable" value="yes"> yes
<input type="radio" name="editable" value="no"></normalfont></td>
</tr>

then find$DB_site->query("UPDATE post SET title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signa ture',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'");

and replace it with:if($bbuserinfo[usergroupid]!=6 and $bbuserinfo[usergroupid]!=5) $editable=1;
$DB_site->query("UPDATE post SET editable='".$editable."',title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signa ture',iconid='$iconid'$editedbysql$attachmentsql WHERE postid='$postid'");

test it, i think it should work :)

Chris M
07-02-2002, 04:34 PM
Am I to asume this is the Query I was to run?

ALTER TABLE `thelyceu_vbulletin`.`post` ADD `editable` SMALLINT(1) NOT NULL;
Our db is called thelyceu_vbulletin...

Satan

Xenon
07-02-2002, 04:38 PM
yes except the standart value should be set to 1 :)

Chris M
07-02-2002, 04:46 PM
All seems well...

It just kinda seems to cause weird errors when I add $admineditpost to the Editpost template...

See below :

Satan

Chris M
07-02-2002, 04:48 PM
Ah right...

Changed that...

Satan

Xenon
07-02-2002, 04:51 PM
<tr>
<td bgcolor="{ firstaltcolor }" nowrap><normalfont><b>Post editable:</b></normalfont></td><td bgcolor="{ firstaltcolor }" nowrap><normalfont>
<input type="radio" name="editable" value="yes"> yes
<input type="radio" name="editable" value="no">no</normalfont></td>
</tr>

use this as adminedittemplate, and remove the spaces from { firstalt.. }

edit: oh, seen yourself ;)

Chris M
07-02-2002, 05:14 PM
I changed the template there...

Checking to see how it looks:)

Satan

Chris M
07-02-2002, 05:16 PM
It loots great...

Thanks:)https://vborg.vbsupport.ru/external/2011/01/19.gif

Satan

Xenon
07-02-2002, 10:40 PM
hehe you're welcome :)

it seems i have talent in posting hacks without even tested them *gg*

Chris M
07-03-2002, 05:01 PM
Yep:)!

And more the merrier:)

Satan