-
Posts
349 -
Joined
-
Last visited
-
Days Won
4
Everything posted by da²
-
@fruid Use custom page classes. In site/classes: <?php namespace ProcessWire; class UserPage extends User { public function getMessages(): PageArray { return wire()->pages->find('template=message, receiver=' . $this->id); } } Be sure to enable it in site/config.php: $config->usePageClasses = true;
-
Just to add another solution to the original question, this is how I hide not editable pages in admin tree: $this->addHookAfter('Page::listable', isPageListable(...)); function isPageListable(HookEvent $event): void { if ($event->page->path == "/") $event->return = true; else $event->return = wire()->user->hasPermission("page-edit", $event->page); }
-
To add custom JavaScript validation for repeater items
da² replied to SIERRA's topic in General Support
Why using JS and not a saveReady hook? And maybe a hook on ProcessPageEdit::processInput(form:InputFieldWrapper) to check that fields content is valid and mark them as "error" in the form. You can also manage errors in saveReady by displaying an error Notice to user. -
Maybe you have "use" statements replacing the missing namespace? Or maybe there's something different in composer.json configuration?
-
And maybe Ryan is transpiling this CSS from SCSS, this is how I use UIKit.
-
I was just joking about how you wrote the "Hit CMD+Enter" like if the answer is sure, don't take my message too seriously. ? I wouldn't event trust the answer about rw-r--r--, because very often ChatGPT is absurdly wrong and answers the exact opposite of the truth. Then I correct it and next answer is good. So if I need to check the AI answers on the web, it's faster not to ask the AI and directly go on the web/documentation. Most of the time I use AI when I can't find answer with traditional ways. This part is more interesting IMO, discussing about architecture of your own code, things you can refactor, design patterns you can use... It can be a way to improve faster as a developer. I'm also working alone, and have worked in the past in a team that used to do regular code reviews.
-
You have a lot of confidence in AI. ? I would replace with: check that the AI gave the correct command (using web or manual), then press Enter. ^^
-
Hello, maybe a missing "namespace Processwire;" ?
-
@Roadwolf I had a look in InputfieldCKEditor.module source code, and found this is related with HTML purifier. You can disable this feature in your field configuration > Field tab > Use HTML purifier, but that may not be recommended in some cases (read the option description). I don't have time to investigate more but this is related to HTMLPurifier class and probably one of the classes it uses to purify HTML. So maybe you can use this information to investigate or report an issue.
-
OK I see, so to resume: you create a link in a CKEditor, put "irc://foobar" as link and after saving the page the link is removed, probably because CKEditor only allows http links. I don't know how to solve this yet, but now that the question is clear, someone else may help. ? You should edit this topic title to something like: "How to add irc:// link in CKEditor?".
-
@Roadwolf By "where" I mean: in which field? And what is the formatter used by this field? And could you show the text you enter and the text you get after saving the page?
-
Can I select children with only checked checkboxes?
da² replied to Paschalis's topic in General Support
Hello @Paschalis, $featuredProperties = $pages->find("parent_id=1016, featured_properties=1"); Note that it will return only direct children of the page 1016, if you want also grand-children it's: $featuredProperties = $pages->find("has_parent=1016, featured_properties=1"); -
Hello @protro , Why not using a video platform (YouTube, Vimeo...)? Serving videos has many constraints that are already solved by this platforms (disk space, bandwidth to serve a large number of simultaneous streams, encoding to several streams with different bitrates, choice of the best stream based on client downloading speed...). To facilitate things for your customer you can put the upload form on his web site and transfer the video in the background to the video platform using its proprietary API. Then integrate the platform embedding code to display video player.
-
On Linux, enabling rewrite mode is usually as easy as writing: sudo a2enmod rewrite sudo systemctl restart apache2 Last command may depend on your distribution. More info: https://stackoverflow.com/a/5758551 ("a2enmod" means "Apache 2 Enable Module") You also need to set the "AllowOverride all" directive for this site (or in apache2.conf if there's no dedicated config for this site), if not set yet.
-
solved Uncaugt TypeError while changing PHP from 7.4 to 8.2.7
da² replied to biber's topic in General Support
Hello, To explain (if I'm right): It looks like you are using a custom page HomePage that is correctly instantiated (so we are sure it extends ProcessWire Page class). But the parameter of type Page in the function "visit(Page $parent)" is not of the correct type for PHP, so it seems that it doesn't recognize the specified Page type. I bet this is because you didn't include any "namespace" or "use" instruction in your file. Try to add this: <?php namespace Processwire; If you are new to PHP you can try PHPStorm IDE for a month, it's a great help for setting up a project with composer and learning PHP. But this is hiding the problem, not solving it. ? -
Is debug allowed in config.php? (to see errors) Is MySQL user configured with right permissions in this database? (user specified in config.php)
-
Hi, Do you see something special in browser debugging tools, in network tab and JS console? Did you copy the site/config.php, to use the same salts? $config->userAuthSalt = 'xxx'; $config->tableSalt = 'yyy';
-
One important thing to add: when exporting your pages, don't forget to disable output formatting before to read properties on pages: $myPage->of(false); So you're reading data as it was entered in database, without applying formatter defined in admin on this field. And when importing data, an easy optimization is to use database transaction: try { wire()->database->beginTransaction(); // Import data (creating and updating pages) wire()->database->commit(); } catch (Exception|WireException $e) { wire()->database->rollBack(); } For 100 pages, you won't really need optimization.
-
Hello, I would use PW pages with a "practitioner" template. Data export won't be more complicated, you can use PW API for that. If it needs to be optimized you can use several options like $pages->findMany(), findJoin(), findRaw() or even use raw MySQL query. That way your practitioners are already editable from admin without effort. Also check custom page classes if you need to attach your own class to this practitioners pages. It depends on your actual knowledge on PW, PW has a good documentation, you can start by looking Pages and Page. First one is useful to find your practitioners pages, second one to access a single page or create a new one.
-
log in via Google to Google-account AND PW-user-account
da² replied to froot's topic in General Support
Hello, I'm not sure if you really need a module for that, it looks simple enough to implement: https://developers.google.com/identity/sign-in/web/sign-in Searching for an existing user or creating a new user is just a bit of code, so personally I would go without any module. -
need-guidance [Beginner] htacces not being read by apache
da² replied to Kitch's topic in General Support
Hello, Yes I think this is enough. Other way is to change it only for this web site, in your apache site configuration if you have created one (/etc/apache2/sites-available/). This is a good idea to do this yourself, I like it too, with a bit of practice and google searches you'll know how to configure a web environment by yourself, modifying apache config, enabling/disabling a site, setting up php, php-fpm, etc. This is also useful when setting up environments under Windows. ? But Ubuntu is useless on a server, it takes a lot of memory for nothing. Usually we only need Debian and a SSH console (or several consoles for multi-tasking), and this is often faster than using a desktop. ? -
Re-thinking ProcessWire Admin system (thought experiment)
da² replied to Jonathan Lahijani's topic in Dev Talk
Hello, Angular may be a possibility. But it would be a full admin replacement, not just modifying the existing. -
Hello, reading official site I see "AlmaLinux OS is an open-source, community-driven Linux operating system that fills the gap left by the discontinuation of the CentOS Linux stable release.", so if your are fine with CentOs you shouldn't have any problem. Linux distribution choice is not related with ProcessWire, as soon as you have a web server, a database and Php you can run PW.