only moderators and user who start the topic can reply

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
EbadMahmood
Registered User
Posts: 11
Joined: Sat Aug 29, 2020 12:39 pm

only moderators and user who start the topic can reply

Post by EbadMahmood »

Hi everyone,

I want to set permissions to forum( by code or any extension ) that only user ( who start the topic ) and moderator can reply.

I found some code but it didn't work as I want viewtopic.php?f=72&t=1123155&start=15

I change forum ids but it only allow moderators to reply not users(who start the topic). I'm not so good at coding that's why i can't figure out mistake.

please anybody help me out in this. :cry:
User avatar
david63
Registered User
Posts: 18303
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: only moderators and user who start the topic can reply

Post by david63 »

I believe this extension will do what you want - https://www.phpbb.com/customise/db/exte ... erstopics/
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
EbadMahmood
Registered User
Posts: 11
Joined: Sat Aug 29, 2020 12:39 pm

Re: only moderators and user who start the topic can reply

Post by EbadMahmood »

david63 wrote:
Thu Sep 17, 2020 7:00 am
I believe this extension will do what you want - https://www.phpbb.com/customise/db/exte ... erstopics/
1. It work with phpbb 3.3.1?
2. If it works can you explain it how to set permission after installation of extension.
EbadMahmood
Registered User
Posts: 11
Joined: Sat Aug 29, 2020 12:39 pm

Re: only moderators and user who start the topic can reply

Post by EbadMahmood »

I found this code its work but it only allow moderator to reply not users who started the topic
posting.php

Code: Select all

 
 //array(xx,yy,zz) are hard coded forum_ids 
 if (in_array($forum_id, array(1,2,3)) && !($auth->acl_get('a_') || $auth->acl_get('m_')))
    {
       if ($mode == 'quote')
       {
          // Get topic id for this post
          $sql_topic = 'SELECT topic_id
                   FROM ' . POSTS_TABLE . '
                   WHERE post_id = ' . $post_id;
             
          $result_topic = $db->sql_query_limit($sql_topic, 1);
          
          if ($row_topic = $db->sql_fetchrow($result_topic))
          {
             $topic_id = $row_topic['topic_id'];
          }

          $db->sql_freeresult($result_topic);
       }

       if ($mode == 'reply' || $mode == 'quote')
       {
          // Check if last poster is the current poster
          $sql = 'SELECT t.topic_poster
                FROM ' . TOPICS_TABLE . ' AS t, ' . POSTS_TABLE . ' AS p
                WHERE t.topic_id = ' . $topic_id . '
                   AND p.post_id = t.topic_poster';
                
          $result = $db->sql_query_limit($sql, 1);
          
          if ($row = $db->sql_fetchrow($result))
          {
             $topic_poster = $row['topic_poster'];
          }
          $db->sql_freeresult($result);
          
          if ($user->data['user_id'] != $topic_poster)
          {
             trigger_error('Only the topic owner or a moderator is permitted to reply! Thanks..');
          }
       
       }
    }

Anyone can fix this code
User avatar
david63
Registered User
Posts: 18303
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: only moderators and user who start the topic can reply

Post by david63 »

EbadMahmood wrote:
Thu Sep 17, 2020 7:23 am
It work with phpbb 3.3.1?
I believe it does - but see https://www.phpbb.com/customise/db/exte ... pic/222956
EbadMahmood wrote:
Thu Sep 17, 2020 7:23 am
can you explain it how to set permission after installation of extension.
Sorry no as I have never used it but look at the support topics and FAQs for the extension
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
david63
Registered User
Posts: 18303
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: only moderators and user who start the topic can reply

Post by david63 »

EbadMahmood wrote:
Thu Sep 17, 2020 7:28 am
Anyone can fix this code
Unlikely as it is for phpBB 3.0
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
EbadMahmood
Registered User
Posts: 11
Joined: Sat Aug 29, 2020 12:39 pm

Re: only moderators and user who start the topic can reply

Post by EbadMahmood »

[/quote]Unlikely as it is for phpBB 3.0
[/quote]

There is no way to convert it for phpbb 3.3 ?
EbadMahmood
Registered User
Posts: 11
Joined: Sat Aug 29, 2020 12:39 pm

Re: only moderators and user who start the topic can reply

Post by EbadMahmood »

david63 wrote:
Thu Sep 17, 2020 7:00 am
I believe this extension will do what you want - https://www.phpbb.com/customise/db/exte ... erstopics/
i have install this extension but no permissions are visible.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 22739
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket probably.

Re: only moderators and user who start the topic can reply

Post by Mick »

You should post in the dedicated discussion/support forum for the extension here.
"The more connected we get the more alone we become" - Kyle Broflovski©
Post Reply

Return to “phpBB Custom Coding”