Jump to content

psy

Members
  • Posts

    736
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by psy

  1. 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
  2. @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
  3. 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 User account created manually in admin with login-register privilege User is my old mate: Username: fred Email: fred@flintstone.com Password: 1234test. 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
  4. Hi @abmcr Try: foreach($page->images->shuffle() as $image) { echo "<img src='$image->url'>"; }
  5. Thanks for this module @DaveP It's so easy to use and saved me heaps of time copy/pasting from lipsum.com
  6. psy

    DropboxAPI

    Think I've sorted GitHub. Let me know if anyone has probs getting the module from there.
  7. psy

    DropboxAPI

    And moi confused noob with GitHub!
  8. psy

    DropboxAPI

    Hi @benbyf The problem is me and github. Cant figure out how to upload the missing files. In the interim, see attached zip. DropboxAPI.zip
  9. psy

    DropboxAPI

    Think I know what's going on, starting with my limited knowledge of github. Trying to work it out...
  10. psy

    Does PW have ...

    Why isn't it WordPress?
  11. psy

    DropboxAPI

    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.
  12. psy

    DropboxAPI

    @benbyf DropboxAPI.module file fixed and uploaded to GitHub. Please update your version and let me know how you get on.
  13. psy

    DropboxAPI

    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.
  14. The docs say the tag is optional so it sounds right to me. Thanks @Mike Rockett
  15. 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
  16. 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>
  17. 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: The template will then render the $page->video within the javascript before outputting to the browser.
  18. Is your image field configured to one image only? if not, try $image->first->url
  19. @Roych 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): ?>
  20. @billjoseph you are not alone
  21. @billjoseph I may be missing something here but why not simply modify the outer_tpl template in $options to include the Search button? Then it would always be the last item in the menu. 'outer_tpl' => '<ul>||<li><a href="#modal-example" title="Search" uk-toggle>Search</a></li></ul>',
  22. Hi @Margie I'm an Aussie ProcessWire developer. Happy to help you promote the ProcessWire cause
  23. psy

    DropboxAPI

    @benbyf Tested and confirmed you can do this. Simple example (no paging although that's possible too): <?php namespace ProcessWire; use Kunnu\Dropbox\Dropbox; use Kunnu\Dropbox\DropboxApp; use Kunnu\Dropbox\DropboxFile; $drop = $modules->get('DropboxAPI'); //Configure Dropbox Application $app = new DropboxApp($drop->app_key, $drop->app_secret, $drop->authorization_code); //Configure Dropbox service $dropbox = new Dropbox($app); $listFolderContents = $dropbox->listFolder(""); //root folder is the folder you nominated in the Dropbox App config. Refer doco $items = $listFolderContents->getItems(); ?> <ul> <?php foreach ($items as $item) : ?> <li><?=$item->getName()?></li> <?php endforeach; ?> </ul> As for download links, you could use the Dropbox Chooser https://www.dropbox.com/developers/chooser#javascript or create your own with javascript.
  24. psy

    DropboxAPI

    @benbyf Thanks Ben The token request could be on the admin side BUT the Dropbox call back URL must be a publicly viewable page to receive the token. I chose to put both the request and response on the same page and then unpublish the page once I'd received the token. According to the documentation, https://github.com/kunalvarma05/dropbox-php-sdk/wiki/Working-with-files the answer is yes. The PW module really does little more than authenticate the user and allow you to create the $dropbox object (as in example above for sending a file). Add all the appropriate "use" namespace statements in your template and you'll have full access to the API, including the ability to List Folder Contents
  25. psy

    DropboxAPI

    Tip: By default the Dropbox App is in Development mode and allows only one user - you. When you apply for a token you may get a Dropbox notification saying you need more users. Simply go back into your Dropbox App configuration and click on the button to the right of this setting. You'll automatically be granted 500 development users. Should you need more than 500 users, you'll need to apply to Dropbox for Production status for your App and totally outside the scope of this ProcessWire Dropbox API module.
×
×
  • Create New...