Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Did you even look in de documentation? http://processwire.com/api/user-access/
  2. RT @mattgemmell: Tip: rename your hard drive “jihad plans” for free remote backups in the US and UK.

  3. Would be nice to know where they come from. There shouldn't be any. But if you use thumbnail module they don't get deleted when deleting image. Well you can't. You may loop all pages an image fields then get an array of all along with all variations. Then delete all images not in this array. Or just delete all except the original as the variations will get created again anyway at some point.
  4. Just created a simple TinyMCE plugin to work around a issue with TinyMCE and using div's (inserted via templates). I know (and many others) of this limitation since a long time, when using templates in TinyMCE and you have a single div you can't add content after it anymore as there's no element that can be focused. There's no real easy solution to this. As I'm also sometimes using (not often, but will in my current project) templates I just created a simple TinyMCE plugin to add a button where if you click it, it will add a paragraph at the end of the content. -> <p>Text ...</p> Here you go: https://github.com/somatonic/addcontent You can add this plugin to PW TinyMCE: create a new folder in /site/tinymce create new folder in /site/tinymce/plugins add this plugin folder into it. The folder should be called "addcontent" now in the PW admin in the TinyMCE configuration settings of your field you can add custom plugins via the text field "Third-party plugin" at the bottom. add this to the text on a new line: addcontent: /site/tinymce/plugins/addcontent add the button to one of the theme_advanced_buttons "...,addcontent" done You should now have a new button in your toolbar, click it to add a new paragraph to the end of the content. I couldn't think of a better name. "addcontent" maybe someone has an better name?
  5. I mean ugly in terms of rewriting all modules and code to use another lightbox plugin. They simply will be broken....
  6. Just created a little helper module http://processwire.com/talk/topic/4432-page-list-show-page-id/
  7. Page List Show Page IdModule prepends page ID in the page list tree labels. Only visible for superusers. https://github.com/somatonic/PageListShowPageId And soon on modules repository http://modules.processwire.com/modules/page-list-show-page-id/ You could also show the page ID or any other field using the template advanced setting for the page tree label. But maybe this is just easier as it doesn't matter what template/pages.
  8. The saving of the status[LangID] is now working with your fix for user, permissions, roles pages. But I'm having issue to solve the problem when saving/creating a new page in front-end on a alternative language. The user language set by language page names module is lost and reset to default after saving. I was getting strange errors when trying: Error: Exception: Unable to save to 'field_title' for page that doesn't exist in pages table (in /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Fieldtype.php line 506) #0 [internal function]: Fieldtype->___savePageField(Object(Page), Object(Field)) #1 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Wire.php(359): call_user_func_array(Array, Array) #2 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Wire.php(317): Wire->runHooks('savePageField', Array) #3 [internal function]: Wire->__call('savePageField', Array) #4 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Pages.php(718): FieldtypePageTitleLanguage->savePageField(Object(Page), Object(Field)) #5 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Pages.php(605): Pages->savePageFinish(Object(Page), true, Array) #6 [internal function]: Pages->___save(Object(Page)) #7 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/core/Wire.php(359): call_user_func_array(Array, Array) #8 /Applications/XAMPP/xamppfiles/htdocs/pw2-dev/wire/cor Which means the page has no id at some point in save routine. The fieldtype throws this error. A few hours later I found by outputting "page field" infos in various methods of the pages save process I tracked it down to being an issue with repeater field. As soon as I remove repeater it works! And the language is correct again after saving. Also it is a little strange what is happening, even after the hook saved() get's called the page isn't really saved yet, as the repeater also has pages that needs to get saved. So a hook on Pages::saved() is called multiple times. As soon after saving the repeater page(s) (FieldtypeRepeater::savePageField()) it calls the parent savePageField() again and there it somehow fails as suddenly the page id is zero! Looks like this: Pages::savePageFinish(): pid:2257 -> hide_de Fieldtype::savePageField() : pid:2257 -> field : hide_de Pages::savePageFinish(): pid:2257 -> state Fieldtype::savePageField() : pid:2257 -> field : state Pages::savePageFinish(): pid:2257 -> myrepeater FieldtypeRepeater::savePageField() : 2257 -> myrepeater Pages::savePageFinish(): pid:2258 -> title Fieldtype::savePageField() : pid:2258 -> field : title Pages::savePageFinish(): pid:2258 -> process Fieldtype::savePageField() : pid:2258 -> field : process Fieldtype::savePageField() : pid:2257 -> field : myrepeater Pages::savePageFinish(): pid:0 -> title Fieldtype::savePageField() : pid:0 -> field : title page : 0 (error) no page id!
  9. Or you can hover over the edit link to see id.
  10. Easy just thought this us a important fix. I'll look into it and test. Maybe I can work it out.
  11. Any news on this?
  12. Yeah also wanted to mention but thought not overkill the thread. You can use also use the new pw log functions. $log->save("mylog","test") // will save test to mylog.txt
  13. RT @processwire: New module: Soundcloud Embed by @marvinscharle – Transforms SoundCloud URLs into SoundCloud widgets – http://t.co/iwNDnkih…

  14. That's going to be ugly , because there's quite some modules using fancybox and I use it in several project for admin or modules.
  15. Yeah right. I actually found this after messing around with it. And I though ahh, but now looking again I remember what it was: In InputfieldPage #129 https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module#L130 if(in_array($field->inputfield, array('InputfieldPageListSelect', 'InputfieldPageListSelectMultiple'))) { So I can't create a new PageListSelect inputfield. It gives me error Page 1506 is not valid for select_image
  16. As I said, for the page fieldt Currently it's all hardcoded so I can't create a new inputfield for that field.
  17. Great addition! Thanks for your work here. While we are here, how about making the fieldtype page more dynamic for it's inputfields. I tried to add another inputfield type the other day and it's not possible without hacking the core fieldtype.
  18. If your PW install is in the root there's nothing to show.
  19. Ahh... the ProcessPageDelete module by Nico. Works fine here. Again, it depends on what you set the hook, this module does trash the page and not delete it.
  20. I'm not sure what's the issue you're talking about, nor if you want to or use admin to delete pages, as it will trash them and not delete them. So my example is just working for all hooks either trash or delete, just a question if you want the user page to be deleted if the page gets trashed or deleted. Looks ok, you could also use Pages::saved or Pages::saveReady (look at core/Pages.php to read the docs what they're doing), the problem seems more that you're doing a save() in your hook so it will trigger you save hook also. SO it will create user, save user, call save hook, update user. I'm wondering why you don't get a endless recursion (?) That's is simply to prevent recursion or in case the hook get's called multiple times. We could also avoid this differently, but it gets the job done. You could also write: if($page->thispageisalreadyudpated) return; // do nothing $page->thispageisalreadyupdated = true; edit: updated code
  21. Works fine here: $form = $modules->get("InputfieldForm"); $form->action = "./"; $f = $modules->get("InputfieldText"); $f->attr('name','phone'); $form->add($f); $f = $modules->get("InputfieldSubmit"); $form->add($f); if($input->post->submit){ $form->processInput($input->post); $input->whitelist('phone', $form->get("phone")->value); print_r(wireEncodeJSON(array('phone' => $input->whitelist('phone') ))); } echo $form->render(); Outputs: {"phone":"0888 1234"}
  22. In my quick test it works as it should. Maybe I don't understand. 088 1234 isnt a number but s string because of the space. $value = array('test' => '088 1234', 'empty' => ''); print_r(wireEncodeJSON($value)); Outputs {"test":"088 1234"}
  23. Looks cool, thanks for your work here. We got this discussion already to export and import template/fields and I think Ryan said we could build something with json or yaml. I'm not sure anyone else has started something but this could be a start. Just briefly looking at the code it looks good. I'm not sure I understand why you have functions inside a class method? I'm sure it works but seems odd. Also I'm not sure you are aware you can get template and fields with their settings with $field->getArray() $template->getArray() that will return an array with the properties. This might can be used to store them, though not sure it would be of help. wire("templates")->get("basic-page")->getArray(); Would give something like: Array ( [useRoles] => 1 [editRoles] => Array ( [0] => 1006 [1] => 1675 ) [addRoles] => Array ( [0] => 1006 [1] => 1675 ) [createRoles] => Array ( [0] => 1006 [1] => 1675 ) [childrenTemplatesID] => 0 [sortfield] => [noChildren] => [noParents] => [childTemplates] => Array ( ) [parentTemplates] => Array ( ) [allowPageNum] => 1 [allowChangeUser] => 0 [redirectLogin] => 0 [urlSegments] => 1 [https] => 0 [slashUrls] => 1 [altFilename] => [guestSearchable] => 0 [pageClass] => [pageLabelField] => [noGlobal] => 0 [noMove] => 0 [noTrash] => 0 [noSettings] => 0 [noChangeTemplate] => 0 [noUnpublish] => 0 [nameContentTab] => 0 [noCacheGetVars] => [noCachePostVars] => [useCacheForUsers] => 0 [cacheExpire] => 0 [cacheExpirePages] => Array ( ) [label] => [tags] => [roles] => Array ( [0] => 37 [1] => 1006 [2] => 1675 ) ) Also this is possible wire("templates")->get("basic-page")->fieldgroup->getArray(); wire("fields")->get("body")->getArray(); Not sure how about template context settings. Anyway it would be a lot more work if you want to cover all settings.
×
×
  • Create New...