Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

1,300 profile views

dps123's Achievements

Jr. Member

Jr. Member (3/6)




Community Answers

  1. I have a small issue with my $pages->find query. My pages have a repeater field that is a checkbox. I'm trying to sort the results so that I get pages where at least one of the repeaters has the checkbox field checked. What I'm doing currently is: $my_pages = $pages->find("sort=-my_repeater.my_checkbox_field"); So I'm sorting high to low, i.e. checked before not checked. The issue is that it only appears to take into account the checked status of the first repeater item. If the second, third etc is checked, the page is not appearing at the top of the results. I'm guessing there must be an easy way to check all items in the repeater?
  2. Unfortunately not; that will give me checked items first. I'm just looking at this: https://processwire.com/talk/topic/3571-sorting-page-array-containing-pages-without-the-sort-field/, as that might be more like what I need.
  3. I can see there is an issue when I'm trying to sort pages by the repeater value. So when I'm doing sort=my_repeater.my_checkbox and wanting an order of 0 to 1, if there are no repeater items on a page, they are appearing first in my list. Can I do something for that?
  4. Any idea why this doesn't work: $user_image->url but this does: $user_image->url.$user_image when I'm setting that as my img src.
  5. Oh, I see. So my sort should be working. Let me take a look and possibly post another question!
  6. Thanks a squillion, I'll take a look.
  7. I'm trying to sort a $pages->find result by a checkbox value. sort=my_repeater.my_checkbox The idea is that I get pages with the checkbox unticked before pages with the checkbox ticked, i.e. 0 to 1. Because I haven't given my checkbox fields a name, they are using the field name. I can see in PW that the checkboxes are labelled my_checkbox_repeater123456 So I think my sort is not working. Is there a way around this?
  8. Can someone please show me what I'm doing wrong here. I've got a form for users to update their profile image. The image field is called 'profile-image'. I'm then using the API to update the image: if($_FILES['profile-image']) { $new_image = strtolower($sanitizer->name($_FILES['profile-image']['name'])); $user->of(false); // remove existing image $user->user_image->removeAll(); // add new image $user->user_image->add($new_image); // save the page $user->save(); $user->of(true); } The user_image field is set to 'Automatic' with a max files of 1. If I look at the user in ProcessWire, the image field says 'File cannot be displayed'.
  9. Yes, there's a 'comment_created_at' field on the comments. I tried that but it didn't affect the results.
  10. Any idea how I can sort newest to oldest? Changing to -created doesn't seem to work. $pages->find($commentsSelector . ', sort=-created, limit=10');
  11. Sorry, one question - what exactly are we doing here with 'afterjohn'? "afterjohn=(template=comment...
  12. Thanks LK, I'll give it a go when I get a mo. The support on this site is unbelievable. You really should charge people for this.
  13. Thanks guys! I hadn't realised just how complicated this was. LostKobrakai - will that method work with page numbers?
  • Create New...