dps123

Members
  • Content count

    36
  • Joined

  • Last visited

Community Reputation

3 Neutral

About dps123

  • Rank
    Jr. Member

Recent Profile Visitors

536 profile views
  1. Has anyone got any ideas please?
  2. 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?
  3. 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.
  4. Anyone?
  5. 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?
  6. 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.
  7. Oh, I see. So my sort should be working. Let me take a look and possibly post another question!
  8. Thanks a squillion, I'll take a look.
  9. 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?
  10. 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'.
  11. Yes, there's a 'comment_created_at' field on the comments. I tried that but it didn't affect the results.
  12. Any idea how I can sort newest to oldest? Changing to -created doesn't seem to work. $pages->find($commentsSelector . ', sort=-created, limit=10');
  13. Sorry, one question - what exactly are we doing here with 'afterjohn'? "afterjohn=(template=comment...
  14. 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.
  15. Thanks guys! I hadn't realised just how complicated this was. LostKobrakai - will that method work with page numbers?