Jump to content

pwFoo

Members
  • Posts

    708
  • Joined

  • Last visited

Everything posted by pwFoo

  1. Updated 0.8.7 config email type html | text added to FrontendUserRegisterEmailValidation changed username sanitizer to pageName
  2. Have You also loaded the module inside your login template? echo $modules->get('ProcessForgotPassword')->execute(); I integrated it to my login module. https://bitbucket.org/pwFoo/frontenduser/src/d0b10941624547a773cd3d336f53c3c7a093e813/FrontendUser/FrontendUser.module?at=master#cl-341
  3. Hi Ryan, any plans in the near future with the notifications module? I plan to use it for simple (ajax) user notifications in the frontend. So I would build a process module and some JS code to use ajax user notifications based on SystemNotifications. $user->notifications Regards
  4. Hi Wanze, is it possible to add additional / custom css files instead of change the styles.css file? I know there is a global configuration, but is it possible in template context? Regards
  5. I read about the page-edit-created permission. Is there also a page-view-created (view own content) permission? Could be interesting to build a little new module, but I'll take a deeper look into PW permission system...
  6. Should be done with several hooks. For example hookAfter field username "processInput", get the user object by username and check the role. If role is missing, just set a error to the field and login will fail with a custom error message. Or take a look at this example. https://bitbucket.org/pwFoo/frontenduser/wiki/Login%20extensions%20and%20plugins Instead of change the login name to email address or nickname just get the user and check the role. Is the role missing, just replace the hooked method. The FrontendUser::auth method returns (===) "true" if login was successful. So just replace and set an error message, that is displayed next to the submit button. $event->replace = true; $event->return = "Login failed! Missing required user role!";
  7. Thanks, I will add it to FormHelper module for PW 2.6 compatibility.
  8. I try to group Fields / Inputfields by needed sanitizer, but how should I do it? I looked into the field objects (var_dump) and it looks like this won't work. I tested $field->class (InputfieldText has an empty class property?) and $field->type (InputfieldCKEditor is type text...?). At the moment I have to use "class" to identify an FieldtypeTextarea (sanitizer textarea) and InputfieldEmail should be easy. All other fields I would set sanitizer "text" as default (overwrite / remove by custom value...). Is there a consistent / simply way to group Inputfields by a proper sanitizer type? Should sanitizer "groups" text, textarea and email enough as a basic and automatic sanitizing?
  9. Version 0.8.3 fhValue() bug fix I found the bug during update the FrontentContentManager (FCM) module.
  10. I can't reproduce your problem here. Could you please post your template file?
  11. I get an empty form (with submit button and hidden token field) if the template not exists... There was a commit problem yesterday in the evening... Maybe it's not the latest version. Could you uninstall, remove and install it again to be sure it's the latest version / master commit?
  12. Your code should work. Tested it here and I get a form. Could you please activate debugging and check the apache log for errors? PW and PHP version?
  13. Version 0.8.2 Moved methods from FormHelperExtra to Formhelper because could be used without FormHelperExtra. jsConfig() and fhCkeditorImagePlugin() needed by InputfiedCKEditor load admin (backend) form styles
  14. Updated to version 0.8.1 Changed FormHelperExtra usage Added documentation at bitbucket repo wiki
  15. Sanitize field value is a FormHelper feature Set sanitizer to field as an additional attribute $emailField->fhSanitizer = 'email'; Get sanitized value after form processing / submitted $value = $fu->form->fhValue('emailField') Change sanitizer if needed... $value = $fu->form->fhValue('emailField', 'pageName') Or just do it without FormHelper inside a field processInput hook // hook after field processed (form need to be submitted) $myField->addHookAfter('processInput', function($event) { $currentField = $event->object; $value = $currentField->value; §sanitizedValue = wire('sanitizer')->pageName($value); // Do ... } You can take a look in each FU field (like username field for registration) to see some examples. Or at the wiki plugin examples (register, login). Set additional user field "nickname" based on username during registration (plugin). Just hook before "save", generate the value and set it to the userObj. "userObj" is a temp object of type User. All existing fields will be saved. $fu->addHookBefore('save', function($event) { $form = wire('fu')->form; if(!count($form->getErrors())) { wire('fu')->userObj->nickname = $form->fhValue('username', 'text'); } }); You need an additional field with user input? Add a field with sanitizer and a processing hook... Same as username field So you can use it as starting point $myField = $modules->get('InputfieldText'); $myField->label = $this->_('MyLabel'); $myField->attr('id+name', 'MyField'); //$myField->required = 1; $myField->fhSanitizer = 'text'; // Call hook after field is processed by PW form api $myField->addHookAfter('processInput', function($event) { $field = $event->object; // Value will be sanitized as text with "$sanitizer->text()" $mySanitizedCustomInput = wire('fu')->form->fhValue($field->name); // Do ... // Example: Add value to user during registration wire('fu')->userObj->myField = $mySanitizedCustomInput; // Need to set an field error? // $field->error('Custom field has an error...'); }); // Define the field before you call FU and add it as additional field... $fu->register(array('username', 'email', 'password', $myField)); If You need more examples or have a plugin idea just post it here.
  16. Module and sub module should work as is. "attr()" is removed during PHP 5.3 compatibility changes. Just use $fu->userObj or $fu->form inside the template. Inside a hook wire('fu') instead of $fu works with PHP 5.3+
  17. Add page works fine without images / files. TemplateFile: New page '/pw/gfh/my-page//' must be saved before files can be accessed from it<pre>#0 /volume1/web/pw/wire/core/PagefilesManager.php(253): PagefilesManager->___path() #1 /volume1/web/pw/wire/core/PagefilesManager.php(213): PagefilesManager->path() #2 /volume1/web/pw/wire/core/PagefilesManager.php(67): PagefilesManager->createPath() #3 /volume1/web/pw/wire/core/PagefilesManager.php(55): PagefilesManager->init(Object(Page)) #4 /volume1/web/pw/wire/core/Page.php(1781): PagefilesManager->__construct(Object(Page)) #5 /volume1/web/pw/wire/core/Pagefiles.php(74): Page->filesManager() #6 /volume1/web/pw/wire/core/Pagefiles.php(58): Pagefiles->setPage(Object(Page)) #7 /volume1/web/pw/wire/modules/Fieldtype/FieldtypeImage.module(33): Pagefiles->__construct(Object(Page)) #8 /volume1/web/pw/wire/core/Fieldtype.php(438): FieldtypeImage->getBlankValue(Object(Page), Object(Field)) #9 /volume1/web/pw/wire/core/Page.php(830): Fieldtype->getDefaultValue(Object(Page), Object(Field)) #10 /volume1/web/pw/wire/core/Page.php(693): Page->getFieldValue('image') #11 /volume1/web/pw/wire/modules/Fieldtype/FieldtypeFile.module(118): Page->get('image') #12 /volume1/web/pw/wire/core/Wire.php(387): FieldtypeFile->hookProcessInput(Object(HookEvent)) #13 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('processInput', Array) #14 /volume1/web/pw/wire/core/InputfieldWrapper.php(457): Wire->__call('processInput', Array) #15 /volume1/web/pw/wire/core/InputfieldWrapper.php(457): InputfieldImage->processInput(Object(WireInputData)) #16 /volume1/web/pw/wire/modules/Inputfield/InputfieldForm.module(76): InputfieldWrapper->___processInput(Object(WireInputData)) #17 [internal function]: InputfieldForm->___processInput(Object(WireInputData)) #18 /volume1/web/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array) #19 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('processInput', Array) #20 /volume1/web/pw/site/modules/Fredi/FrediProcess.module(109): Wire->__call('processInput', Array) #21 /volume1/web/pw/site/modules/Fredi/FrediProcess.module(109): InputfieldForm->processInput(Object(WireInputData)) #22 /volume1/web/pw/wire/core/ProcessController.php(213): FrediProcess->executeAdd() #23 [internal function]: ProcessController->___execute() #24 /volume1/web/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array) #25 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('execute', Array) #26 /volume1/web/pw/wire/core/admin.php(85): Wire->__call('execute', Array) #27 /volume1/web/pw/wire/core/admin.php(85): ProcessController->execute() #28 /volume1/web/pw/wire/modules/AdminTheme/AdminThemeDefault/controller.php(13): require('/volume1/web/pw...') #29 /volume1/web/pw/site/templates/admin.php(15): require('/volume1/web/pw...') #30 /volume1/web/pw/wire/core/TemplateFile.php(169): require('/volume1/web/pw...') #31 [internal function]: TemplateFile->___render() #32 /volume1/web/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array) #33 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('render', Array) #34 /volume1/web/pw/wire/modules/PageRender.module(356): Wire->__call('render', Array) #35 /volume1/web/pw/wire/modules/PageRender.module(356): TemplateFile->render() #36 [internal function]: PageRender->___renderPage(Object(HookEvent)) #37 /volume1/web/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array) #38 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('renderPage', Array) #39 /volume1/web/pw/wire/core/Wire.php(387): Wire->__call('renderPage', Array) #40 /volume1/web/pw/wire/core/Wire.php(387): PageRender->renderPage(Object(HookEvent)) #41 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('render', Array) #42 /volume1/web/pw/wire/modules/Process/ProcessPageView.module(172): Wire->__call('render', Array) #43 /volume1/web/pw/wire/modules/Process/ProcessPageView.module(172): Page->render() #44 [internal function]: ProcessPageView->___execute(true) #45 /volume1/web/pw/wire/core/Wire.php(365): call_user_func_array(Array, Array) #46 /volume1/web/pw/wire/core/Wire.php(320): Wire->runHooks('execute', Array) #47 /volume1/web/pw/index.php(240): Wire->__call('execute', Array) #48 /volume1/web/pw/index.php(240): ProcessPageView->execute(true) #49 {main}</pre> I know this problem and used a "storage page" to store files and move them after the page is saved / created. Users can modify the form with a simple url change. /admin/page/fredi-field-edit/add/?parent_id=1160&template=basic-page&[b]fields=title|body|image[/b]&modal=1 Is a sanitizer used to clean the user input?Maybe you could add an additional param array (field -> sanitizer)? If a sanitizer is given, it will be used to clean the input value.
  18. ProcessWire 2.5.19 dev Maybe I should test it with a new and clean PW install... Adding pages sounds good. Parent and template could be set as param by code or an default like current page. With hidden tabs frontend create pages will be comfortable for all users.
  19. Would be great to use Fredi ( or a second module) to create pages Hidden fields (for example template, page name), hidden tabs (children, sesstings) and a "one step" create form would be great. Don't know if that would be possible (in an easy way)? Bug with Fredi settings? After save the settings all checkboxes are unchecked again?
  20. Hi Antti, awesome improvements with the last updates!!! Easiest frontend edit solution with all features and a styled form (admin style). Any plans to add a create new page feature to Fredi?
  21. @Macrura, @Fester Right. You have to use an Inputfield instead of an "Field". Take a look at this topic how to use the PW form api. https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ After field is added you need a hook to handle the input value (sanitize, maybe additional processing and add to userObj). For example see usernameRegister() and passwordRegister().
  22. Released 0.7.2 removed FormHelper php 5.4 dependency (historical, have its seeds in an old version based on anonymous functions instead of PW hooks) FormHelper (0.1.1) php 5.3 compatibility update (thanks to Adrian and naldrocks98 for testing / help / feedback) But I have to install an php 5.3 test vm for compatibility testing soon...
  23. Thanks! I'll update this soon. I haven't a php 5.3 test env. So I'll post here after an updated version is available for testing.
  24. Last update should be php 5.3 compatible. I just removed empty() calls like that. //if (empty(wire('session')->get('registerStep'))) { if (!wire('session')->get('registerStep')) { //if (!empty(wire('session')->get('registerStep')) && wire('session')->get('registerEmail') !== $form->fhValue('email')) { if (wire('session')->get('registerStep') && wire('session')->get('registerEmail') !== $form->fhValue('email')) { No warnings or errors with php 5.5. Would be great if somebody could test the new version 0.8.6 with php 5.3. @naldrocks98 Thank You for your feedback! Could you explain which errors you mean? Error mesage?
×
×
  • Create New...