-
Posts
1,523 -
Joined
-
Last visited
-
Days Won
16
Everything posted by Ivan Gretsky
-
Is there a way to define dynamic role on runtime based on user role? I have a number of similar roles named similarly (and they will be adding) for each of which I need to make a few dynamic roles. So I am looking for a way to make it DRY. Edit: I mean something like making a hook that generates a dynamic role via API.
-
Thanks. Your module does redirect the user where it is needed. Bit I still have the "Pages" menu visible. How can I get rid of it?
-
Exceeds max allowed file size error on live server
Ivan Gretsky replied to Ivan Gretsky's topic in General Support
1) I found the problem and the solution. Processwire cannot read post_max_size if it is defined in bytes (see here). It sets it to 5M in that case instead. Define your php_ini variables as 100g, 50m, 1200k, but not as 104857600. 2) And I have not been able to redefine the value due to little typo: it had to be $f->maxFilesize instead of $f->maxFileSize. -
Good day! I need to make custom admin interface for specific user role. I want them to only see those menus and menu items I selected. I do not want them to see "Pages". I plan to use custom Process modules under custom admin menu. But I do want to use PageEdit admin interface for editing pages. To make it possible, I have to set edit permission to the pages they are to edit. But that uncovers "Pages" menu for them. How can I achieve that, still using defaul or Reno admin theme? Or is it preferable to make my own?
-
If you are talking about moving content from one PW installation to another, you have several options, which are related: 1) Master Adrian's Migrator module. 2) Exporting and importing templates/fields with built-in functionality. 3) Creating a site profile. 4) DB backup + moving file data manually. But you should really just fix your errors, not run from them .
-
You can probably workaround by using subsequent selectors like this: $p1 = $pages->find('template=accommodationtype,availability.column=1194'); $p2 = $p1->find('availability.row=1889'); $p3 = $p2->find('availability.value=1'); A few more db queries... But if you are right it seems like an unwanted behaviour. I recommend making a github issue or even a PR.
-
Exceeds max allowed file size error on live server
Ivan Gretsky replied to Ivan Gretsky's topic in General Support
Sorry, Mr. Stevens, but i did not get it) What should I do? It seems like both eck upload_max_filesize and post_max_size are set to maximum values... Should I force one to be less than another? -
Exceeds max allowed file size error on live server
Ivan Gretsky replied to Ivan Gretsky's topic in General Support
Thank you, Horst! I did check upload_max_filesize and post_max_size. The are both equal to 1047527424. It is a custom module. I create InputfieldFile like this: $form = $this->wire( 'modules' )->get('InputfieldForm'); $f = $this->modules->get( 'InputfieldFile' ); $f->name = 'upload_file'; $f->label = $this->_( 'Upload File' ); $f->extensions = 'csv jpg db zip'; $f->maxFiles = 2; $f->maxFileSize = 0; $f->unzip = 0; $f->overwrite = false; $f->destinationPath = $path . '.....'; $form->add( $f ); When I echo $f->maxFileSize on localhost it is 104857600, but 5242880 (5MB) on live. Both numbers won't change no matter what i put after $f->maxFileSize =. Though I can easily change the maxFiles variable. It did work a while ago... What could happen? -
I got a process module with a file upload field, which used to work fine, but recently started to give me this massage "SomeFile.zip - Exceeds max allowed file size". On the localhost everything works. I did upgrade PW not so long ago. But it seems like it is a server problem. But what is it? What to check? Please help.
-
Released: PadLoper (commercial eCommerce platform for ProcessWire)
Ivan Gretsky replied to apeisa's topic in Modules/Plugins
Congratulations Antti and all the PW community! This is the first 3rd party script for PW I did buy. I like free open source better , but the presence of commercial activity around the product is surely the sign of it being successful. I think we all should benefit from products like Padloper being developed and made available to us. So maybe it is time to think about re-building modules directory, making it a full blown marketplace? -
Soma's module can do it right out of the box - see instructions here. And it is not hard to do it yourself with a has_parent selector (look here). Be more specific and we can help you better .
-
I actually do not know much about your need. I do not know wheather you are using ajax, how much differ the forms on different pages and so on... But for simple cases the best practice seems to be to submit a form to the same page. It is Option 3 in this Ryan's post. Check out this example. Another usefull resourse on the topic is this Soma's post. There are even a few modules to help - this is one free one, seems like Mike Rockett is working on another one. And of course don't forget that you can (and should) buy this one from Ryan.
-
...or create a template "engine", so engine.php will be your template file.
-
Is there a way to list all hooks attached to an event?
-
Page field does not save on $page->save()
Ivan Gretsky replied to Ivan Gretsky's topic in General Support
Sorry, it is I who is half asleep. I was trying to make my example abstract. I will change the code in my initial post. The problem is not in the typo. -
Good day! I am exhausted trying to get it working on my own so begging for help) I made a frontend form to edit a page. When the form is submitted, I get all the values for the fields from the input, get the required page in $_page variable and assign inputs to the fields. After that I perform $_page->save(). All simple fields get saved as they should. Dealing with page fields I remove all the pages in the array and add the new ones from the input like this: $_page->pagearray->removeAll(); foreach ($input->post->pagearray as $item) { $_page->pagearray->add($item); } In the case of $_page->save() id does not save. But if I do $_page->save('pagearray') it does. I think it is not the right thing. Probably I am doing something wrong, but I can't figure out what. Please be so kind to help! Edit: Corrected the code
-
I have been messing with some frontend editing for a while and do not think making custom backend for editors is worth the effort in most cases. The interface will most likely be inferior to the one present in admin. Especially with addons like ListerPro. I do think that "modifying the appearance and functionality of the PW interface" is the more easy, cheap and capable way to go. I can see lately there is a lot of useful modifications to PW, like abilities to rename and hide tabs, add new pages from menu, new permissions and so on, making this path easier. Dynamic Roles module is really usefull here (too bad it is not even in modules directory yet). Pro Drafts is on its way. I think maybe creating a custom admin theme with stripped out functionality could be an option. Though I do not know abouit it as I have not tried it. Tom Reno is the man to ask about it) But of course you can do a totally custom backend as complicated as you wish, but I would not do it for anything but submitting an article type of workflow.
-
I think you can write a hook that will work both in frontend and admin. But you have to get the $page like this: $page = $event->arguments[0]; It seems like $page = $event->object; returns the actual page, which is admin with ProcessPageEdit in admin. But the first value in arguments array is the page we want to get in both cases, at least for saveReady event.
-
application How to create an Exam application (hundreds of questions)
Ivan Gretsky replied to Sergio's topic in Dev Talk
I have made a similar site in joomla with a paid extension. I had to mess around a bit making it work together with a subscription and a CCK components. But if you do not need those, it is quite fast to get started and import quizes. Not sure if that it is a path you are ready to consider though, and surelly not a "proper" way for a PW or a Laravel skilled developer . I am sure it is quite possible to do it with PW, but it will demand some effort (as with Laravel). -
You could write a module (or just a hook somewhere like site/ready.php) that would fill a (hidden?) texarea field on page save for the desired templates. That field would probably show in pagetable without an error.
-
I do not see any accidental way this could happen. Maybe there is another ProcessPageView being finished? The only thing I could think of is a FormBuilder form in an iframe at the top of a page or something like that.
-
I got the same error after manual upgrade on a live server. But the error only appears on admin. I rolled back, but the problem persisted. Any help appreciated. Edit: After a relatively short period of time it started working again. So the 1st solution is to wait a bit )
-
I like the idea. I have been looking for proper way to version control PW sites recently, and have not ended with a clear decision for myself. Of course "it depends on a project". But we can come up with a tutorial helping make the choices. What to version in git I never tried initialising a git repo in templates folder, as Ryan suggested here. Custom modules and now site/ready.php should go to version control, as well as config.php. For me the choiсe is either to version the whole installation or only the /site folder. As I usually modify the .htaccess I am leaning to the former. The next thing is what to ignore. Some think you should ignore /wire, some think it is worth having it in the repo. If we could (I mean If I knew how to) install the needed version of PW core as a dependency via composer or include it in a similar way automatically after deployment / git checkout, it would be better to leave /wire off. But for simplicity it could be better not to exclude it as it is quite small. That definately should be excluded is some part of site/assets. If the site is a big one, excluding site/assets/files is a must. But for a small near to static it is probably worthless. You should probably ignore these almost every time not to mess with constantly changing data: site/assets/cache site/assets/sessions site/assets/logs I found no reason not to include all modules to the VCS. Deployment Speaking about deployment, I do not like the idea to deploy every time I commit (which seems to be the case if using git-hooks, if I am getting it right). There are other ways for deployment with git, but I an intrigued by doing it with something like this or this (both are capistrano-like deployment tools in php). Anyway, I do not seem to find a way to easily deploy database changes. Maybe in the case of semi-static sites it is possible to dump a database and restore in with git-hooks (or to include a sql dump from sites/assets/backup/database to the revision and manually restore it), but it probably will never work with subscription sites and rich-content sites managed by clients. The only way to keep track of changes made to the database via PW GUI (admin) I came up with is keeping a journal. I made a folder where I include subfolders related to git commits with JSON export files for fields, templates and forms, which should be imported. Pages are just described in .txt as I know of no way to export them to something like JSON. It would be awesome to have something like the things discussed here available not to do it manually. Hope it is somehow useful. I would be delighted to hear how others do it, as I am certainly only an amateur in all this stuff.