We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Runway, Members

Members not staying logged in following update to Runway and Members 1.4

I've upgraded a Perch site to the latest versions of Runway and Members 1.4. Now, if I log in with a member email/pass, I am able to view a page utilizing perch_member_logged_in(), but if I try to navigate to another members-only page, I'm asked for my email/pass again. In other words, it appears members aren't staying logged in.

Here is an example page using perch_member_logged_in():

<?php
include('regents-admin/runtime.php');
// $page_head_scripts = <<<PHS
// <script type="text/javascript"></script>
// PHS;

// $page_footer_scripts = <<<PFS
// <script type="text/javascript"></script>
// PFS;
?>
<?php
    if (perch_member_logged_in()) {
        define('PAGE_TITLE',perch_pages_title(true));
        define('PAGE_BODY_ID','gold-first');
        include('_header.php');
        include('_community-nav.php');

    // PAGE START
?>  

    <?php perch_content('Text Sections'); ?>

<?php
        include('_footer.php');
    }else{
        PerchSystem::set_page('/' . pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME));
        define('PAGE_TITLE','Login');
        define('PAGE_BODY_ID','loginBody');
        include('_header.php');
        perch_members_login_form(); 
?>
<script type="text/javascript" src="/js/infieldlabels.js?v=2015012501"></script>
<script type="text/javascript">
    $("label").inFieldLabels();
</script>

</body>
</html>

<?php
    }
?>

when i'm logged out and presented with the login form, this is what debug shows:

Debug Message
SELECT * FROM perch2_pages WHERE pagePath='/classroom-content' LIMIT 1
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/members/login/login_form.html

and here is diagnostics:

SUMMARY INFORMATION

Perch Runway: 2.8.20, PHP: 5.6.14-1+deb.sury.org~trusty+1, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.20), assets (2.8.20), categories (2.8.20), perch_blog (5.0), perch_members (1.4)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_members', );
PERCH_LOGINPATH: /regents-admin
PERCH_PATH: /var/www/public/regents.dev/regents-admin
PERCH_CORE: /var/www/public/regents.dev/regents-admin/core
PERCH_RESFILEPATH: /var/www/public/regents.dev/regents-admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
Resource folder writeable: Yes
HTTP_HOST: regents.dev
DOCUMENT_ROOT: /var/www/public/regents.dev
REQUEST_URI: /regents-admin/core/settings/diagnostics/
SCRIPT_NAME: /regents-admin/core/settings/diagnostics/index.php
Shane Lenzen

Shane Lenzen 18 points

  • 3 years ago
Drew McLellan

Drew McLellan 2637 points
Perch Support

It looks like you're not using routing, is that correct? If so, you might need a newer version of Members than the one you have.

Yes, this site is in the hybrid Perch/Runway state. It looks like Members 1.4 is the latest version? Here's my htaccess:

DirectoryIndex index.php

ErrorDocument 404 http://regents-school.com/

<IfModule mod_rewrite.c>
  RewriteEngine on

# Eliminate www.*
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

# BLOG
  RewriteRule ^article/([a-zA-Z0-9-/]+)/preview$ /article.php?s=$1&preview=all [L]
  RewriteRule ^article/([a-zA-Z0-9-/]+)$ /article.php?s=$1 [L]

  RewriteRule ^news/page/([0-9]+)/{0,1}$ /news.php?page=$1 [L]

  RewriteRule ^news/category/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /news.php?cat=$1&page=$2 [L]
  RewriteRule ^news/category/([a-zA-Z0-9-/]+)$ /news.php?cat=$1 [L]

  RewriteRule ^news/date/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /news.php?year=$1&page=$2 [L]
  RewriteRule ^news/date/([a-zA-Z0-9-/]+)$ /news.php?year=$1 [L]

  RewriteRule ^news/tag/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ /news.php?tag=$1&page=$2 [L]
  RewriteRule ^news/tag/([a-zA-Z0-9-/]+)$ /news.php?tag=$1 [L]

# Enable .php without extension, eliminate trailing slash
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
  RewriteRule (.*)\.php$ /$1 [L,R=301]

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)/$ /$1 [R=permanent,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.php -f
  RewriteRule ^(.+)$ $1.php [L,QSA]

# Perch Runway
  RewriteCond %{REQUEST_URI} !^/regents-admin 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule .* /perch/core/runway/start.php [L] 
</IfModule>

# Set UTF-8
AddDefaultCharset utf-8
<IfModule mod_mime.c>
    AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
</IfModule>

# Eliminate viewable directories
<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# Compression
<IfModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      application/xhtml+xml \
                                      application/xml \
                                      font/opentype \
                                      image/svg+xml \
                                      image/x-icon \
                                      text/css \
                                      text/html \
                                      text/plain \
                                      text/x-component \
                                      text/xml
    </IfModule>
</IfModule>

# 3rd Party Fonts
<IfModule mod_headers.c>
    <FilesMatch "\.(eot|otf|ttc|ttf|woff)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

# File Cache Expirations
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                                      "access plus 1 month"

  # CSS
    ExpiresByType text/css                              "access plus 1 year"

  # Data interchange
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
    ExpiresByType text/x-component                      "access plus 1 month"

  # HTML
    ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
    ExpiresByType application/javascript                "access plus 1 year"

  # Manifest files
    ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
    ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
    ExpiresByType audio/ogg                             "access plus 1 month"
    ExpiresByType image/gif                             "access plus 1 month"
    ExpiresByType image/jpeg                            "access plus 1 month"
    ExpiresByType image/png                             "access plus 1 month"
    ExpiresByType video/mp4                             "access plus 1 month"
    ExpiresByType video/ogg                             "access plus 1 month"
    ExpiresByType video/webm                            "access plus 1 month"

  # Web feeds
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
    ExpiresByType application/font-woff                 "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
    ExpiresByType application/x-font-ttf                "access plus 1 month"
    ExpiresByType font/opentype                         "access plus 1 month"
    ExpiresByType image/svg+xml                         "access plus 1 month"
</IfModule>

# MIME Types
<IfModule mod_mime.c>
  # Audio
    AddType audio/mp4                                   m4a f4a f4b
    AddType audio/ogg                                   oga ogg

  # JavaScript
    # Normalize to standard type (it's sniffed in IE anyways):
    # http://tools.ietf.org/html/rfc4329#section-7.2
    AddType application/javascript                      js jsonp
    AddType application/json                            json

  # Video
    AddType video/mp4                                   mp4 m4v f4v f4p
    AddType video/ogg                                   ogv
    AddType video/webm                                  webm
    AddType video/x-flv                                 flv

  # Web fonts
    AddType application/font-woff                       woff
    AddType application/vnd.ms-fontobject               eot

    # Browsers usually ignore the font MIME types and sniff the content,
    # however, Chrome shows a warning if other MIME types are used for the
    # following fonts.
    AddType application/x-font-ttf                      ttc ttf
    AddType font/opentype                               otf

    # Make SVGZ fonts work on iPad:
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType     image/svg+xml                           svg svgz
    AddEncoding gzip                                    svgz

  # Other
    AddType application/octet-stream                    safariextz
    AddType application/x-chrome-extension              crx
    AddType application/x-opera-extension               oex
    AddType application/x-shockwave-flash               swf
    AddType application/x-web-app-manifest+json         webapp
    AddType application/x-xpinstall                     xpi
    AddType application/xml                             atom rdf rss xml
    AddType image/webp                                  webp
    AddType image/x-icon                                ico
    AddType text/cache-manifest                         appcache manifest
    AddType text/vtt                                    vtt
    AddType text/x-component                            htc
    AddType text/x-vcard                                vcf
</IfModule>

AddType application/x-httpd-php56 php
Drew McLellan

Drew McLellan 2637 points
Perch Support

Members 1.4 is the newest available version, but it's not the newest version. It's quite old now (August, I think).

I'll see if there's an update we can ship.

Great, thanks Drew. This is the only thing keeping me from going live with the Runway upgrade, so a fix would be much appreciated!

Drew McLellan

Drew McLellan 2637 points
Perch Support

Ok, give 1.4.2 a try.

That fixed it, thanks Drew!