Jump to content

psy

Members
  • Posts

    741
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by psy

  1. Client suddenly realised she needed a website in order to hand out her new business cards which had the website URL & email address, less than 2 weeks before her TED talk. 

    Was given 1x logo, 1x photo, 1x phone screenshot of a paragraph of text and told she'd like to see the 'wings flying'.

    TED talk event 2 Nov 2017: https://www.ted.com/tedx/events/23988

    End result landing page: https://beautifulhumanway.com/

    Hopefully site will grow to show more of this amazing woman and her achievements

    Using PW 3.0.79 with delayed output and regions

    Modules (many thanks to @ryan and his pro modules):

    Profields: Functional fields

    Profields: Repeater Matrix

    ProCache

    FormBuilder

    MarkupSEO

    MarkupJson-LDSchema

    MarkupSimpleNavigation

    MarkupSrcSet

    EmailObfuscator

    and for a short time during development, PageProtector

     

    • Like 14
  2. Thank you @ryan for pointing me in the right direction. Problem solved.

    FormBuilder was a red herring, all good there. The cryptic debug message was key to finding the cause.

    Quote

    Fatal error: Uncaught PDOException: You cannot serialize or unserialize PDO instances in [no active file]:0 Stack trace: #0 [internal function]: PDO->__sleep() #1 [internal function]: session_write_close() #2 {main} thrown in [no active file] on line 0

    I refer to the home page throughout the site and normally add $homePage = $pages->get('/'); in the _init.php file.

    Tried to be too clever and tweak page load speed by reducing the number of database calls so put the following below the LoginRegister code:

    // shortcut to home page saved in session
    $homePage = $session->get('home-page');  // Fairly certain this is the culprit!
    if (!$homePage) {
        $homePage = $pages->get('/');
        $session->set('home-page', $homePage);
    }

    While the above works for $cache, it doesn't for $session, or even replacing $session with $_SESSION and using array_key_exists('home-page', $_SESSION), etc.

    Reverted to $homePage = $pages->get('/'); for every page and Login/Register working perfectly. 

    • Like 3
  3. Managed to get Login/Register working on a clean install with no FormBuilder with a few minor tweaks to the code:

    Firstly, to be on the safe side, I changed $page->url to $page->httpUrl. Secondly, on occasion my frontend page named 'login' got confused with the admin page named 'login' so specified exactly where to redirect.

    if(!$user->isLoggedin() && $page->id!=1193) { // not for login page
        $session->set('returnPage', $page->httpUrl);
        $session->redirect($pages->get(1193)->url);
    }

    Still having issues with SessionCSRF with LoginRegister + FormBuilder. Will post in the FB forum.

    Thanks

    • Like 1
  4. @wbmnfktr thanks for recreating the scenario - epic :) and also for the feedback.

    Still more weirdness on my site and I have a horrible feeling the conflicting session-related module may be FormBuilder even though at one point, I removed all FB forms from the login page (there was one in the footer) and turned off SessionCSRF on all FB forms. :( Will keep working on it. Any other help/suggestions in the meantime most welcome

  5. Having problems with the new Login/Register module and hoping someone can help.

    Desired result:

    • Guest lands on site (or later specific page) and is redirected to the Login page.
    • The user’s landing page is saved to a session and once logged-in, is redirected back to the original landing page

    What’s happening:

    • Guest lands on any page on the site and is redirected to the Login page
    • Guest enters credentials, hits submit, then sometimes a variety of error messages get written to the logs including sessionCSRF and MYSQL errors. Guest user is presented with the Internal Server Error. Regardless, guest is not logged in

    Scenario:

    • Using PW 3.0.76 and PHP 5.6

    blob.thumb.png.fa15a413cea222e183059b39bb3df22c.png

    • User account created manually in admin with login-register privilege
    • User is my old mate:

    blob.thumb.png.ccbe8035174c62e2a03ed68e9cc658ea.png

    • Site is configured to use delayed output with Regions & Functions API

    In _init.php I have:

    <?php namespace ProcessWire;
    if(!$user->isLoggedin() && $page->id!=1193) { // not for login page
        $session->set('returnPage', $page->url);
        $session->redirect('/login/');
        die;
    }

    In login.php template:

     
    <?php namespace ProcessWire;
    
    if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) {
        // login and go back to the previous page or go to the home page
        $goToUrl = $session->returnPage ? $session->returnPage : '/';
        $session->redirect($goToUrl);
    } else {
        // let the LoginRegister module have control
        $content = $modules->get('LoginRegister')->execute();
    }
    ?>
    
    <div id="regContent">
        <div class="content-wrap">
            <div class="container clearfix">
                <region id="regPostContent">
                    <!-- Post Content
                    ============================================= -->
                    <div class="postcontent nobottommargin clearfix col_three_fourth">
                        <?=$content?>
                     </div><!-- .postcontent end -->
                </region><!--#regPostContent-->
            </div>
        </div>
    </div><!-- #content end -->

     

    What am I doing wrong? Why can’t Fred login?

    Any help to resolve much appreciated.

     

    TIA

    Psy

    PS: Tried to use TracyDebugger to see what was happening but got js errors. Just not my day. Uninstalled TD and no errors :(

  6. Did you do the upgrade to DropboxAPI.module ? The original version in GitHub looked for the wrong path to the autoload.php of the SDK files. This is what it should be:

    require_once dirname(__FILE__) . '/dropbox-php-sdk/vendor/autoload.php';

    From what I can gather from the error you mentioned, the SDK files aren't being loaded. The updated code should fix that.

  7. Hi @benbyf

    Yeah, the namespace stuff did my head in too! Adding them at the top of the page template under <?php namespace ProcessWire; was the only way I could get it to work. Once they're there, and the PW module is loaded, it's a matter of following the dropbox-api-sdk documentation to the letter.

    Ooops! Just realised the GitHub version of the module has an error. Will upload fix.

  8. 35 minutes ago, Mike Rockett said:

    Priority: not done yet. I'll follow a basic principal with this: if the priority is set on a specific page, then it will be added. Otherwise, the tag will be left out.

    The docs say the tag is optional so it sounds right to me. Thanks @Mike Rockett

  9. Wishlist/request... would love to see on a per page/template basis a sitemap priority field.

    When no priority is specified, Google goes 'top page - 100%', 'sub page - 80%', 'sub-sub-page - 60%'. 

    In reality however, the 'sub-page' is often the parent page in the menu. The 'sub-sub-page' has the guts & glory that you want indexed with a high priority.

    Google doesn't guarantee but says it will give a sub-sub-page with a priority eg of 80% a higher priority than it's root parent with a priority of 60%.

    https://www.sitemaps.org/protocol.html

    • Like 2
  10. Maybe you need to carry var v into the function:

    <script>
    
      var v = new Array();
      v[0] = <?=$page->video_720->url?>;
      v[1] = <?=$page->video_1080->url?>;
    
      function changeVid(v) {
          var video = document.getElementById('video');
          if (screen.height <= 720) video.setAttribute("src", v[0]);
          else if (screen.height > 720) video.setAttribute("src", v[1]);
          
          video.load();
      }
    
      changeVid(v);
    
    </script>

     

  11. Hi and welcome to the forums.

    Not sure this is the right forum for your question, but..

    The same way you call the poster... ie wrap the code in php tags:

    46 minutes ago, creativeguy said:

    v[0] = <?=$page->video_720->url?>;

    v[1] = <?=$page->video_1080->url?>;

    The template will then render the $page->video within the javascript before outputting to the browser.

    • Like 1
  12. @Roych

     

    9 hours ago, Roych said:

    <?php foreach($pages->get('/settings/')->BackgroundImages->getRandom() as $bck): ?>

    You are only retrieving one BackgroundImages item with getRandom(). To get multiple items for your Wire Array you need to specify how many you want. https://processwire.com/api/ref/wire-array/get-random/

    Alternatively to retrieve all BackgroundImages in random order you could try:

    <?php foreach($pages->get('/settings/')->BackgroundImages->shuffle() as $bck): ?>

     

    • Like 9
×
×
  • Create New...