Jump to content

rash

Members
  • Posts

    100
  • Joined

  • Last visited

Profile Information

  • Location
    Stuttgart, Germany

Recent Profile Visitors

1,155 profile views

rash's Achievements

Sr. Member

Sr. Member (5/6)

32

Reputation

  1. Hi guys, I’m stuck on trying to set up a Remember Me function for frontend user logins. I’m using Login/Register to handle the logic and everything is running fine. To add the option of keeping users with a specific role persistently logged in, I’ve installed LoginPersist which does exactly what I want, as long as I use it in Automatic mode. Since it’s not always a good idea to play games in the background without letting the user know, I would prefer to let him check whether he wants to be remembered or not and use LoginPersist in Manual Mode. The doc says: I will probably be able to check the response, my problem is to get the Remember Me checkbox into the form, ideally between the password field and the submit button. The form is rendered with $loginRegister->execute(); My guess is to hook somewhere in one of the loginRegister methods, but unfortunately I can’t find a working approach.
  2. Not solved, just bypassed: Fresh PW install into a different root directory on the same machine, moved old /site/ directory to the new install and set config.php to the old database and user salt. After clearing the cache and session folder, everything runs fine now. Fortunately, this very obscure situation appeared on a site that is managed by myself and nobody else. To have this on customer work would probably be a nightmare. I don’t know if it’s possible or rather a security issue, but I would appreciate it very much if an error message would reveal a bit more than 'This request was aborted because it appears to be forged'. The error seems to occur repeatedly at least since 2012 without any systematic debugging strategy beyond guesswork into the blue. To hear that something went wrong is arguably better than complete silence, but a bit more information what the system doesn’t like would be helpful.
  3. @Pixrael Thanks for your help. Your thread is one of those I read before, but it didn’t lead me much further. It seems as if the error can have approximately thousand different causes and so the 127+ forum topics you mentioned are mostly guesswork with some enviably happy winners. That’s not meant sneeringly, I know that server based issues can be very hard to catch. In my case I’m not sure whether I’m struggling with a server case at all. When you go to bed with a working site and wake up the next morning with an unworking one without any changes on your system, it’s not very likely that your database acts suddenly strange or your PHP session path is not writable anymore. Furthermore I copied the site to a local environment in the meantime, where precisely the same shit happens. As far as I can see, it has to be something inside the /site/ directory or the database. As I updated to the latest dev version, /wire/, index.php and htaccess should be fine.
  4. As far as I understand it right what you want to achieve, I would loop through all pages with an API script, delete the old image(s) of each, put the new image(s) to the same field and save the page. I have a similar situation on a site where a lot of images get synced with external sources very often and the delete & save method works reliable.
  5. Hi all, on a site working flawlessly since a few years, I suddenly cannot login anymore, all I get is 'This request was aborted because it appears to be forged'. The site runs on a shared hosting server, my last active changes happened many months ago and the hosting service usually changes nothing without clearly notifying it long before. Means: I haven’t got the slightest clue where to start. Of course I’ve used the forum search, read probably all related threads and followed the most hints (some of them are pretty old, so I decided to be cautious) but no success. A few facts: - I don’t know the exact PW version as I can’t find it outside the unaccessible backend, but it should be at least 3.0.16X. - TracyDebugger is in use on this site, but not SessionHandlerDB. - I deleted /site/assets/logs, /site/assets/cache and /site/assets/session. Before I did that, all of them were writable. - I replaced index.php with the latest dev version. - When I set $config->protectCSRF to false, the message disappears, but the login page gets constantly reloaded. - Setting $config->debug to true delivers 'Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in .../site/config.php on line 104', followed by warnings, that the header was already sent by.
  6. @BillH Meanwhile the hook is working. All data is collected in one textarea that I’ve set to hidden. It still is a workaround in the sense of not going the direct way, but it does what I wanted to achieve without any noise or bad smell, so I would call it an excellent solution. Means: my efforts on searching for something different declined dramatically. Here is the complete hook – less for you as the "inventor", but for others that may get stuck at the same point. I keep the code in /site/templates/admin.php as it is admin related only, but /site/ready.php would work as well. <?php $wire->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments(0); $page->of(FALSE); // disable page formatting $cache = ""; // string collecting the single fragments if ($page->template == "invoice" || $page->template == "standard") { // blocks is a Repeater Matrix field with the types item and text foreach($page->blocks as $block) { if ($block->type == "item") { $cache .= $block->title." "; $cache .= $block->body." "; } else if ($block->type == "text") { $cache .= $block->body." "; } } // notes is a direct child of $page $cache .= $page->notes." "; } else if ($page->template == "customer") { // cust_base is of (pro) field type Combo, it stores data different // from Repeater Matrix fields but shares a similar syntax $cache .= $page->cust_base->street." "; $cache .= $page->cust_base->city." "; $cache .= $page->cust_base->shorthand." "; $cache .= $page->cust_base->phone." "; $cache .= $page->cust_base->email." "; $cache .= $page->notes." "; } else if ($page->template == "contact") { // cust_contact is a Combo field too $cache .= $page->cust_contact->prename." "; $cache .= $page->cust_contact->surname." "; $cache .= $page->cust_contact->phone." "; $cache .= $page->cust_contact->email." "; $cache .= $page->notes." "; } // searchcache is a simple Textarea field that can be included // as a searchable source in Modules/Core/ProcessPageSearch $page->searchcache = $cache; }); ?>
  7. I am happy too! Though I don't understand why the typecasting didn’t work, (int) "40000" (or intval("40000")) should result in 40000, not 0. Strange …
  8. The most simple way to achieve that is to call a detail page (based on a detail template) and specify the news item with a get parameter like so: <p><a href="/newsdetail/?newsid=<?= $item->id; ?>">read more</a></p> In this case, your detail template would contain only the logic to receive an id and render the markup for $item with the given id. If you don’t like get parameters, you could alternatively use form submits instead of <a href> and send the ids as post variables.
  9. You still didn’t reveal your results. Could you do something like that to see the four values and their according types? $raised = $page->get("raisedAmount$count"); $goal = $page->get("goalAmount$count"); $goalNum = (int) $goal; $raisedNum = (int) $raised; echo $raised; echo gettype($raised); echo $goal; echo gettype($goal); echo $goalNum; echo gettype($goalNum); echo $raisedNum; echo gettype($raisedNum); Normally it shouldn't be much of a problem to divide two integers in PHP, so I suspect it to be slightly more hidden.
  10. Ah, okay, I see. It was a bit confusing without knowing the context. But what values/types exactly do you get after typecasting $goal and $raised? Did you try intval($val) instead of (int) $val?
  11. What are raisedAmount$count and goalAmount$count you’re getting with $page->get? Fields that contain a dollar sign? Or is $count supposed to be a subfield of raisedAmount/goalAmount ? I’ve never seen a construction like that with dollar signs in, usually you do $page->field or $page->get('field') and field names cannot contain dollar signs, as far as I know. So what are the results of those two get calls if any and what are their types when you ask for gettype($goal) or gettype($goalNum)?
  12. I agree with your problem assessment and know the repeater.field construction from several front end searches/selectors. It’s probably a limit of dragging and dropping fields instead of setting up selectors manually. As fields inside a repeater stay ordinary fields with sort of a virtual framework around them, the field select lists only the basic fields without any knowledge of their repeater context. (If I remember it correctly, there is a similar limitation at FormBuilder’s drag & drop field mapping.) Your first solution proposal sounds very interesting, though I’ve never even recognized the existence of the field type Cache before. So I did what you suggested and got pretty excited, but only until I tried to include my astonishing new Cache field to the search list: it’s not offered as an option. Obviously the select is restricted to text and textarea fields with no exception. As long as I don’t find anything better, I will solve it with your proposal #2. It might not be the most elegant thing on earth, but definitely a sturdy workaround and therefore a very good idea. Thanks a lot for it!
  13. Thanks for yor reply @BillH, while it didn’t help me in a direct way, it did so indirectly. If A works on B but not on C, it’s a good idea to investigate the differences between B and C. Although I don't know your environment, I found one thing I suspected to be possibly specific and this first trial already brought the little devil on stage: all included fields reside in Repeater Matrix fields. As soon as I take them out and keep them as fields of the page itself, everything is running smooth. So I redefine my question: Is it possible to include text or textarea fields of Repeater Matrix fields into the admin search scope? (I guess the problem will be the same with simple Repeater fields.)
  14. Hi guys, I tried to customize the admin search by adding more fields to be searched, following this older thread. Modules/Core/ProcessPageSearch promised to be an easy thing, as you just select the (text/textarea) fields you want to include. Sadly, content in this additional fields doesn’t get found at all. I cleaned the module cache, saved a few test pages etc. but there’s nothing found beside text in the title field. Am I missing something?
  15. Yes, it does for me here too. Started to work immediately after I eliminated a typing error in my template name. (In fact I didn’t assume one second you would post non-working code, but was pretty sure the problem is located in front of my display.) So another big thanks, that was very instructive.
×
×
  • Create New...