Jump to content

celfred

Members
  • Content Count

    152
  • Joined

  • Last visited

Everything posted by celfred

  1. @arjen : Thank you so much. This old thread gave me the explanation I needed. That's cool. For the moment, I did how @ryan suggested in the above-mentionned thread and it works just fine πŸ™‚ So again : thanks a lot !
  2. Oh, I've just re-re-re-re-read the API documentation, and maybe I've seen something : Does $session->set($key, $value) only work with strings for $value ? Maybe this is my issue trying to pass a PageArray ??? And then, how would you do that, then, passing a 'big' pageArray without having to do the DB request again ? I thought I could do it through $session ?
  3. Thanks for your concern @arjen. I appreciate your help. It doesn't do much except a $pages->find("template=player, team=$selectedTeam") according to the logged in user. But your comment made me think of another test. I simplified by wroting : $session->set('allPlayers', 'test'); But I get nothing on my ajaxContent.php page... $session->getAll() lists previously set variables only. So I kept trying things and went on delogging my user and trying to re-log and noticed it didn't work as expected any longer. So I switched to my dev branch and logging in functionality came back. So I started inspecting my code and here's what I noticed : If I put this in my head.inc : $session->set('allTeams', 'test'); Everything works as expected. No more issue anywhere. If i put this instead : $session->set('allTeams, $allTeams); $allTeams being a pageArray that the actual logged-in user receives from a $pages request (actually the different classes for the logged-in teacher), my logging-in system doesn't work any longer and I get my initial issue. Actually, I interpret this as an impossibility to update in any way my $session... So I'm slowly stepping forward, but I still don't understand anything about this behavior... You also mentionned : And I have no idea of what that means, sorry... If incognito screen is a 'guest' view, for the moment, I just want a specific role to have this functionality. I stay tuned for explanations πŸ™‚
  4. Hello, I'm facing a weird issue here. I have a page loaded with this code inside (my comments in line ends) : if ($session->allPlayers) { // Set in a head.inc file. I have also a $session->set('allTeams', $allTeams); in my head.inc $allPlayers = $session->allPlayers; } else { $allPlayers = getAllPlayers($user, false); $session->set('allPlayers', $allPlayers); } bd($session->getAll()); // HERE, I get a number of 11 variables which is what I expect In the same page, I have a link pointing to ajaxContent.php that loads stuff via Ajax. I just write this in my ajaxContent.php to test : bd($session->getAll()); // HERE, I get only 9 variables. All my newly set $session variables ($allTeams and $allPlayers) are not conveyed to ajaxContent.php ??? Would you have any idea why is that ??? Another thing : I have a $session->headMenu set in my head.inc, and this one works fine. I can retrieve it in my ajaxContent.php page. I've tried cleaning all caches but it doesn't change anything 😞 At first, I expected it to be a 15-minute update to my site... It turns out to be a 2-hour issue and I'm still stuck. Thanks for your ideas !
  5. Back here with... quite an amount of shame... I'm sorry I have taken time from you all. Here's the thing : my site/ready.php which I thought did not have access to bd() because I couldn't even see a simple bd('ok'); was not at the right place. A bell just rang in my head a few minutes ago after making a fresh re-install of a blank profile ! I came back to my original local site and thought : "No way, Fred ! site/ready.php NOT your-website-root/ready.php !!!!" I moved ready.php and.... tada ! (Of course...). What a nerd... So again, SORRY for having taken some of your time, but thanks for your helpful answers. I still have learned quite a lot from our exchange and that is the most important thing. I'm glad I posted in 'Getting started' ;)
  6. @Robin S : OK ! I'll test during the day. Actually, I think I did test in site/ready.php but I was wondering if bd() would work there and I imagined then that I had no simple way to see if everything worked (see my dev level !). Since I already had a couple of working hooks in templates/_init.php, I used it again here... So most of my last tests (disabling all modules for example) need to be re-tested in site/ready.php. I'll do this during the day and tell you how this is going. @adrian Oh ok; Then, I'll do that also from a blank-site profile. Thanks a lot !
  7. Indeed Tracy allows to easily disable modules. I did check them all and... no change... Regarding a fresh install, that sounds like a huge task to me : reinstall a new database, reinstall the different modules I use, re-import data... and how will I put that back to my remote site if it solves the issue ? I'm speechless πŸ™‚ I've just started looking at the 'Export Profile' and trying to follow the instructions on a new local installation. But it fails. I get many errors creating the database (pa.pages does not exist, pa.modules does not exist...) and it freezes. I guess my files are too large... And I'm wondering if that's the proper way to do things : I have a feeling doing an export on a new install will export the problem as well, no ? I tend to think I'll have to do all steps I've mentionned in my preceding paragraph one by one (can you confirm this is what I should do ?) but then that would take me a very long time... So I would tell you in a few days (or even weeks ?) I can't understand how I got into this situation 😞 Anyway, thanks a lot for your help and as I said, once you'd confirm I have to re-install things 1 by 1, I will get to it at my possible pace πŸ˜‰
  8. Thanks again, but nothing changes... So you know : I disabled FrontEndEdit module I cleaned all my files in the assets/cache/folder I updated on my local site to PW 3.0.123 And my Page::render hook is still ignored. I tried Page::loaded and this one works well (I get my 'inside' message). This is driving me crazy 😞
  9. Ouah... I'm again discovering things here πŸ™‚ @BitPoet I've tested your code and here's what I get (Now what it means is a little over my head...) :
  10. I'm viewing my homepage on localhost (the page can be seen there), but actually I went on many other pages to test, checked cache and so on... but no change... I was just thinking about this. But I'm afraid I won't be able to do that right now. I always get scared of such a major update in case I break things πŸ™‚ I prefer having more time ahead of me to do such an action. I'm not trusting my dev abilities ! So I stay tuned for ideas and I'll keep you updated when I update. But thanks a lot for your help @adrian.
  11. Ok. I have the same as you then in PageRender.module, but... hooking into PageRender::renderPage keeps me 'outside' 😞
  12. Ah... This TracyDebugger is indeed extraordinary πŸ™‚ There might be a clue here : my Page hooks are in lesser number than yours (no 'if', no 'links'). If I use Page::path, my 'inside' gets triggered, but as soon as I use Page::render, nothing happens 😞 And why is Page::render not listed our tables (only renderField or renderValue) ?
  13. Well... I have this in the preceding lines which seems to work ok : $wire->addHook('LazyCron::everyDay', null, 'checkActivity'); // Check all players activity $wire->addHook('LazyCron::everyDay', null, 'randomSpecial'); // Set random special monsters $wire->addHook('LazyCron::everyDay', null, 'emptyTmp'); // Empty /tmp subtree every night $wire->addHook('LazyCron::everyDay', null, 'cleanTest'); // Init test-team players Is there a basic hook other that Page::render which I could test with ? (I must admit I'm getting lost in all those hooks, hence my post in the 'Get started' forum πŸ™‚ ) For info, I'm with PW 3.0.62. Thanks for the help !
  14. Hello, I am getting nuts trying to understand hooks and I hope someone in the community will be able to help. This is deiving me crazy ! I have tested tens of possibilities to eventually reduce my code to this : bd('outside'); $wire->addHookAfter('Page::render', function($event) { bd('inside'); }); And if someone could tell me why my bd('inside'); never triggers... I would be infinitely grateful ! EDIT : Forgot to say : this piece of code is in my _init.php included in my template (but I've also tried in my site/ready.php for no better results...)
  15. Thanks @OLSA for this reply. This put me back on some tests I had done previously but didn't work, but I've managed thanks to you ! πŸ™‚ In fact, I had tested the hook you mentionned (for the 1st time, by reading about it in the 'Custom PHP cide' section in the template page) but I had put it in a _init.php file I include in all my templates, but I guess this was the wrong place for back-end templates. From what you've indicated, I put my code in admin.php and it works as expected πŸ™‚ So a big thanks to you ! For information in case someone reads this, here's my code : $wire->addHookAfter('InputfieldPage::getSelectablePages', function(HookEvent $e) { $user = wire('user'); $pages = wire('pages'); if($e->object->name == 'group') { if ($user->isSuperuser()) { $selector = "template=group, sort=title"; } else { $selector = "template=group, created_users_id=$user->id, sort=title"; } $e->return = $e->pages->find($selector); } }); Of course, I had to remove my selector string in the template page because it triggered an error otherwise by indicating that the saved page didn't match.
  16. Hello, I'm facing an issue trying to restrict access to a field so front-end edition is possible in an easy manner for the user. Let me explain : I have a field 'group' which is a Page list of group names. I want the user to be able to front-end edit a 'player' page in which this group field appears. I'd like the user to have a list of groups limited to his or her own groups (so he or she doesn't see all groups created by other users). In the back-end, I use this selector string : template=group, created_users_id=[user], sort=title This works great ! BUT here's my issue : If I back-end edit a 'player' page as 'Admin', the 'group' is empty (since admin is not the created-users-id and the group field is then empty... In other words, I must choose between all groups shown to all users (which may be scary for a user having only 2 or 3 groups whena list of 60 shows up) OR having a correct list for the front-end user, but empty for the back-end 'admin'. Can anyone think of another way I could get the expected result ? I have a feeling the simplest way would be to have a "Ignore for superusers" checkbox next to the 'selector string'. Thanks !
  17. @jmartsch Thanks a lot for your help ! It works now ! But one thing worth mentionning : I was on a 'Page List Select' and it wasn't working, until I found out I had to use the 'Select' type of field πŸ™‚
  18. Hello, I'm struggling with this : a 'group' field of 'Page' type. The parent of selectable pages is '/groups', the template is 'group', and a member can create some groups in the /groups tree. I would like this user to see only the groups he or she has created so in my 'Find selector' in the backend, I would like to use : template=group, created_users_id=$user->id But that doesn't seem to work... I still get the list of all available groups in the /groups tree. Any idea ? I had a feeling I had already seen that before (something like $user->id must be replaced by users_id or something, but I can't find anything in the Forums... and all my tests keep failing...
  19. Perfect ! It works ! Thanks a lot !
  20. @adrian I was indeed about to tell you I'm updating from... 3.6.9 ! I managed to get back the old version from my remote site). So far, I've tried what you said : Starting with a 'regular' update trhough the module page, clicking on update. It detects the 4?15.4 version. It downloads and then still triggers the same error. Then, I went to check the cookies. I couldn't find the TracyPanelSticky you mentionned, but trying to erase all Tracy cookies (and eventually deleting all my localhost cookies), and also deleting the TracyDebugger folder in my modules folder, and deleting the TracyDebugger folder in my assets/cache/Filecompiler/site/modules... still the same result 😞 In short, I have deleted all traces I could find of TracyDebugger and tried re-installing 4.15.4 but the error persists. You were perfectly right about the 'sticky panel' : I remember I had the var-dump panel sticky before updating. Thanks a lot for your help.
  21. @adrian : Well, I am upgrading through Setup > Modules > New and I type the className. Everything downloads and then I click 'Install now'. I've checked the path and no, the file doesn't exist. I've tried the Modules > Refresh and re-installed Tracydebugger : same problem. Here's the line mentionned that triggers the issue : File: .../modules/TracyDebugger/TracyDebugger.module.php:1341 Thanks for your quick reply. Edit : I've checked on Github in panels folder, and there is no TemplateEditorPanel.php file... I really don't get it...
  22. Hello to all, I've just tried updating the module and got an error. I then deleted it completely to start all over again (on my local site), and as soon as it is downloaded, even if I choose to leave it uninstalled, I still have the same fatal error (I must delete the TracyDebugger folder in my modules completely to be able to access my site). Here's the error : require_once(): Failed opening required '/home/celfred/PlanetAlert/site/modules/TracyDebugger/panels/TemplateEditorPanel.php' (include_path='.:/usr/share/php') And I'm sorry to say I have no idea what to do... So if one of you could give me a hint, that would be great. I was using TracyDebugger more and more (for minor debugging, I guess you can tell from my question) but I would like to use it more πŸ™‚
  23. Well that's a great answer ! Thanks a lot @Robin S I was completely unaware of the distinction and your explanation is perfect. I had to struggle with similar issues before and that's quite a step forward for me. Thanks ! I'm gonna take some time to think about all this and read over my code.
  24. Hello, I'm facing a weird behavior (to me)... Why are these requests not returning the same values ? // Test 01 : not working > returns empty $allPlayers = $pages->find("team=$team"); // Returns the 10 players (1 of them has HP=14, others have HP>15, no players have coma=1) $dangerPlayers = $allPlayers->find("(HP<=15), (coma=1)")->sort("coma, HP"); // Returns nothing ??? // Test 02 : Working as expected $dangerPlayers = $pages->find("parent.name=players, team=$team, (HP<=15), (coma=1)")->sort("coma, HP"); // Returns the low HP player If you can explain this to me, I would appreciate because this is causing me a headache right now πŸ™‚ Thanks !
  25. Thanks a lot for your quick help. But I'm not that good and I am running PW 3.0.62 both on local and production. I won't update right now because I'm not able to easily manage different version on local and remote... So I'll manage little by little and do the update later πŸ™‚ But thanks !
Γ—
Γ—
  • Create New...