-
Posts
158 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Karl_T
-
Thanks for this wonderful module. When SVG is used in image field, the download button is not appearing. I hope it can be there.
-
Sorry this is my own fault. The issue arouse because I have written a hook to 'login', editing some pages that do not exist in new account.
-
register ajax code $email = $sanitizer->email($input->post->email); if($email){ $emailUser = $users->get("email=$email"); if (!$emailUser->id) { $password = $input->post->password; if (strlen($_POST["password"]) < 8) { return "length"; } $firstname = $sanitizer->text($input->post->firstname); $lastname = $sanitizer->text($input->post->lastname); $u = new User(); $u->name = $firstname.$lastname.uniqid(); $u->email = $email; $u->pass = $input->post->password; $u->firstName = $firstname; $u->lastName = $lastname; if($u->save()){ return "success"; } } else { return "duplicate"; } }else{ return "invalidemail"; } login ajax code $email = $sanitizer->email($input->post->email); if($email){ $emailUser = $users->get("email=$email"); //user login with email address if ($emailUser->id) { $u = $session->login($emailUser->name, $input->post->password); if ($u) { $user = $u; return "success"; } else { return "fail"; } } else { return "fail"; } } After users register an account and login with the above code, I get the follow error when executing the login ajax code. Notice: Trying to get property of non-object in /var/app/current/wire/core/PagesEditor.php on line 251 Notice: Trying to get property of non-object in /var/app/current/wire/core/PagesEditor.php on line 254 Notice: Trying to get property of non-object in /var/app/current/wire/core/PagesEditor.php on line 263 Notice: Trying to get property of non-object in /var/app/current/site/assets/cache/FileCompiler/site/modules/ProcessSetupPageName/ProcessSetupPageName.module on line 258 Notice: Trying to get property of non-object in /var/app/current/site/assets/cache/FileCompiler/site/modules/ProcessSetupPageName/ProcessSetupPageName.module on line 258 Notice: Trying to get property of non-object in /var/app/current/site/assets/cache/FileCompiler/site/modules/ProcessSetupPageName/ProcessSetupPageName.module on line 289 Fatal error: Uncaught Error: Call to a member function numChildren() on null in /var/app/current/wire/core/PagesEditor.php:270 Stack trace: #0 /var/app/current/wire/core/Pages.php(788): ProcessWire\PagesEditor->setupNew(Object(ProcessWire\NullPage)) #1 /var/app/current/wire/core/Wire.php(383): ProcessWire\Pages->___setupNew(Object(ProcessWire\NullPage)) #2 /var/app/current/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___setupNew', Array) #3 /var/app/current/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'setupNew', Array) #4 /var/app/current/wire/core/PagesEditor.php(465): ProcessWire\Wire->__call('setupNew', Array) #5 /var/app/current/wire/core/Pages.php(410): ProcessWire\PagesEditor->save(Object(ProcessWire\NullPage), Array) #6 /var/app/current/wire/core/Wire.php(386): ProcessWire\Pages->___save(Object(ProcessWire\NullPage), Array) #7 /var/app/current/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___save', Array) #8 /var/app/current/wire/core/Wire.php(4 in /var/app/current/wire/core/PagesEditor.php on line 270 Error: Uncaught Error: Call to a member function numChildren() on null in /var/app/current/wire/core/PagesEditor.php:270 I have no idea why this is happening. The account is newly created from the register code with no error. After the error show, the account is actually logged in after a page reload. That means the $session->login is getting the correct arguments. The error messages do not show the exact line of code which fires the error. I use the same login to log in my superuser without error. The error occurs only when the user is newly created by the above code or by the admin panel. I can only find this similar case https://processwire.com/talk/topic/15204-cannot-login-errors-wirecorepageseditorphp/, but it seems not the same case. Any thoughts? Thanks in advance.
-
I have made a pull request. You may take the changes for use before the module update. Code changes to support ListerPro
-
Thanks @arjen again for the reference links. If I could fix this I would post the fix here. This module is best suit for my new project but it just lacks the ListerPro support.
-
Thank you @arjen. I tried all the hooks that Ryan mentioned in the post and some others but unfortunately no one seems to be working. I have checked ProcessChangelog to see what hook it uses to fix the issue as I also have used it for other projects. It works along with ListerPro after update and what it use is the saveFieldReady hook but just cannot simply apply the same change to this module.
-
Thanks for this great module. I would like to use it along with ListerPro but no luck as @arjen mentioned. Before the release of update, I have tried to fixed this by adding $this->pages->addHookAfter('saveFieldReady', $this, 'hookUpdateLog'); but it is not working. How can it be fixed? thanks
-
Session lock is added finally. I also make a pull request to netcarver's SessionHandlerRedis. Once it is done I will close this one and move to that one probably. FYI: phpredis is undergoing a pull request to add their session lock.
-
File upload error - SQLSTATE[23000]: Integrity constraint violation
Karl_T replied to Karl_T's topic in General Support
Sorry for your time. This is the lack of session lock issue inside my own Redis module. I have to find time to fix that. Reference: https://github.com/processwire/processwire-issues/issues/132 -
File upload error - SQLSTATE[23000]: Integrity constraint violation
Karl_T replied to Karl_T's topic in General Support
Thanks for your reply. The issue seems to be the duplication of sort index. I think the sort index is generated and then handled by PW, isn't it? Would you mind telling me any other possibilities so that I can check on them? -
Every time I upload multiple images to any image fields at the same time, no matter I drag multiple or choose multiple images, most files randomly not uploaded. Most of the time only the first image is uploaded. The error message is SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2276-0' for key 'PRIMARY' INSERT INTO `field_images` (pages_id, sort, `data`, `description`, `modified`, `created`) VALUES(2276, 0, 'twitter-1.svg', '[\"\"]', '2017-05-28 13:04:54', '1970-01-01 08:00:10') So, it seem like this is because of the duplicated sort index. If I drag images into the field or choose the images one by one, there is no issue. That means when multiple files are uploaded, the sort index generated are the same most of the time. This most likely is PW side issue, but I tested this in a fresh installed PW without issues. This just happens in that particular server. I have updated PW to latest from 3.060 to 3.063dev. The issue still persists. Thanks.
-
Looks like it is a good place to extend for my need. Thanks a lot! Right now there are too much fields to choose from. This will make my customer nervous.
-
Greeting. I am looking for a way to have a user defined criteria on each page. It would be best to be a field inside the page editing, then maybe output a, or array of, selector string when call. Every page can have different criteria input by the user. The user interface would be something like the filter inside the Lister, with AND, OR for multiple criteria. The usage maybe like this: $criteria = $pages->get(1234)->criteria_field; // OR field become array of selector string $valid = false; foreach($crieria as $c){ $valid = $pages->find($c)->has($page); if($valid){ // do whatevery if the page fit the criteria break; } } Above is just my imagination. Is there anything close to this in PW at the moment? Or, is there any proper way to achieve this using PW native method? I want to have this to check: Page's parent(s'), own, children's template, name, field value etc Thanks.
-
Remove repeater item by page ID rather than item ID
Karl_T replied to Karl_T's topic in General Support
I used to use $pages->get($id) to get the page. I assumed they work the same as repeaters are pages behind the scene. My bad. Thanks @Robin S again! -
I want to use the following code to delete a repeater item, $item = $p->repeater->get(2011); //get the item by page ID $p->repeater->remove($item); $p->save(); but it fails. the get method is looking for repeater item ID started from 0. After some testing, the repeater item ID is just like any array key. If someone using that to track an item, wrong items could be deleted/edited due to the dynamic item ID. Also, it is quite weird that when I want to get the repeater item ID like foreach($repeater as $item){ return $item->id; } it returns the repeater page ID instead of the repeater item ID. It is actually how I get the repeater page ID lol. What I mean weird is that the get method above is not looking for page ID while when I ask for item ID from it, it returns page ID. So, I decided to use page ID again to move repeater item after all these trying. I am using the following code to remove repeater item. $item = wire("pages")->get(2011); $p->repeater->remove($item); $p->save(); It works. However, it seems like it is not the designed way, more like a workaround. Please advise if there is any native way. Thanks.
-
Issues of adding Page with Repeater field by API
Karl_T replied to Karl_T's topic in General Support
It did the trick! Thanks @Robin S! -
Hi @Hosted Power. Currently session lock is missing in the module. I am currently busy on my own project. I will make a pull request to netcarver's repo with the session lock implemented some time later, maybe a month later as I want to use this on my project too. I will post it here after that.
-
Greetings. I am trying to use API to add new page with a repeater field. I am following this link https://processwire.com/api/fieldtypes/repeaters/. Using the code similar as below. $p = new Page(); $p->parent = wire("pages")->get("template=something"); $p->template = 'some-template-name'; $p->name = 'some-name'; $r = $p->repeater->getNew(); $r->field1 = 'somthing'; $r->field2 = 'somthing'; $r->field3 = 'somthing'; $r->save(); $p->repeater->add($r); $p->save(); The page is added successfully, but, with 2 identical repeater item inside the repeater field. This is the first issue. And then I remove the second last line and become $p = new Page(); $p->parent = wire("pages")->get("template=something"); $p->template = 'some-template-name'; $p->name = 'some-name'; $r = $p->repeater->getNew(); $r->field1 = 'somthing'; $r->field2 = 'somthing'; $r->field3 = 'somthing'; $r->save(); $p->save(); The duplicated issue is gone. The second issue then comes. When adding new page using above code, a repeater page with same title is added under the path /cms/repeaters/for-field-280/for-page-0/, while the normal one is added under /cms/repeaters/for-field-280/for-page-2011/. The page /cms/repeaters/for-field-280/for-page-0/ cannot be deleted. And the children page under it just keeps growing when I add new page. I believe this is the cache remained because I deleted the line. I think I can just leave the page there, but I cannot. I don't want unwanted things appear and grow. Maybe I have missed something. I want a proper way to add page with repeater fields. Thanks!
-
You are right. I thought they are the same thing. Sorry for the misleading.
-
I was editing a field setting in the admin panel. This happens also when redirecting to the edit page after you create new inputfieldwrapper field.
-
Thanks for the module. I would like to report that It seems that this module is breaking the inputfieldwrapper field. When I edit the inputfieldwrapper field, it shows error as following. Error: Uncaught TypeError: Argument 2 passed to ProcessWire\InputfieldWrapper::insertAfter() must be an instance of ProcessWire\Inputfield, null given, called in /var/app/current/site/modules/CustomInputfieldDependencies/CustomInputfieldDependencies.module on line 136 and defined in /var/app/current/wire/core/InputfieldWrapper.php:296 Stack trace: #0 .../site/modules/CustomInputfieldDependencies/CustomInputfieldDependencies.module(136): ProcessWire\InputfieldWrapper->insertAfter(Object(ProcessWire\InputfieldTextarea), NULL) #1.../wire/core/WireHooks.php(782): CustomInputfieldDependencies->addFieldOptions(Object(ProcessWire\HookEvent)) #2 .../wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Field), 'getConfigInputf...', Array) #3 .../wire/modules/Process/ProcessField/ProcessField.module(943): ProcessWire\Wire->__call('getConfigInputf...', Array) #4 .../wire/core/Wi (line 296 of /var/app/current/wire/core/InputfieldWrapper.php)
-
Open page tree (ProcessPageList) branches by code
Karl_T replied to Karl_T's topic in General Support
Thanks! This just works, although this has a 0.5 second delay due to separate ajax call. -
I want to make some branches of a page list(tree) open onload. I am using Admin Custom Page module with the following code. <?php $p = $this->modules->get('ProcessPageList'); $p->set('id',1037); return $p->execute(); I changed the parent successfully from home to the wanted page, but the tree closed every time after reload. I added the following code before return $p->execute(): $this->wire('config')->js('ProcessPageList', array( 'openPageIDs' => array(1045,1046), )); The javascript shows error. Then I tried this: $this->wire('config')->js('ProcessPageList', array( 'openPageIDs' => 1045, )); The branch of the ID open with delay. I want to open multiple branches at the same time. Thanks.
-
This would be great. I would like to contribute.
-
@seddass Thanks for your great lesson. I have really learnt a lot! I lack the knowledge and sense to find out the potential threats. And, I should have made it clear about the existence of any open issues affecting the usage before using a library. I will dig deeper and try to resolve the issue. Your attached code would be a great help for this. I was using string as datatype originally. Hash is used because it is the only way I found that can let me to do calculation like finding recent active session using timestamp by ZADD. Thanks for poitning this out. I overlooked this one.