Users are allowed to moderate their own topics

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
Seether
Registered User
Posts: 74
Joined: Thu Apr 10, 2003 8:09 pm

Users are allowed to moderate their own topics

Post by Seether » Mon Sep 29, 2008 6:41 pm

Hi,

I'm looking für a mod (a snippet) or at least some hints to the following situation:
A User should moderate (in a certain forum) his own topics. The idea is to use a forum as a place for user blogs. Some users like smalltalk others don't. So with this modification it's up to the user to watch his topic.


S.

User avatar
dontcoz
Registered User
Posts: 458
Joined: Mon Sep 29, 2008 9:49 pm
Location: Vancouver, BC
Contact:

Re: Users are allowed to moderate their own topics

Post by dontcoz » Wed Jan 13, 2010 7:50 am

yes, pls. i've been looking for something like that everywhere:)
it existed for phpBB2 but for some reason not for 3.

User avatar
dontcoz
Registered User
Posts: 458
Joined: Mon Sep 29, 2008 9:49 pm
Location: Vancouver, BC
Contact:

Re: Users are allowed to moderate their own topics

Post by dontcoz » Sun Jan 31, 2010 1:46 am

and by moderate, having an option to delete posts in their own topics would suffice, nothing more. lock own topics already exists.

User avatar
Jarode
Registered User
Posts: 48
Joined: Thu Feb 14, 2008 12:20 pm
Contact:

Re: Users are allowed to moderate their own topics

Post by Jarode » Tue Mar 30, 2010 6:33 pm

I'm looking for a such MOD too. :P
My english is Developement Quality, sorry
MyrmecoFourmis.com : Fourmis

tonia
Registered User
Posts: 15
Joined: Fri Jul 30, 2010 3:22 am

Re: Users are allowed to moderate their own topics

Post by tonia » Fri Jul 30, 2010 3:24 am

Hello!
I also need this, I want to be able to have users be able to move their own topics. Any say on if anybody is working on this?

User avatar
BadBlock
Registered User
Posts: 81
Joined: Sat Oct 06, 2001 8:33 pm

Re: Users are allowed to moderate their own topics

Post by BadBlock » Sat Jul 31, 2010 11:57 am

Interested. Subscribed.

User avatar
Jarode
Registered User
Posts: 48
Joined: Thu Feb 14, 2008 12:20 pm
Contact:

Re: Users are allowed to moderate their own topics

Post by Jarode » Tue Aug 03, 2010 2:13 am

What's new ? :)
My english is Developement Quality, sorry
MyrmecoFourmis.com : Fourmis

Sonya*
Registered User
Posts: 22
Joined: Sat Oct 13, 2007 5:14 pm

Re: Users are allowed to moderate their own topics

Post by Sonya* » Thu Aug 19, 2010 12:55 pm

I have created a quick mod that works for me. This mod allows the topic starter to edit and delete all posts in the own topics. This permission is local and can be assigned to any user in combination with any forum.

I appreciate any feedback, if somebody would give it a try.

##############################################################
## MOD Title: Moderate own topics
## MOD Author: Sonya
## MOD Description: This mod allows you assign permission to moderate
## (edit and delete) posts in the topics where the user is the
## topic starter.
## MOD Version: 1.1
##
## Installation Level: Moderate
## Installation Time: 10 Minutes
## Files To Edit: viewtopic.php, posting.php
##############################################################
# Before Installing This MOD, You Should Back Up All Related Files
##############################################################
## History:
## 1.1 - 20110324 - Fix check for edit time.
## 1.0 - 20100819 - Initial release.
##############################################################

#
#-----[ DIY INSTRUCTIONS ]--------------------------
#
Create a file addpermission.php on your local disk and paste the code below into it:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Setup $auth_admin class so we can add permission options
include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$auth_admin = new auth_admin();

// Add permissions
$auth_admin->acl_add_option(array(
    'local'     => array('f_author'),
));
?>
#
#-----[ COPY ]------------------------------------------
#
addpermission.php -> /

#
#-----[ DIY INSTRUCTIONS ]--------------------------
#
Call the file addpermission.php from your browser, e. g. http://www.myforum.com/addpermission.php. The new permission will be created. Delete the file addpermission.php, you do not need it any more.

#
#-----[ OPEN ]------------------------------------------
#
language/en/acp/permissions_phpbb.php

#
#-----[ FIND ]------------------------------------------
#

Code: Select all

	'acl_f_noapprove'	=> array('lang' => 'Can post without approval', 'cat' => 'misc'),
#
#-----[ AFTER, ADD ]------------------------------------
#

Code: Select all

	'acl_f_author'	        => array('lang' => 'Can moderate own topics', 'cat' => 'misc'),

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#

Code: Select all

	$postrow = array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#

Code: Select all

        if ($auth->acl_get('f_author', $forum_id) && $user->data['user_id'] == $topic_data['topic_poster']) {
            $edit_allowed = true;
            $delete_allowed = true;
        }
#
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#

Code: Select all

		if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id))
#
#-----[ REPLACE WITH ]----------------------------------
#

Code: Select all

		if ($user->data['is_registered'] && ($auth->acl_gets('f_edit', 'm_edit', $forum_id) ||  ($auth->acl_get('f_author', $forum_id) && $post_data['topic_poster'] == $user->data['user_id'])))
#
#-----[ FIND ]------------------------------------------
#

Code: Select all

		trigger_error('CANNOT_EDIT_TIME');
#
#-----[ REPLACE WITH ]----------------------------------
#

Code: Select all

		            if (!($auth->acl_get('f_author', $forum_id))) {
		trigger_error('CANNOT_EDIT_TIME');
            }
#
#-----[ FIND ]------------------------------------
#

Code: Select all

	if ($user->data['user_id'] != $post_data['poster_id'])
#
#-----[ REPLACE WITH ]----------------------------------
#

Code: Select all

	if ($user->data['user_id'] != $post_data['poster_id']  && !($auth->acl_get('f_author', $forum_id) && $user->data['user_id'] == $post_data['topic_poster']))
#-----[ FIND ]------------------------------------
#

Code: Select all

	if ($user->data['user_id'] != $post_data['poster_id'])
#
#-----[ REPLACE WITH ]----------------------------------
#

Code: Select all

	if ($user->data['user_id'] != $post_data['poster_id']  && !($auth->acl_get('f_author', $forum_id) && $user->data['user_id'] == $post_data['topic_poster']))
#
#-----[ FIND ]------------------------------------
#

Code: Select all

	if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))


#
#-----[ REPLACE WITH ]----------------------------------
#

Code: Select all

	if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) ||  ($auth->acl_get('f_author', $forum_id) && $user->data['user_id'] == $post_data['topic_poster']))
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#

To test the permission, go to the admin panel and assign the user a forum permission "Can moderate own topics" found under Misc permissions.
Last edited by Sonya* on Thu Mar 24, 2011 4:41 pm, edited 4 times in total.

User avatar
BadBlock
Registered User
Posts: 81
Joined: Sat Oct 06, 2001 8:33 pm

Re: Users are allowed to moderate their own topics

Post by BadBlock » Thu Aug 19, 2010 2:15 pm

So it does not work for groups, is that right?

Sonya*
Registered User
Posts: 22
Joined: Sat Oct 13, 2007 5:14 pm

Re: Users are allowed to moderate their own topics

Post by Sonya* » Thu Aug 19, 2010 2:29 pm

BadBlock wrote:So it does not work for groups, is that right?
It works as group's forum permission. You can set the permission for the group(s) on the chosen forum.

User avatar
BadBlock
Registered User
Posts: 81
Joined: Sat Oct 06, 2001 8:33 pm

Re: Users are allowed to moderate their own topics

Post by BadBlock » Thu Aug 19, 2010 3:04 pm

Wow!

BTW it seems that addpermission.php file contents is incomplete.

Sonya*
Registered User
Posts: 22
Joined: Sat Oct 13, 2007 5:14 pm

Re: Users are allowed to moderate their own topics

Post by Sonya* » Thu Aug 19, 2010 3:10 pm

BadBlock wrote:Wow!

BTW it seems that addpermission.php file contents is incomplete.
It is complete. If you miss ?> at the end, you do not need it :) This is optional in PHP and, if included, can cause problems with trailing whitespaces in files
The closing tag of a PHP block at the end of a file is optional
http://de2.php.net/basic-syntax.instruction-separation

EDIT: I have added the closing tag into my instructions to avoid confusion. However, you still do not need it ;)

User avatar
Jarode
Registered User
Posts: 48
Joined: Thu Feb 14, 2008 12:20 pm
Contact:

Re: Users are allowed to moderate their own topics

Post by Jarode » Thu Aug 19, 2010 7:59 pm

Great ! :P
If one day I want to uninstall this MOD, how to remove the permission added by addpermision.php ?
Thanks
My english is Developement Quality, sorry
MyrmecoFourmis.com : Fourmis

tonia
Registered User
Posts: 15
Joined: Fri Jul 30, 2010 3:22 am

Re: Users are allowed to moderate their own topics

Post by tonia » Thu Aug 19, 2010 10:34 pm

what about being able to move your own topic?
(on one forum of my board, users want to be able to move their topics of items they want to give away for free to a subforum of 'taken items' when they have already given the items away

User avatar
dontcoz
Registered User
Posts: 458
Joined: Mon Sep 29, 2008 9:49 pm
Location: Vancouver, BC
Contact:

Re: Users are allowed to moderate their own topics

Post by dontcoz » Fri Aug 20, 2010 1:57 am

why not submit it for validation sonya? this is awesome btw, thank you for posting it here:)

Locked

Return to “[3.0.x] MOD Requests”