-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
This is actually ProcessWire territory and not a Blog one. . I'd suggest that you search and have a read in the forums and docs how ProcessWire implements access controls. As you've figured out, access in ProcessWire is controlled at two levels; the high level (when editing a 'role') and the low level (at the template level).. Also have a good read of the info in the 'role' edit screen. This 'homework' will help you beyond Blog...
-
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Toying with the idea of having 'non-page columns and rows mode'. In this mode, if you upload a csv file, the first row will be treated as column headers and first column as row headers/labels -
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
I must have been half-asleep when I answered this one. . Sorry for wasting your time with the GitHub issue. This already works (in fact, there is an example in README). See examples below. The last example answers your question. Here 'catalogue' is the name of the matrix field on the current page //find all values for one row $results = $page->catalogue->find("row=1024"); //find all values for one column $results = $page->catalogue->find("column=1035"); //finding by object; no need for $p->id for 'column' or 'row' $p = wire('pages')->get('template=basic-page, title=Sizes'); $results = $page->catalogue->find("column=$p, value>=67");//finding by object; no need for $p->id foreach ($results as $r) echo $r->value . '<br>'; //alternatively user toString() formatted output echo $results; //get a specific matrix value (single intersection) $result = $page->catalogue->get("column=1034, row=1020"); echo $result->value; Will update the docs with these examples. -
$process = $this->wire('process'); if($process && $process->className() == 'ProcessPageEdit') $page = $process->getPage();
-
Aah...wish you'd mentioned that xdebug issue . It's bitten somebody else here before. Anyway, you got there in the end. The comments field sql error can be safely ignored. I mentioned it to Ryan a while ago but he didn't seem to be able to replicate it. It has nothing to do with Blog per se, but the comments module which ships with PW... You rollback instructions (even with the disclaimer) seem quite dangerous and I wouldn't recommend any one to use them. You are using LIKE to search. That will match other things that are not 'blog' but 'sound' like blog...Instead, use the cleanup facility in Blog
-
@David and other experiencing this issue. I have not been able to replicate the issue. Please see my comment on the issue at Github. Could someone please provide responses to the questions I have detailed there? Thanks.
-
Saving form with data from AJAX (outputFormatting terror!)
kongondo replied to thomas's topic in General Support
Try setting output formatting off in the 2nd foreach as well as saving inside this loop: foreach($form as $f) { $prod->of(false); $prod->set($f->name, $f->value); $prod->save(); } -
Authors are not added via the authors' page. They are normal ProcessWire users with the role 'blog-author'. Try the following to cleanup blog manually: Copy all the code in BlogCleanup.php to one of your template files, at the very top. Save Find and replace 'private function' to 'public function' in the code you just copied Find public function cleanUpPages() and add the following lines to it, at the very top of the function. Save //Get the module config data $this->data = wire('modules')->getModuleConfigData(get_parent_class($this)); $this->blogStyle = $this->data['blogStyle'];//selected blog style (1-4) $this->commentsUse = $this->data['commentsUse'];//commenting feature on/off $this->templateFilesInstall = $this->data['templateFilesInstall']; Add the following code to your template file, somewhere after the last } of the BlogCleanup class you copied to this template file $bc = new BlogCleanup(); echo $bc->cleanUpPages(); Visit a page that uses the template file you added the BlogCleanup class to. Blog Cleanup will run but you will get lots of PHP notices. Just ignore them. You will also have to manually delete your template files (normally it would be done for you but that needs code alteration in our manual cleanup). Restore you template file to the state it was before you added the BlogCleanup class. Save You should be able to start afresh then. I am afraid I don't have any more time today to invest in this. Hope it works out.
-
That image tells me you haven't finished installing the Blog module. It is step-2 of the installation. I don't know how you got the Blog pages then since you seem not to have finished installing blog. There's is a button 'Run Install Wizard' on that screen that you need to press to fully install Blog (see image below). When done, you should see a screen like the one I posted earlier, i.e. the Blog Dashboard. You don't see the cleanup menu because you haven't finished installing Blog. What happens you click on the 'Run Install Wizard' button? If this is local install, then it is just easier to start over. If you wanna go that route, I'll guide you with the cleanup...
-
If you need an exercise in patience (or conversely, hair-pulling), try Firefox + Firebug
-
You can still uninstall it but it will leave behind all the pages, fields and templates it had installed before, which then won't allow you to re-install Blog. I don't know how comfortable you are with PHP and PW but you could copy the cleanup utility code to your template file and run it from there. I can show you how to do it but before that: Is this a dev install? i.e. not a production site. Is this on a local machine or on a remote server? I just can't figure out why you cannot see the cleanup Menu item. Did you alter the module code in any way? Can you confirm you are logged in as a superuser (the main admin person)? Can you show me a screenshot of what you see when you go to /yoursite /admin/blog/? admin here is whatever you called your PW admin, normally processwire. Have you tried updating the Blog modules (just overwritting the files) to see if cleanup menu item will appear?
-
Previous & Next navigation links in page editor?
kongondo replied to hellomoto's topic in API & Templates
There's also the Admin Save Actions module by @Nik: http://mods.pw/3W -
Interesting approach @blynx
-
I'm not aware of any clashes. What do you mean by the Blog Module? This is the Blog Module . You probably mean the Blog Profile by Ryan? I know it appears in the modules directory so that can be confusing. Let us know how it goes.
-
ProcessWire has a comments module that is part of the core. It was updated some time ago with an up/down vote system (as can be seen here in the comments at the bottom of the post). I am not sure, but I think this version is still part of the PW dev branch (which many of us use..so, you can use it once you've tested it)..
-
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
There was a typo in my explanation. Corrected that in case it confused you... -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
What caused this is what Martijn posted above and my attempt to expound on it. The 'identical' names made PHP assume your method was a constructor....etc...as stated above Happy coding! -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
What Martijn said. Just to expound...constructors are run before the other stuff. Since your notifyByRole declares that is accepts one argument/parameter called $event, PHP (now treating the method as a constructor due to the identical names with the class) looks for and doesn't get the variable $event. Either way, renaming your method resolves your problem. I've tested your code and it works fine.. Thanks Martijn -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
@FuturShoc, the code I posted above was an example to test the selector, not something you would use in your Hook method If you want the notification to be shown within the page save and only for supersusers, you could do something like this: public function notifyByRole2($event) { $page = $event->arguments[0]; if($this->user->hasRole('superuser')) $this->message("Hello World! You saved {$page->path}, {$page->parent->path}."); } Or if you wanted to notify those who don't have that role: public function notifyByRole2($event) { $page = $event->arguments[0]; if(!$this->user->hasRole('superuser')) $this->message("Hello World! You saved {$page->path}, {$page->parent->path}."); } -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
Your class name 'Notifybyrole' is clashing with the method named 'notifyByRole'. In PHP, function and class names are case-insensitive. So, PHP is getting confused because it considers them the same thing in your case. Try changing the method name to e.g. 'notifyByRolex' and the error goes away.... Edit: Having said that, I am not sure how you intend to notify users that a page has been saved. Are you referring to logged-in users? Or will you be sending them an email? That determines what sort of code you need in the hook method. And Btw, that was a 'Fatal error' not an 'internal server error'...The difference is important -
Not sure if this is what you are after but I think this new module can do that. https://processwire.com/talk/topic/10929-developer-centric-form-processor/
- 2 replies
-
- json
- inputfield
-
(and 2 more)
Tagged with:
-
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
It works just fine lads... $us = wire('users')->find('roles=editor'); echo count($us);//returns 2 foreach ($us as $u) { echo $u->name . '<br>'; } ...But haven't tested in the same context as FuturShoc (hooking).... What I don't get is the internal server error... @FuturShoc, if you can show us some code and the exact error you are getting.... -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
An internal server error: usually means, a problem with the server. Does ProcessWire throw an exception? -
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Currently no (unless there is some selectors I don't know about). It is something I have been thinking about, creating a method() to accomplish this. I think it would make this module even more powerful. It wouldn't be too complicated to implement, I think; Just a simple raw SQL PDO query. Implementation would be similar to a get and a find (for many). Edit: Silly me; half asleep probably. This already works. See next post I also think for the row and columns, one should be able to search not only by ID but by $page and title. E.g. find the price (value) of a product that is 'red' (title [row]) in colour and 'small' (title [column]) in size. Could you please file your query as a request in GitHub so that I don't forget? Thanks. I can't promise when I'll be able to get to it though, unfortunately.