Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Global Hook Request
#1
if($mybb->usergroup['canview'] != 1)
{
	// Check pages allowable even when not allowed to view board
	$allowable_actions = array(
		"member.php" => array(
			"register",
			"do_register",
			"login",
			"do_login",
			"logout",
			"lostpw",
			"do_lostpw",
			"activate",
			"resendactivation",
			"do_resendactivation",
			"resetpassword"
		),
		"usercp2.php" => array(
			"removesubscription",
			"removesubscriptions"
		),
	);
	if(!($current_page == "member.php" && in_array($mybb->input['action'], $allowable_actions['member.php'])) && !($current_page == "usercp2.php" && in_array($mybb->input['action'], $allowable_actions['usercp2.php'])) && $current_page != "captcha.php")
	{
		error_no_permission();
	}
	unset($allowable_actions);
}

In globals.php there is that section which will prevent a page access. It would be nice to see a hook there to allow plugin authors access to add more there.
#2
Agreed ^
All my plugins are available for free at MyBB Extend and on my GitHub. MyBB-Plugins.com has been closed and none of my plugins are officially maintained or supported.
#3
Supported Smile
My Company - I am Microsoft Certified in HTML5, CSS3 and JS
#4
Why not.
I'm not here often, shoot a PM or whatever if you want my discord.
#5
(2009-08-29, 12:33 AM)T0m Wrote: Why not.
Cause you can't put hooks everywhere. It's ugly, bad coding practice, and affects performance.
So you have to make a judgement over whether it's really worthwhile to put something at a particular place.
#6
Well i find, for newbs like me, that things keep on getting easier. So why stop the flow? I'm not sayinh everywhere, i know some files completely lack things that are needed.
I'm not here often, shoot a PM or whatever if you want my discord.
#7
(2009-08-29, 04:23 AM)T0m Wrote: So why stop the flow?
Just because it works that way for you doesn't necessarily mean it does so for everyone.

(2009-08-29, 04:23 AM)T0m Wrote: I'm not sayinh everywhere
I'm not either.

(2009-08-29, 04:23 AM)T0m Wrote: i know some files completely lack things that are needed.
That's very nice to know.
#8
I still have this issue with this but I have thought of a possible solution that might be accepted by MyBB Dev. At least I hope.

There doesn't appear to be a good bypass method unless you are hooking into one a few scripts which for a plugin author may not be appropriate.

However why not allow a define?

define("ALLOWABLE_PAGE", 1);

This could be placed on the custom page such my myipn.php. Then you can alter the if statement.
if($mybb->usergroup['canview'] != 1 && !ALLOWABLE_PAGE)
{ 

This can allow a plugin author to allow a page even if the group isn't allowed to view board (canview). Another example use would be contact plugins.

Anyways...please consider. I really think some method for plugin authors to allow their custom pages to bypass the canview permission would be great.

The good news about this too is that this can be used by other mybb core pages to avoid that insane if statement. Similar to the NO_ONLINE define.
#9
That's a good idea


Forum Jump:


Users browsing this thread: 1 Guest(s)