HOW TO allow viewing of links for "registered user" pages?

Talk and info about common issues

Moderators: ne_moj, zewa

administrator
Site Admin
Site Admin
Posts: 5930
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO allow viewing of links for "registered user" pages?

Postby administrator » Apr 22nd, '12, 07:42

Please do following:

In Menu.class.php take out the line in red in the SELECT statement below:

$sql = "SELECT
".TABLE_PAGES.".*
FROM ".TABLE_PAGES."
INNER JOIN ".TABLE_LANGUAGES." ON ".TABLE_PAGES.".language_id = ".TABLE_LANGUAGES.".abbreviation
INNER JOIN ".TABLE_MENUS." ON ".TABLE_PAGES.".menu_id = ".TABLE_MENUS.".id
WHERE
".TABLE_PAGES.".language_id = '".$lang_id."' AND
".TABLE_MENUS.".menu_placement = '".$position."' AND
".TABLE_PAGES.".menu_id = '".$menu_id."' AND
".TABLE_PAGES.".is_home = 0 AND
".TABLE_PAGES.".is_published = 1 AND
(".TABLE_PAGES.".finish_publishing = '0000-00-00' OR ".TABLE_PAGES.".finish_publishing >= '".@date("Y-m-d")."')
".((!$objLogin->IsLoggedIn()) ? " AND ".TABLE_PAGES.".access_level = 'public'" : "")."
ORDER BY ".TABLE_PAGES.".priority_order ASC";
return database_query($sql, DATA_AND_ROWS);

In page.php comment and add lines at the very bottom of the page as follows:

//draw_title_bar(_PAGE);
//draw_important_message(_PAGE_UNKNOWN);
$objSession->SetMessage("notice", _MUST_BE_LOGGED);
header("location: index.php?user=login");
exit;

Special thanks for this solution to hugomp

Return to “ApPHP MicroCMS {HOW TO}”