given forum and topic id -> return of moderator?

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
RobiX
Registered User
Posts: 35
Joined: Thu Oct 05, 2017 9:59 am

given forum and topic id -> return of moderator?

Post by RobiX » Wed Dec 06, 2017 6:58 pm

given: viewtopic.php?f=x&t=y (x = 2, y = 1: viewtopic.php?f=2&t=1)

is it possible (and if yes, how) to return a yes/no (boolean), if the current logged-in user is a moderator of the given f=2&t=1 (forum id 2, topic id 1)?


pseudocode:

Code: Select all

<!-- IF IS_MOD and forum=2 and topic=1 -->

is id of the topic unique or forum id necessary?

User avatar
kinerity
Registered User
Posts: 1150
Joined: Mon Sep 01, 2014 1:00 am
Name: Kailey Truscott
Contact:

Re: given forum and topic id -> return of moderator?

Post by kinerity » Thu Dec 07, 2017 2:00 am

Untested. This seems to work in my limited testing. Replace $forum_id with the forum id. There are no "topic moderators". Note that it will check if the user has any moderator permission in the given forum. If you want to check a specific permission, replace m_ with the permission (for example, m_lock).

Code: Select all

$template->assign_var('IS_MOD', ($auth->acl_get('m_', $forum_id) ? true : false));

Code: Select all

<div><!-- IF IS_MOD -->
content if mod
<!-- ENDIF --></div>
phpBB3 Refugees - Unofficial phpBB 3.0.x support

Image

RobiX
Registered User
Posts: 35
Joined: Thu Oct 05, 2017 9:59 am

Re: given forum and topic id -> return of moderator?

Post by RobiX » Thu Dec 07, 2017 10:49 am

tnx for your answer - will try it :)

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50730
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: given forum and topic id -> return of moderator?

Post by Brf » Thu Dec 07, 2017 2:28 pm

How about using the existing U_MCP variable?

RobiX
Registered User
Posts: 35
Joined: Thu Oct 05, 2017 9:59 am

Re: given forum and topic id -> return of moderator?

Post by RobiX » Thu Dec 07, 2017 6:00 pm

Brf wrote:
Thu Dec 07, 2017 2:28 pm
How about using the existing U_MCP variable?
but this doesnt work on a custom coding page, does it?

because you need to check before of the user has rights to view

For example,
own custom coding page#1: can only be viewed if user is moderator in forum 1 and topic 1 else "sorry, ..." (or so)
own custom coding page#2: can only be viewed if user is moderator in forum 1 and topic 2 else "sorry, ..." (or so)

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20424
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: given forum and topic id -> return of moderator?

Post by RMcGirr83 » Thu Dec 07, 2017 6:28 pm

RobiX wrote:
Thu Dec 07, 2017 6:00 pm
but this doesnt work on a custom coding page, does it?
You never mentioned that in your first post that I can see, hence BRF's answer.

Also you need to consider global moderators as well I would think.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50730
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: given forum and topic id -> return of moderator?

Post by Brf » Thu Dec 07, 2017 6:37 pm

RMcGirr83 wrote:
Thu Dec 07, 2017 6:28 pm
You never mentioned that in your first post that I can see, hence BRF's answer.
Indeed. In fact you said:
RobiX wrote:
Wed Dec 06, 2017 6:58 pm
given: viewtopic.php?f=x&t=y (x = 2, y = 1: viewtopic.php?f=2&t=1)
which implies it is the viewtopic.php page.

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: AmigoJack and 13 guests

cron