Jump to content

Dean

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by Dean

  1. I'd be grateful if people could offer some advice on the best set up to allow users to vote for their favourite page. Registered users will be able to choose a 1st, 2nd, 3rd and 4th place page. Once voting is closed, the page with the most 1st place votes will be the winner, followed by the most 2nd place votes and so on. I did think of adding some fields to the user template, e.g. 1st_place_page, 2nd_place_page, 3rd_place_page, 4th_place_page. These would hold the ID of the page that they voted for. Then I could loop through all the users and calculate the totals. The issue is that there are lots of different categories to vote on, so that would mean adding 1st, 2nd, 3rd, 4th place fields for each category to the user template. Is there a better way of doing this that anyone can suggest? Thanks!
  2. Sorry @BillH, I had to work on something else for a few days. So, back to this. If I change $traders = pages($selector); to $traders = $pages->find($selector); I get Notice: Undefined variable: pages Fatal Error: Uncaught Error: Call to a member function find() on null Regarding sorting, I'm sorting by title if I haven't specified a search string if(strpos($selector, "~=") === false) $selector .= "sort=title, "; If there is a search string, are the results not sorted by ProcessWire according to relevance?
  3. Thanks @BillH, I'm using the code from the Skyscraper demo: // check if there are any keyword searches in the selector by looking for the presence of // ~= operator. if present, then omit the 'sort' param, since ProcessWire sorts by // relevance when no sort specified. if(strpos($selector, "~=") === false) $selector .= "sort=name, "; I'm using renderPager(): $traders = findTraders($selector, 5); $pager = $traders->renderPager(); ... echo $pager; findTraders() is a slightly modified version of findSkyscrapers() function findTraders($selector, $limit=10) { // check if there are any keyword searches in the selector by looking for the presence of // ~= operator. if present, then omit the 'sort' param, since ProcessWire sorts by // relevance when no sort specified. if(strpos($selector, "~=") === false) $selector .= "sort=title, "; $selector .= "limit=$limit"; echo '<small>'.$selector.'</small><br />'; // now call upon ProcessWire to find the skyscrapers for us $traders = pages($selector); return $traders; }
  4. I have an issue with ordering and repeated results when limiting search results and splitting into pages. Selector is shown just above letters. This is what I get when all results fit on one page: If I limit to 5 per page, I get a different order, missing results, and a repeated result on page 2: Can anyone shed any light please?
  5. Strangely, installing Reno's admin theme has fixed everything. Thank you @renobird
  6. I did find this in the console log: Uncaught ReferenceError: ProcessWire is not defined at ProcessPageListInit
  7. Many thank-yous @kongondo. The site is now working. Kind of. For some reason ProcessWire is showing as the crummy old version (see screenshot), yet I'm using v3.0.148. And the pages aren't showing on /processwire/page/. Everything else seems fine.
  8. Dear community I have put a site live by FTPing files, copying database, updating config, emptying cache DB table. But I now have this: Fatal Error: Uncaught Error: Call to a member function execute() on null in /var/www/vhosts/mydomain.com/httpdocs/index.php:55 Can anyone help please?
  9. Thank you @Jan Romero. I have since started posted in the Formbuilder forum. This is an old post. ? I shall have a read of https://processwire.com/store/form-builder/hooks/.
  10. Thanks @Jan Romero, but this isn't in my code, it's part of the Form Builder. Can I hook into the 'Send checked to pages' function somehow maybe?
  11. This is magical @Jan Romero. When you say 'put this in there', where is 'there'? ?
  12. Actually, it was my fault. I hadn't matched the title to the relevant form field in My Form > Actions > Save to ProcessWire Pages > Page Fields to Form Fields. While we're discussing this, is there a way to trigger an email when sending the form entry to a page. I'd like to be able to tell the user their log in name and password and tell them they can log in now.
  13. Dean

    Fatal Error

    The reason I was creating another user template was because I think there is no name field on the user-hunt template which I think is what was causing the issue with the weird name that was being added when a new user registered. Can you add the name field for me?
  14. Dean

    Fatal Error

    Possibly because I deleted it out of the templates table thinking that was the issue.
  15. Dean

    Fatal Error

    I think the last thing I did was to duplicate the user-hunt template and call it user-hunt2. If you think you can undo what's causing the issue then super! ?
  16. Dean

    Fatal Error

    Only 140kb. ☺️
  17. Dean

    Fatal Error

    Sure. Is it safe to attach the mysql dump here? Thanks for all the help btw.
  18. Dean

    Fatal Error

    I've deleted the template from the 'templates' table but no difference.
  19. Dean

    Fatal Error

    Yes, it was fine last night and that's the only change I've done this morning I think.
  20. Dean

    Fatal Error

    Possibly @kongondo. But that was working apart from the name it used. So this morning I duplicated the user template again following the instructions here: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users Could a crazy user template be causing it? Can I remove it without access to admin?
  21. Dean

    Fatal Error

    Hi @teppo, Every single page is triggering the error, so I can't even get into PW admin I've not changed/updated any modules. The only one I had installed was form builder with stripe I've not update ProcessWire It was all working fine yesterday. Then I came to look at it this morning and I'm getting this. And I was already on I tight schedule to get it done. ?
  22. Dean

    Fatal Error

    Hi @psy, all I have in the log is 2020-06-01 10:28:59 ? http://[url].com/register/ Recoverable Fatal Error: Argument 1 passed to ProcessWire\Users::setCurrentUser() must be an instance of ProcessWire\User, instance of ProcessWire\Page given, called in /var/www/web/wire/core/Session.php on line 188 and defined (line 68 of /var/www/web/wire/core/Users.php) I thought that I was maybe overwriting $user somewhere, but I've searched for $user and there are none.
  23. I'm not sure what I've done, but I'm getting a fatal error on every page now. I've tried reverting back to an older copy of the site but there's no change. Can anybody help please? Catchable fatal error: Argument 1 passed to ProcessWire\Users::setCurrentUser() must be an instance of ProcessWire\User, instance of ProcessWire\Page given, called in /var/www/web/wire/core/Session.php on line 188 and defined in /var/www/web/wire/core/Users.php on line 68
  24. Sorry, I just left that part of the code out. They are being grabbed from the form and run through the sanitizer. I'm using only the form builder module (with stripe payment). All the data for the user is populated correctly. The page title is set correctly as the name that is entered on the form. The URL and the settings > name are the only things that are wrong. See these images:
  25. I've noticed that if I go into PW admin and manually update the name field to something sensible, I can then log in with that name. So the setting of the name after clicking 'Send checked to pages' in the form entries page is my issue now I think.
×
×
  • Create New...