smile Posted January 25, 2010 Share Posted January 25, 2010 Hi, I'm using gallery2 v2.3. I want to use miniCMS module to be able to write articles in my gallery site. I have installed the miniCMS module and it works fine. The problem I'm having is that front page is assigned a default article from miniCMS. This frontpage article is shown by changing main.php file. By adding this code: $rewritePath = (isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path'] : null); $itemId = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId'] : null); $page = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page'] : null); if (empty($viewName) && !$gallery->isEmbedded() && empty($itemId) && empty($rewritePath) && empty($page)) { $viewName = 'minicms.Show'; GalleryUtilities::putRequestVariable('view', $viewName); While this code works fine as expected it disables the administrator from seeing root gallery, that means user created albums and permissions. So I thought that I can use if statement to solve this. if ( $user.isGuest == 1 ) { $rewritePath = (isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'path'] : null); $itemId = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'itemId'] : null); $page = (int)(isset($_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page']) ? $_GET[GALLERY_FORM_VARIABLE_PREFIX . 'page'] : null); if (empty($viewName) && !$gallery->isEmbedded() && empty($itemId) && empty($rewritePath) && empty($page)) { $viewName = 'minicms.Show'; GalleryUtilities::putRequestVariable('view', $viewName); } } else { } if ( $user.isGuest == 1 ) { true part } } else { } If I reverse like this if ( $user.isGuest == 0 ) then the true part fires, if if ( $user.isGuest == 1 ) it does not. But the problem is if I login that makes no difference. So I think this means the problem is "$user.isGuest" the gallery2 can't understand this, the other part "== 0" or "== 1" just reverses the if-statement. The only variable explanation I found is http://codex.gallery2.org/Gallery2:Themes:Reference:Variables but it is for templates not php file. debug shows "Use of undefined constant isGuest - assumed 'isGuest' in" I'm trying to exclude or include part of code into main.php depending if user is logged in or not. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.