Cannot access custom actions unless logged in

Started by soderlund, November 29, 2015, 06:51:14 AM

Previous topic - Next topic

soderlund

I added some custom actions (following the instructions on the wiki) but users can only access the custom action pages when they are logged in.

How do i make the custom actions available to users who are not logged in?

Kindred

'show' => true,

this line defines when the menu item is displayed...

you apparently have
'show' => $context['is_logged'],

or something like that
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

soderlund

No, show is true.

	
$buttons = array(
	
	
'info' => array(
	
	
	
'title' => $txt['mymenu_info'],
	
	
	
'href' => $scripturl '?action=about',
	
	
	
'show' => true,
	
	
	
'sub_buttons' => array(
	
	
	
	
'about' => array(
	
	
	
	
	
'title' => $txt['mymenu_about'],
	
	
	
	
	
'href' => $scripturl '?action=about',
	
	
	
	
	
'show' => true,
	
	
	
	
),
	
	
	
	
'rules' => array(
	
	
	
	
	
'title' => $txt['mymenu_rules'],
	
	
	
	
	
'href' => $scripturl '?action=rules',
	
	
	
	
	
'show' => true,
	
	
	
	
),
	
	
	
	
'terms' => array(
	
	
	
	
	
'title' => $txt['mymenu_terms'],
	
	
	
	
	
'href' => $scripturl '?action=terms',
	
	
	
	
	
'show' => true,
	
	
	
	
),
	
	
	
	
'security' => array(
	
	
	
	
	
'title' => $txt['mymenu_security'],
	
	
	
	
	
'href' => $scripturl '?action=security',
	
	
	
	
	
'show' => true,
	
	
	
	
),
	
	
	
	
'help' => array(
	
	
	
	
	
'title' => $txt['help'],
	
	
	
	
	
'href' => $scripturl '?action=help',
	
	
	
	
	
'show' => true,
	
	
	
	
),
	
	
	
),
	
	
	
'is_last' => $context['right_to_left'],
	
	
),
	
	
# ...
	
);

The forum is only available for registered users. action=help can be viewed without logging in but my custom actions can't.

soderlund

Ah, I see what you mean: show determines whether the menu item shows up in the menu.

It shows up in the menu.

But when you enter the page, you come to the login screen (not on action=help though).

Kindred

ah... that;s another issue then...   you would have to check the individual permissions for each of those actions...

URL?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

If guest access is off (eg, guests only see the login page), you need to hack your index.php to add your custom action to the list of allowed things guests can do
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

soderlund

Quote from: margarett on November 29, 2015, 07:28:55 PM
If guest access is off (eg, guests only see the login page), you need to hack your index.php to add your custom action to the list of allowed things guests can do
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn'))))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}

Aaaahhhh, there it is! Thank you.

Advertisement: