suntrop
-
Posts
316 -
Joined
Posts posted by suntrop
-
-
-
Hi there! I'd like to sort some pages – kind of categorised blog posts.
CMS:
Blog - GROUP #1 - Cat A - Post 2018-12-01 - Post 2018-10-10 - Cat B - Post 2018-11-11 - Post 2018-05-05 - GROUP #2 - Cat C - Post 2018-12-05 - Post 2018-01-01 - GROUP …
The user can select from different options to sort GROUP #1, GROUP #2, GROUP #n pages by date, title and … latest posts. If the user selects "Latest posts" it should show as:
See latest posts from … » GROUP #2 (with a Post from 2018-12-05) » GROUP #1 (with a Post from 2018-12-01) » …
Is this possible with a selector/PW's API? I guess it doesn't work like that, but perhaps I can utilise the newly added option to create a custom WireArray (https://processwire.com/blog/posts/processwire-3.0.117-core-updates/)? I think I have to loop the groups, find the latest post and create a new property with the timestamp.
-
Well, you are right. Thanks for pointing me the right direction.
Had the $user->of(false) on the wrong line and just needed to move it before setting the field value. Don't know, why this worked on the default login.
-
Hi all
I am using the login form
$modules->get('LoginRegister')->execute()
and have in /site/init.php
$session->addHookAfter('loginSuccess', function($event) { // Update user's last login time $user = $event->arguments(0); $user->details->last_login = time(); $user->of(false); $user->save('details'); if(wire('page')->template == 'admin') return; wire('session')->redirect('/dashboard/'); exit(); });
But somehow, the last_login subfield doesn't update, if I use the Login/Register module login. However, it updates using "PW's default login".
Any idea why? Seems to be the only reliable method to check if the user logged in successfully. The other one, afterLogin, runs for failed logins as well, as I can see.
-
Ha ? didn't know this is possible. Have this working now with
$ps = wire('pages')->find('template=board, (children.children.created>="24 hours ago"), (children.children.children.created>="24 hours ago"), (children.children.children.children.created>="24 hours ago")');
… perhaps I wasn't clear enough, I need some levels more. Anyhow, the above will work for me.
Thanks Zeka!
-
I want to find pages, which have sub sub pages created the last 24 hours. Those two selectors don't work … I guess, because I am looking for grand (grand) children, not direct children.
$ps = wire('pages')->find('template=board, children=[created>="24 hours ago"]'); $ps = wire('pages')->find('template=board, children.created>="24 hours ago"');
- Does children in this context mean only direct children, or any children, grand children etc.?
- Any idea how to get my pages?
Home - BOARD A - - Cat 1 - - - Page (created 96 hours ago) - BOARD B - - Cat 1 - - Cat 2 - - - Page (created 12 hours ago) - - - Page - - Cat 2 - BOARD C - - Cat - - Cat - - - Page - - - - Page (created 5 hours ago) - - - Page Need to find BOARD B and BOARD C
-
Thanks. Now it works here too. Don’t know what was wrong. I tested all sorts of combinations.
Had it going in two steps, first finding all pages with the first param, and then finding amongst them the page with the second parameter. But with one selector it is much better
Anyhow, thank you for testing.
-
I need to find a page with two parameters which are contained within a text field. It is kind of a list of technical parameters.
Content of a field looks like:
2 mm
80x110 cm
1310 g
whiteor
1,5 mm
50x90 cm
1210 g
blackMostly I am looking for the first two rows. I thought this one should work, but i doesn't:
$result = $page->child('attributes^="2 mm", attributes%="80x110 cm"');
Both operators (^= and %=) work on its own, but not combined. Is this not translated to find the child page, that has "2 mm" on the beginning of the attributes field and also has "80x110 cm" in the attributes field?
-
Reason found. It is one of my modules ?… I don't know why it didn't work when I disabled all modules.
// Add hook for Email fields, to prevent two email fields share the same email address $this->addHookAfter("InputfieldEmail::processInput", $this, "validEmail"); protected function validEmail($event){ if ($event->wire('page')->rootParent->id != 2) return; $field = $event->object; if ($field->name == 'email') { $page = $this->modules->ProcessPageEdit->getPage(); $oldEmail = $page->get($field->name); $newEmail = $field->value; $existEmail = $this->wire('users')->get('id!=' . $page->id . ', email=' . $newEmail); if($existEmail && $existEmail->id > 0) { $field->value = $oldEmail; $field->error($this->_("Die E-Mail-Adresse $newEmail ist bereits für einen Kunden gespeichert")); } } }
I had some trouble before, with this one (don't remember what exactly). I need this, to prevent users share the same email address.
But the server error stays the same. Even without the code above, and I can save TD settings, I still get the error 500 if TB is enabled.
-
Yes, used a Private Window
-
I have (updated to) v4.13.6 on PW 3.0.98 with PHP 7.0.11. I disabled all my modules and still got the server error.
Whenever I click the Save button I get redirected to /processwire/module/bookmarks/ nothing will be saved and the error message "ProcessWire: Unrecognized path" is displayed. TD is enabled and Output mode is set to Detect.
-
It took some time, but I figured out here is something wrong with my TracyDebugger installation. When I remove the folder I see the PW exception. I just noticed I can’t save anything in the TD config. I get redirected to a Bookmark page in PW. I can’t uninstall it or disable it, same error. I‘ll try to figure out if there is any of my plugins causing the trouble.
-
Sometimes I see a server error 500, instead of a PHP/PW error message. I don't know why and it makes it hard to figure out what is wrong.
Here is an example from today.
try { $return = wireRenderFile('partials/confirm', $vars); } catch (\Exception $e) { throw new WireException('Render Partial failed: ' . $e->getMessage()); }
Error: I was using an old/missing function in the file partial/confirm.php. But why do I see a server error (500) and not a PHP error message or the exception? Is this something particular to my server config?
-
Thanks! That sounds good and is what I was hoping for ?. I wasn't sure if there are any limits when it comes to the API features if I skip the module and just create a class.
BTW … what do you mean by installability? Just being able to install something isn't worth anything on its own, is it? Do I miss something here?
- 1
-
I need some extra functions to work with user's data, implement PayPal and Stripe and some other.
Now I am wondering if there is any benefit using PW modules instead of just using a plain class and extending WireData? I do not need configurable modules and definitely not reuse them on another site … but perhaps later I need to hook into some methods. What do you think? Module or a simple class?
-
Thanks! Helped and solved the problem
-
Hi all
I am using PW Markup Regions and perhaps have a problem related to that. The $_POST data exists double.
When I put in /site/templates/_init.php at the top: var_dump($_POST); it prints out as
array(0) { } array(0) { }
Here is how my template/layout file looks like (removed everything non relating):
<?php namespace ProcessWire; // board.php layout file // This is a layout file to render a specific page layout with given partial (content block) ?><!doctype html> <html class="no-js" lang="de"> <head> <meta charset="utf-8" /> </head> <body> <div class="project-title" data-pw-id="project-title"> <?php if ($page->template == 'board' || $page->template == 'group'): ?> <?= $board->get('title') ?> <?php else: ?> <?= $page->get('title') ?> <?php endif; ?> </div> <div class="board-control" data-pw-id="board-control">BOARD CONTROL</div> <div class="board-content" data-pw-id="board-content">BOARD CONTENT</div> </body> </html>
When I remove all code there is just one $_POST left. Very strange: when I remove one or all of those three data-pw-id DIVs I get
array(0) { } array(0) { }array(0) { }array(0) { }
I have no idea why.
-
Oh cool, this look quite different to what I had before ?
I am using 3.0.98. I just copied the module and seems to work fine. Thanks for that!
-
At the moment I just hacked inside the module directly to change from user name to useremail. There is useremail input field (in PHP comments) what I am using. Works fine, email was sent. However, I need to move this module to my sites directory, so it won't be overwritten the next update. Perhaps I can code something and PR to Ryan to update the module
-
I am currently looking at the module's code and realised the same. I configured the Login/Register module to use an email rather than a username to login.
It seems this function is not compatible to the forgot password module.
Is it possible to copy the module from wire/modules to site/modules and edit the module's code? I would add a reset by email before coding a new, own reset function,.
-
Thanks, I put in a hook.
-
I am using the Login/Register module and have enabled the forgot password feature and the ProcessForgotPassword module is installed as well.
When I enter an email to reset the password, no email is sent. I noticed there is a 'process_forgot_password' table in the DB … with no rows.
Other emails are working well, just the forgot email is not working.
-
I want a field to be required only if the page is published. I tried published=1 published=true and status=published but seems to be not working like that. Any way I can bind the 'required if' on the page status?
-
Well, that makes sense ?
I thought there is something wrong, but if that’s right it is ok
thanks
Sort by children's create date
in General Support
Posted
Hi OLSA, thanks for your code. On the second look, I think this can work for me. But this one focuses on the posts again, not the groups.
I think I found a fairly simple approach, but haven't tested thoroughly
I am just adding a new property 'latest' with the timestamp and can sort my groups by this new property later where I output my groups.