[RC] Open/Close mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
Locked
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

[RC] Open/Close mod

Post by Blaster95 »

Modification Name: Open/Close
Author: Blaster95

Modification Description:: By inserting -close- or -open- into a topic it will either open or close the thread. This can only be done by moderators and admins however
Modification Version:: 1.0.0

Demo URL: www.blaster.stonerocket.co.uk/forums
Demo Username: Demo
Demo Password: Demo123



Modification Download: http://www.blaster.stonerocket.co.uk/openclose_mod.zip
Last edited by Blaster95 on Tue Jul 07, 2009 5:51 am, edited 1 time in total.
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

added install.xml
added license.txt

The folder also contains a install.txt file
User avatar
Gleasonator
Registered User
Posts: 652
Joined: Tue Jun 05, 2007 2:19 pm
Location: Texas
Contact:

Re: [RC] Open/Close mod

Post by Gleasonator »

Awesome idea, thanks. :)

Just curious, have you accounted for code and quote tags? For example, if I wrote:

Code: Select all

-close-
Nothing should happen, as I'm displaying how a command could be executed, not actually attempting to execute the command. Also, quoting someone who has -close- in his/her post could cause the thread to be closed.
Sorry for my bad Engrish !
gleason|design

Image
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

I have not. I will have to try and get this fixed
kmxak
Registered User
Posts: 21
Joined: Tue May 05, 2009 6:48 pm

Re: [RC] Open/Close mod

Post by kmxak »

hi can we modify the mod that he is working with the post_bot
the post_bot should close the topic after his posting but nothing happens.

the bot has all rights
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

hmmm.... what posting bot are you using?
kmxak
Registered User
Posts: 21
Joined: Tue May 05, 2009 6:48 pm

Re: [RC] Open/Close mod

Post by kmxak »

[RC] Post Bot Mod - New Version 1.0.2
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

It could be a problem with the bot
poppertom69
Registered User
Posts: 383
Joined: Wed Jun 06, 2007 7:44 am
Location: Bucks, UK
Name: Tom Martin

Re: [RC] Open/Close mod

Post by poppertom69 »

The bot uses phpbb inbuilt api but it depends where you check the message for content inside the function submit_post or in posting.php as the bot doesn't use submit_post so you would have to add the check into submit_post for the bot to be able to do it or add it into the function of the post bot
Do one thing everyday, that scares you!
User avatar
MasterZ
Registered User
Posts: 712
Joined: Wed Sep 24, 2003 5:33 am
Contact:

Re: [RC] Open/Close mod

Post by MasterZ »

Can this be restricted to only a certain forum?

Also, can you make it so it adds [OPEN] or [CLOSED] to the beginning of the title?

Do you have a demo?
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

poppertom69 I would talk to the creator of the bot

MasterZ I will see what I can do about a Demo


As for only a certain forum I will see what I can do. as for the [open] and [closed] tags I think there is a mod out there for that already
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

Demo Created... please see original post
poppertom69
Registered User
Posts: 383
Joined: Wed Jun 06, 2007 7:44 am
Location: Bucks, UK
Name: Tom Martin

Re: [RC] Open/Close mod

Post by poppertom69 »

Blaster95 wrote:poppertom69 I would talk to the creator of the bot
I am the mod author so I know the problem!
Do one thing everyday, that scares you!
Blaster95
Registered User
Posts: 40
Joined: Sun Apr 09, 2006 3:36 am

Re: [RC] Open/Close mod

Post by Blaster95 »

oppss... Well do you think it maybe a problem on your end?
poppertom69
Registered User
Posts: 383
Joined: Wed Jun 06, 2007 7:44 am
Location: Bucks, UK
Name: Tom Martin

Re: [RC] Open/Close mod

Post by poppertom69 »

if you want this mod to work on the post bot you need to do the following

Open
includes/functions_post_bot.php

Find
right at the bottom of the file

Code: Select all

		//Restore user permissions
		pb::change_auth('', 'restore', $perms);
	}
}
?>
Add Before

Code: Select all

		
		global $db;
		if (($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) && (preg_match( '#-close-#i', $message)))
		{
			$sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_status = ' . ITEM_LOCKED . '
				WHERE topic_id = ' . (int) $topic_id . '
				AND topic_moved_id = 0';
			$db->sql_query($sql);
			$user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : '';
			
			add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . 'LOCK', $subject);
		}

		if (($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) && (preg_match( '#-open-#i', $message)))
		{
			$sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_status = ' . ITEM_UNLOCKED . '
				WHERE topic_id = ' . (int) $topic_id . '
				AND topic_moved_id = 0';
			$db->sql_query($sql);			
			$user_unlock = ($auth->acl_get('f_user_unlock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : '';
			
			add_log('mod', $forum_id, $topic_id, 'LOG_' . $user_lock . 'UNLOCK', $subject);
		}
		
And that will work for you
Do one thing everyday, that scares you!
Locked

Return to “[3.0.x] MODs in Development”