lock new topic on submit

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Extensions Robot
Extensions Robot
Extensions Robot
Posts: 28795
Joined: Sat Aug 16, 2003 7:36 am

lock new topic on submit

Post by Extensions Robot »

Modification name: lock new topic on submit
Author: spaceace
Modification description: gives an option for member with moderator permissions to lock a new topic on the posting page so you do not have to go back and lock the topic after it has been submitted
Modification version: 1.0.4
Tested on phpBB version: 3.0.8

Download file: Lock_New_Topic_on_Submit_1_0_4.zip
File size: 60.69 KiB

Modification overview page: View

The phpBB Team is not responsible nor required to provide support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB Extension Customisations Team may not be able to provide support.

-->Modification support<--
Last edited by Extensions Robot on Mon Sep 14, 2020 12:37 pm, edited 16 times in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 27482
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

lock new topic on submit

Post by Paul »

Modification validated/released

Notes:
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

lock new topic on submit

Post by spaceace »

thanks for the validation Paul :mrgreen:

my first mod :D

screen shot is here

Image

also working on a bug the won't let the topic be unlocked while editing the first post if the topic was locked with this mod. for now, please the "Quick-mod tools" to unlock the topic if it has been locked with this mod until the bug has been resolved. thank you Anyasha for pointing this out ;)
Anyasha
Registered User
Posts: 704
Joined: Mon Aug 07, 2006 4:02 am
Name: Anyasha

Re: lock new topic on submit

Post by Anyasha »

Congrats on the release. :)
Kiss me, I'm Polish!
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

Anyasha wrote:Congrats on the release. :)
thanks :mrgreen:

i'm still trying to find an answer for ya ;)
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

to fix the topic not unlocking by editing the post

open root/posting.php

find and delete

Code: Select all

	$post_data['topic_status']		= ($mode == 'post' && (isset($_POST['lock_topic']) && $auth->acl_get('m_lock', $forum_id)) ? true : false);
find

Code: Select all

	$post_data['enable_sig']		= ($config['allow_sig'] && $user->optionget('attachsig')) ? true: false;
add after

Code: Select all

	$post_data['topic_status']		= ($mode == 'post' && (isset($_POST['lock_topic']) && $auth->acl_get('m_lock', $forum_id)) ? true : false);
find

Code: Select all

	//'S_LOCK_TOPIC_ALLOWED'		=> (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false,
	'S_LOCK_TOPIC_ALLOWED'		=> (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : (($mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered']))) ? true : false,
replace with

Code: Select all

	'S_LOCK_TOPIC_ALLOWED'		=> (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false,
purge the cache in acp.

i just tested this on my local server(windows) as well as my live server(linux) with debug and debug extra enabled and encountered no errors
Souleyman
Registered User
Posts: 33
Joined: Mon Mar 09, 2009 11:52 pm

Re: lock new topic on submit

Post by Souleyman »

Hi, spaceace.
I've got the common error when I've tried to submit the post

Code: Select all

SQL ERROR [ mysql4 ]

Unknown column 'topic_status' in 'field list' [1054]

SQL

INSERT INTO phpbb3_posts (forum_id, poster_id, icon_id, poster_ip, post_time, post_approved, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, post_username, post_subject, post_text, post_checksum, post_attachment, topic_status, bbcode_bitfield, bbcode_uid, post_postcount, post_edit_locked, topic_id) VALUES (......some values......)

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions_posting.php
LINE: 1872
CALL: dbal_mysql->sql_query()

FILE: posting.php
LINE: 1003
CALL: submit_post()
Where I was wrong?
3.0.4 running
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

Souleyman wrote:Hi, spaceace.
I've got the common error when I've tried to submit the post

Code: Select all

SQL ERROR [ mysql4 ]

Unknown column 'topic_status' in 'field list' [1054]

SQL

INSERT INTO phpbb3_posts (forum_id, poster_id, icon_id, poster_ip, post_time, post_approved, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, post_username, post_subject, post_text, post_checksum, post_attachment, topic_status, bbcode_bitfield, bbcode_uid, post_postcount, post_edit_locked, topic_id) VALUES (......some values......)

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions_posting.php
LINE: 1872
CALL: dbal_mysql->sql_query()

FILE: posting.php
LINE: 1003
CALL: submit_post()
Where I was wrong?
3.0.4 running
looks like a bad edit to posting.php. could you post the contents of that file?
Souleyman
Registered User
Posts: 33
Joined: Mon Mar 09, 2009 11:52 pm

Re: lock new topic on submit

Post by Souleyman »

Retry to fix the code and try to use your fixes from this topic, no changes, still the same error mate.

This is my posting.php code in zip file:
http://www.souleyman.ru/pic/posting.zip
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

that file looks fine.

could you post your functions_posting.php as well?
Souleyman
Registered User
Posts: 33
Joined: Mon Mar 09, 2009 11:52 pm

Re: lock new topic on submit

Post by Souleyman »

User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

that file has the incorrect edit.

you added the line for functions__posting.php in the wrong place.

you added it after this

Code: Select all

				'post_attachment'	=> (!empty($data['attachment_data'])) ? 1 : 0,
when it should be after this

Code: Select all

				'topic_attachment'			=> (!empty($data['attachment_data'])) ? 1 : 0,
correct your edit and it should be fine ;)
Souleyman
Registered User
Posts: 33
Joined: Mon Mar 09, 2009 11:52 pm

Re: lock new topic on submit

Post by Souleyman »

AAAAAAA! I'm blind old creaker!!! :oops:

All is right now.

Kindly thanks for the help and sorry for so foolish trouble pal.
User avatar
spaceace
Registered User
Posts: 1999
Joined: Wed Jan 30, 2008 8:50 pm
Contact:

Re: lock new topic on submit

Post by spaceace »

Souleyman wrote:AAAAAAA! I'm blind old creaker!!! :oops:

All is right now.

Kindly thanks for the help and sorry for so foolish trouble pal.
glad you got it working :D
Mi ji
Registered User
Posts: 6
Joined: Tue Mar 24, 2009 9:38 am

Re: lock new topic on submit

Post by Mi ji »

Simple, yet useful. I don't know how many times I've written posts that should be locked, and had to go back to lock them (not to mention, forget to once or twice, and have people start responding). :oops:
Locked

Return to “[3.0.x] MOD Database Releases”

cron