vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Request - Users can edit a post, until an Admin notifies it is not editable? (https://vborg.vbsupport.ru/showthread.php?t=40532)

Chris M 07-01-2002 07:51 PM

Request - Users can edit a post, until an Admin notifies it is not editable?
 
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:
PHP Code:

if ($bbuserinfo[userid]!=$postinfo[userid]) {
        
// check user owns this post
        
show_nopermission();
      } else { 

replace with
PHP Code:

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


PHP Code:

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

before add:
PHP Code:

if ($bbuserinfo[usergroupid] == 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:
Code:

<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
PHP Code:

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

and replace it with:
PHP Code:

if($bbuserinfo[usergroupid]!=and $bbuserinfo[usergroupid]!=5$editable=1;
$DB_site->query("UPDATE post SET editable='".$editable."',title='".addslashes(htmlspecialchars($title))."',pagetext='".addslashes($message)."',allowsmilie='$allowsmilie',showsignature='$signature',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?

[sql]ALTER TABLE `thelyceu_vbulletin`.`post` ADD `editable` SMALLINT(1) NOT NULL;[/sql]
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

1 Attachment(s)
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

Code:

<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

1 Attachment(s)
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*


All times are GMT. The time now is 12:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01037 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete