• Content count

  • Joined

  • Last visited

  • Days Won


abdus last won the day on August 17

abdus had the most liked content!

Community Reputation

325 Excellent

About abdus

  • Rank
    Sr. Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Istanbul, Turkey
  • Interests
    Web development, gymnastics, photography

Recent Profile Visitors

1,178 profile views
  1. How can I trigger the module for all pages (with paired fields) at once? Like mass-updating all pages? Setting field to itself doesn't work foreach($pages->find('template=post') as $p) { $p->of(false); $p->tags = $p->tags; echo $p->save(); } // doesnt work because the module skips the page if none of the paired field is changed public function updatePageFields(HookEvent $event) { // ... foreach($flds as $fld) { $this_fname = $fld->name; // only if the page is not still null and the field has changed if(!$page->id || !$page->isChanged($this_fname)) continue; // ... } } }
  2. There should be at most 1 page with featured=1, but $pages->find() returns PageArray, you'd have to iterate over it but it's just semantics. What I'm interested is how you'd get a hook to run just once and stop further hooks from getting triggered inside that hook.
  3. I'm having this issue for the last week or so. When I sign in, I make sure to check "Remember Me" box, but it doesn't seem to change anything. My account gets logged out after an hour or so, even more frequently on my smartphone. Issue persists in different browsers and devies. I am using a VPN (actually a ShadowSocks proxy) but how I connect shouldn't matter, because session cookies are sent with each HTTP request Does anyone know what's happening and how I can stop this? This is how cookies look when I log out This is after logging in Cookies seem to be set correctly, their expiration is set to 3 months later, but it expires anyway.
  4. Yeah, that could work too
  5. How about something like this? Create a Checkbox field called featured, add it to a template Hook into Page::savedField, return if field name is not 'featured' Check if $page ($page = $event->arguments(0)) has $page->featured=1 Perform a $pages->find("featured=1, id!=$page") Iterate over those pages and set featured=0 Now one potential problem that comes to my mind is that as you're iterating over these pages, the hook will be called over and over. Setting $event->cancelHooks = true before you do the iteration should cancel subsequent hooks, but I haven't tried it.
  6. Does $testID get posted correctly? There has to be a problem with the page id. Can you check the item id again (Admin > Repeaters > some-page-name > repeater-item)?
  7. Getting a page with its id should return that page regardless of its status or access settings. I am able to get a repeater page by its id using $pages->get(1039); https://processwire.com/api/ref/pages/get/ Using $pages->find(), however, takes page access and status into account
  8. Go to Setup > Fields & Setup > Templates, there's two buttons on bottom right that you can use to export/import fields & templates Also, remember to backup your database http://modules.processwire.com/modules/process-database-backups/
  9. There's Multipler Module from @ryan's Profields pack, which will help you a lot and change the way you develop PW. It is a commercial module, but you get to use it on any website once you buy it. https://processwire.com/api/modules/profields/
  10. Yeah, Console is a part of @adrian's Tracy Debugger. It's a great tool to keep under your belt. http://modules.processwire.com/modules/tracy-debugger/
  11. Here's what I did. I set up a Page Reference Field, where client can pick a parent. This means with $page->related_random I can get the parent. Getting its children is simply $page->related_random->children->find(). I then iterate over them and output some data
  12. $maxProducts = 1; $productParent = $page->related_random; $pages->find("parent=$productParent, template=product, sort=random, limit=$maxProducts"); or $page->related_random->children->find("template=product, sort=random, limit=1");
  13. I think I get it now. You want to group children by values of a column Something like this one works: So this code $parent = $pages->get(1017); $groupedByLow = []; foreach($parent->children as $child) { foreach($child->prod_vid_bandwidth as $item) { $groupedByLow[$item->band_lo][] = $child->name; } } ksort($groupedByLow); // sort by band_lo dump($groupedByLow); Groups children like this (I used name field for presentation) array (3) 10 => array (1) 0 => "new-car" (7) 20 => array (2) 0 => "old-car" (7) 1 => "new-car" (7) 60 => array (1) 0 => "old-car" (7) You may need to check for null inside the second foreach.
  14. So, it's similar to this one? Since $child->prod_vid_bandwidth will return a TableRows object, you cant simply do $page->tableField->column, but you can foreach over the TableRows object or extract any column you want
  15. What kind of field is prod_vid_bandwidth? You have a typo. There shouldn't be a period there, it should be an object operator -> like others. Unless I'm mistaken period is used for string concatenation only.