MyBB Support

[ask] custom file permission

Submitted by Hollyman13, , Thread ID: 71814

Thread Closed
28-01-2018, 11:29 AM
#1
is there anybody who knows about the tutorial to provide custom file permissions
example:

hxxps: //www.website.com/forum/newpoints.php?action=betting

I want to give permission for the file " ?action=betting " this is only for user upgrades

RE: [ask] custom file permission

This post was last modified: 05-02-2018, 11:12 PM by Deadboy
#2
i'd use a php template conditional. for example:
find the template for the shit displayed on that page
put everything these tags:
Code:
<else /></if>
at the very top, put some new code, something like this:
Code:
<if !$GLOBALS['mybb']->user['usergroup'] == 8 then>
Sorry, you don't have access to this feature. Upgrade today to gain access!
Change the 8 to whatever group id your upgraded group is. Remember to add staff or other groups to this if you want, something like:
Code:
<if !$GLOBALS['mybb']->user['usergroup'] == 3 || !$GLOBALS['mybb']->user['usergroup'] == 4 || !$GLOBALS['mybb']->user['usergroup'] == 6 then>
3 4 6 are the default staff groups, moderators, supermods and admins.

RE: [ask] custom file permission

OP
#3
Deadboyi'd use a php template conditional. for example:
find the template for the shit displayed on that page
put everything these tags:
Code:
<else /></if>
at the very top, put some new code, something like this:
Code:
<if !$GLOBALS['mybb']->user['usergroup'] == 8 then>
Sorry, you don't have access to this feature. Upgrade today to gain access!
Change the 8 to whatever group id your upgraded group is. Remember to add staff or other groups to this if you want, something like:
Code:
<if !$GLOBALS['mybb']->user['usergroup'] == 3 || !$GLOBALS['mybb']->user['usergroup'] == 4 || !$GLOBALS['mybb']->user['usergroup'] == 6 then>
3 4 6 are the default staff groups, moderators, supermods and admins.


where should I put that code?

[Image: H6lDLDx4.jpg]

RE: [ask] custom file permission

#4
Install the php template conditionals plugin.
Find the template for the shit you wanna hide.
Modify that template how i explained to modify it.

RE: [ask] custom file permission

OP
#5
06-02-2018, 09:29 AM
Deadboy Wrote:
Install the php template conditionals plugin.
Find the template for the shit you wanna hide.
Modify that template how i explained to modify it.

forget it, I've installed php in template & added the code you gave it, but the result just made the newpointsbetting page into blank / white page

RE: [ask] custom file permission

This post was last modified: 06-02-2018, 04:08 PM by Deadboy
#6
06-02-2018, 10:31 AM
Hollyman13 Wrote:
forget it, I've installed php in template & added the code you gave it, but the result just made the newpointsbetting page into blank / white page

Then the conditionals are broken somehow. Give me a sec.
Try changing the if statement to
Code:
<if($mybb->user['usergroup']!= 4)then>
only and check if that works. If not, take off the brackets and add a space between the $ and if.

RE: [ask] custom file permission

This post was last modified: 06-02-2018, 06:11 PM by Tutti Frutti
#7
Do this..

PHP Code:
if (in_array($mybb->user['usergroup'] , array(1,7))) error_no_permission();
// Place rest of the codes 

If that doesn't work attach the plugin file I'll see where to put it.. I've done it before but forgot where I exactly placed it.
Also edit this partarray(1,7))) and add the usergroup ids you want to restrict.

RE: [ask] custom file permission

OP
#8
okay thanks, i will try both.
hopefully it works fine. Smile

Users browsing this thread: