Jump to content

flydev

Members
  • Posts

    1,364
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. To try it, you can just create a dummy page with page's name `hello` and paste the whole code in `ready.php` ?
  2. @Roych How did you changed the settings ? By hands or using the date picker ? Anyway, you can check if a weird date got saved in the module tables in the database. Open your database tool like `PHPMyAdmin` and check the following two tables : field_user_login_enabled_from field_user_login_enabled_until The values should be something like : 2022-08-23 00:00:00
  3. Check and try the following, I think the link provided all the infos. /// get and mod inputfield submit $wire->addHookBefore('InputfieldSubmit::render', function($event) { /// get page being edited from from query string $id = (int) $this->input->get->id; // ⚠️ sanitize it, do not trust your xss ninja admins $page = $this->pages->get($id); /// i.e. exit if page name is not 'hello' if($page->name !== 'hello') return; /// get the object the event occurred on $submit = $event->object; /// make sure to target the `submit save` button (it could be more than one button) $name = $submit->attr('name'); if($name !== 'submit_save') return; /// change the button's label (attribute: value) $submit->attr("value", "Foobar"); }); /// mod the inputfield submit dropdown $wire->addHookAfter('ProcessPageEdit::getSubmitActions', function($event) { $actions = $event->return; // array actions /// get page being edited from event's object $page = $event->object->getPage(); /// i.e. exit if page name is not 'hello' if($page->name !== 'hello') return; $actions['to_the_moon'] = [ 'value' => 'to_the_moon', 'icon' => 'moon-o', 'label' => '%s + Go Moon ?', // Save + Go Moon 'class' => '', ]; $event->return = $actions; }); /// process the new action dropdown $wire->addHookAfter('ProcessPageEdit::processSubmitAction', function($event) { $action = $event->arguments(0); // action name, i.e. 'cache' if($action === 'to_the_moon') { $event->message("Your page was rocketed to the moon ??", "nogroup"); } }); /// remove all the dropdown action but keep our new one $wire->addHookAfter('ProcessPageEdit::getSubmitActions', function($event) { $actions = $event->return; // array of actions, indexed by name /* bd($actions) ? 'exit' => array 'view' => array 'add' => array 'next' => array */ /// remove all action, let just keep our `to the moon` action foreach($actions as $action) { $name = $action['value']; if($name === 'to_the_moon') continue; unset($actions[$name]); } $event->return = $actions; }); /// bonus - add a second button on the current edit page $this->addHook('ProcessPageEdit::buildForm', function($event) { /// get page being edited from from query string $id = (int) $this->input->get->id; // ⚠️ sanitize it, do not trust your xss ninja admins $page = $this->pages->get($id); /// i.e. exit if page name is not 'hello' if($page->name !== 'hello') return; /// quite self explanatory $href = $this->config->urls->admin."page/edit/?id=$id&to=the_moon"; $field = $this->modules->get('InputfieldButton'); $field->attr('id+name', 'input_moon'); $field->attr('class', $field->class); $field->attr('value', 'To the moon ?'); $field->attr('href', $href); $event->return = $event->return->append($field); });
  4. Ok, then if you got redirected, it's a good thing. If you code the url, even hardcoded, you should be redirected to the checkout, but not in the admin.
  5. Just an idea as I dont have module v2. Maybe Kongondo will have a better solution. You can try adding the hx-redirect header to the request and htmx will redirect to the value of the header, eg, with custom markup: <div hx-post="{$config->urls->root}padloper/add/" hx-headers='{"hx-redirect": "{$config->urls->root}pad/checkout/"}'>Add to Cart</div> More infos: https://docs.kongondo.com/start/customise-markup.html#padloper-partial-templates-snippets https://htmx.org/attributes/hx-headers/ https://htmx.org/docs/#response-headers
  6. I have a better feeling with Go language and the features / compliance of Fathom is for sure better for professionnal (yeah well that's their job), see here, less headhash once you are ready to pay and let them manage the cons. Thanks for sharing pwired.
  7. I was looking for a self-hosted analytics solution as GA is declared illegal by the CNIL in France. Looking again the module FathomAnalytics made by @Craig, I jumped on Fathom website to compare the lite and full version, quite interesting, but damn things can turn rudes... https://usefathom.com/blog/illegal-analytics https://usefathom.com/blog/6monthsjail https://isgoogleanalyticsillegal.com/
  8. Then reason is the following: As you are declaring $this->var in the init() method, then you are declaring it in the earliest possible point of Wireframe execution, and only available after the instanciation (keep in mind that init() is called multiple times.), and then, the controller object set the $var in the $view scope which is a property of the controller, that's why the variable is available on $this->view object. A contrario, if you was declaring the variable as an object property (like @Pixrael just suggested) then the $this->var would have been available in your test's object scope, as the variable was declared as (Test) object property. Hope you get it. And guys correct me if I am wrong, thanks.
  9. Edit: Oh okay, WireFrame ? --- You should share the code of the class, meanwhile, you can try/compare with this : <? namespace ProcessWire; class Test extends Wire { public $foo1; public function foo2() { return $this->pages->get('/')->children; } public function run() { bd($this->foo1, 'foo1'); // null bd($this->foo2(), 'foo2()'); // set of pages bd($this->foo1 == $this->foo2(), 'comp 1'); // false $this->foo1 = $this->foo2(); bd($this->foo1, 'foo1 assigned'); // set of pages bd($this->foo1 == $this->foo2(), 'comp 2'); // true } } $test = new Test(); $test->run();
  10. You deserve it ! Thanks @Pixraeland @elabx ?✅ @ryan ???
  11. @bernhard I am getting back to you about this. I had the code not working when I tried it before releasing it, and finally the reason is that before this post, I given a try to get the SSR feature working with Svelte and Inertia. Still no luck, it's not really an issue, but we are screwed at this moment if the app require SEO, but again, I am just speaking about >Svelte<. Nevertheless, SSR works if you like Vue or React, or only JS. Another thing, if some people are also interested, I could share a CI/CD WIP setup for ProcessWire, started after the thread made by @wbmnfktr and the comment of @lokomotivan . Actually fully based on gitpod opensource doc site, taken to build this setup, where a contrario, SSR feature is working for Svelte.
  12. Yes, I used the "hidden field" feature of the forum to avoid a wall of text here in the thread. As you saw later, you can add more fields by following my comments, just a small note about the last portion of code (the input html markup), she is called in "Heredoc" and you can write inside it HTML code as you are used to and call basic PHP variable from there. If you encounter some issue, just think about the PHP version you are using and check the doc, as there is some subtilities since php 7.3; That's it, have fun ? When you say you prefer raw code over module, I think you are confusing a bit things. Modules are "raw code", for example, I think like other devs, I always end up writing my code in a module, then call a single method from the module to render the "module's context", which let focusing on the code of the template and not the logic behind, without speaking maintainability and dozens of other reasons. Be ready to receive more "RTFM ?" answer in the future ?
  13. @wishbone I fully understand you as non coder as we all try to build things for non-coders, but you also already know that non-coders have also to do a minimum; It wasn't my intention to feel rude (please grab this beer ? ? ) , I was trying to find again a way to say that reading the doc is what could help here. I mean the FormBuilder one, or the tutorial I linked on my previous post. Anyway, back to to your issue. I read the old code you linked, and there is the full code. It works, and if you follow (read again ?) the whole thread lol, you will find the solution for the honeypot technique (page #2 I think posted by @kongondo). About security concerns, there is no breach in the code and can be used as is. But again, without reading the doc, you will eventually get security issues only when you will add more input to the form. I mean here, the $sanitizing technique which give you "control" on the submitted user data. Again, sorry to insist, the FormBuilder module is what you need as non-coder, as I think it doesn't require code to be written, or maybe one line to render the form (I can't confirm, I have to read the doc lol ? ) and give you all the security you will need to stay safe. Code: Try something with the form, and do not hesitate to ask further help here ? Please, believe me, I am speaking by experience, we, coders, are lazy as f***, you can't imagine how ? Edit: Sorry, I didn't paid attention to your third message, you could head to the Job forum to get more attention.
  14. You also should look at what are saying logs => mysql.err log, errors/exceptions.log (pw), webserver errors log. You should be able to find the reason somewhere for sure. I bet that you cannot add or modify an user due a db issue related to the error you already shown (DATETIME), quite confirmed by looking at the screenshot. If you want me to take a look at your setup, just send me an ssh access by private message, or upload a db backup that I can test.
  15. Did you tried purgecss-webpack-plugin ? Steps to try: yarn add purgecss-webpack-plugin add the plugin to the webpack config const PurgecssPlugin = require('purgecss-webpack-plugin'); [...] .webpackConfig({ plugins: [ new PurgecssPlugin({ paths: glob.sync([ path.join(__dirname, './path/to/**/*.php'), path.join(__dirname, './path/to/**/*.js') ]), whitelistPatterns: [/^animation|cke|v-|active/] }), ] })
  16. Did you upgraded the database server recently ? This could explain your DATETIME issue make a backup of everything (files and database), upgrade ProcessWire to the latest version and try again. ⚠️ ? Do not forget to replace the .htaccess which require an update as you are running a Processwire version < 3.0.135
  17. Yes I will do it for the weekend. About ProcessWireMix, it's a custom Vite plugin to handle the build and generate the new "loader", which is then used to make the app view. I put a sample code of the the generated loader, but you will understand better with the example ? <?php // automatically generated at 2022-05-26T17:33:52.671Z by: yarn dev namespace ProcessWire; class ProcessWireMixAssets { const version = '2022-05-26T17:33:52.671Z'; const files = [ "additional_assets" => "assets/dark-theme.css", ]; } function mix($file) { return (isset(ProcessWireMixAssets::files[$file]) ? ProcessWireMixAssets::files[$file] : $file); } function mixVersion() { return ProcessWireMixAssets::version; } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <link rel="icon" href="<?= $favicon ?>" /> <title><?= $page->title ?></title> <?php if ($vite->isEnabled()) : ?> <script type="module" src="<?= $webappUrl ?>@vite/client"></script> <?php else : foreach ($vite->getCssAssets('src/js/app.ts') as $path) : echo `<link rel="stylesheet" href="{$path}">`; endforeach; endif; ?> <script src="<?= $vite->getAsset("src/js/app.ts") ?>" type="module"></script> </head> <body> <?php /// Inertia echo $inertia->tag; ?> </body> </html>
  18. Just to add my two cents to this thread. Generally in Webpack (should be avoided), or now Vite, you wil want to write your own config for the HMR (Hot Module Replacement). Eg, add 127.0.0.1 to $config->httpHosts and then to configure Vite HMR: plugins: [svelte(), ProcessWireMix()], server: { hmr: { protocol: "ws", // wss, http, https host: "127.0.0.1", }, },
  19. Yes just saw the screenshots. Did you upgraded the MySql engine or ProcessWire ? Can you give us the version of mySql and PW please ?
  20. Here again ? I canceled a sponsor and I would like to send theses dollars to @adrian TracyDebugger project. I am again asking for Github Sponsoring Program for two reasons. The first is already said in the quoted message, and the second - take it more as an argument - I could make my boss to click and subscribe for a more important monthly donation than my monthly $15 per project. @adrian @ryan @Robin S
  21. An idea just in case. If you are using a password manager, disable it and try again to save infos.
  22. By definition, a form isn't "simple" as it's not composed by a simple input that we could copy paste 13 times. A simple form is simple when you have someone have already done all the hard work. Technically speaking, even if the form has 1 field, or 13, you still need to follow some simple rules to handle the form or your future website will get hacked; And not because of the ProcessWire fault. All that to finally say, that the solution shown above are effective, and just require you to read the documentation to follow the implemenation that the author had in mind. Because they are smart and talented, they tackled the same problem you encounter and made their modules simple to use. You can also find some guides in the tutorials section of this forum, but I suggest you to buy without brainstorming the pro module made by Ryan if you are looking for a click / copy / paste solution. About the 12 years old code (which should works without hassle lol thats crazzy every time ?) you will find a lot of other working samples code to copy pasta, I still suggest you to read and understand what you are doing ? ?
  23. Did you try without SnipWire ? Without it, I confirm that the four strings are translatable (on pw-3.0.193).
  24. This is because Duplicator, as ProcessWire module, rely on ProcessWire code and thus, the PHP interpreter. Then after saying that, you will remember that in PHP you have basically four (4) errors - notice, warning, parse and fatal error, and you will also remember that a notice give you a hint generally for an undefined variable but do not stop the code, the second tell you that you will end up scratching your head in the future but again do not stop the code. The third tell you that PHP can't parse the code and logically stop the code, as well as the last - the same as you got in - clearly say that the error is fatal and stop the code. At this point, your whole app is broken. If we were using an external tool to make the package/backup, we would not encounter any error. This is the main answer of your question. Hope it help ??
  25. Mmh from what I read, the issue doesn't appear to come from Duplicator but from an issue in /site/templates/_main.php line 79 on the call of displayAds which doesn't exist in Duplicator.
×
×
  • Create New...