Jump to content

Beluga

Members
  • Posts

    528
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Beluga

  1. I looked at all greppable features in the removal document and grepped through PW 2.6.9 and any modules I happened to have on my current project and the only results I got was: Assignment of new by reference =& found in: wire\core\FieldSelectorInfo.php wire\core\ImageSizer.php wire\core\Modules.php wire\core\Wire.php wire\modules\LanguageSupport\ProcessLanguage.module wire\modules\Markup\MarkupHTMLPurifier\htmlpurifier\HTMLPurifier.standalone.php wire\modules\Markup\MarkupHTMLPurifier\htmlpurifier\standalone\HTMLPurifier\ConfigSchema\ValidatorAtom.php wire\modules\Markup\MarkupHTMLPurifier\htmlpurifier\standalone\HTMLPurifier\Printer\HTMLDefinition.php wire\modules\Process\ProcessPageEditImageSelect\ProcessPageEditImageSelect.module wire\modules\Textformatter\TextformatterMarkdownExtra\markdown.php wire\modules\Textformatter\TextformatterSmartypants\smartypants.php A non-greppable removal that caught my attention is: Scoped calls of non-static methods from incompatible $this context
  2. I'm trying to add an extra field for my registration form: fullname. Still calling the registration with $fu->register(); I've changed the FrontendUser.module: // create registration form if (empty($fields)) { $fields = array('username', 'email', 'password', 'fullname'); } and added this: /** * Fullname form field * @return InputfieldText Fullname field */ protected function fullnameRegister() { $field = $this->modules->get('InputfieldText'); $field->label = $this->_('Koko nimesi'); $field->attr('id+name', 'fullname'); $field->required = 1; $field->fhSanitizer = 'text'; $field->addHookAfter('processInput', function($event) { $field = $event->object; $fullname = wire('fu')->form->fhValue($field->fullname); if (empty($fullname)) return; else { wire('fu')->userObj->fullname = $fullname; } }); return $field; The form field is added fine, but the input is not saved to the user's fullname field. Is there something I'm missing?
  3. http://blog.jquery.com/2015/07/13/jquery-3-0-and-jquery-compat-3-0-alpha-versions-released/ Please check your code for how you use the .show() and .hide() methods! I did a quick grep for a 2.6.9 site (has a dozen random modules) and the .js files listed below were using .show(). It might well be that some of them will break with jQuery 3.0. BatchChildEditor.js ProcessBatcher.js AdminThemeReno\scripts\main.js InputfieldFile.js InputfieldPageAutocomplete.js InputfieldSelector.js JqueryTableSorter\widgets.js JqueryWireTabs.js ProcessField.js ProcessModule.js ProcessPageAdd.js ProcessPageEditImageSelect.js ProcessPageEditLink.js ProcessPageList.js ProcessPageLister.js ProcessPageSearch.js ProcessTemplate.js SystemNotifications\Notifications.js templates-admin\scripts\inputfields.js templates-admin\scripts\main.js
  4. Beluga

    Forum Software

    That Google trend just tells you, when the large masses of non-geek people started using the web..
  5. Some self-hosted solutions: https://livehelperchat.com/ (turn down your volume so you won't be scared by the demo chat notification..) https://frug.github.io/AJAX-Chat/ The least amount of strain on your server is achieved by using websockets. The Blueimp one offers sockets, but you have to use Ruby. Livehelper offers sockets through node.js as far as I can tell. The thing is, you need to be able to control what ports your server listens, so you can't use it with shared hosting. Here's a tutorial, which uses the newish Ratchet PHP library: https://subinsb.com/php-websocket-advanced-chat I'm going to try this with a small community: https://pusher.com/tutorials/realtime_chat_widget With Pusher, I can use websockets with shared hosting. The free plan is enough for me (20 concurrent users, 100k messages per day). Edit: ok I got that Pusher thing to work.. populating chat name with the PW user's fullname Would be nice to store some message history, but don't have the energy to figure that out now.
  6. Why is output buffering used in the templates? I have output buffering enabled, but I get completely blank pages, if I visit register or social-login.
  7. Thanks! Setting autoload to true actually didn't work, but it is simply enough for me to put this in my register.php: $modules->get('EmailAdminNewUser'); Now I will get admin emails for users that have registered!
  8. I thought I'd post this example of a working solution of ukyo's module with FrontendUser. Thanks to ukyo & pwFoo for troubleshooting and everything. <?php if(!$user->isLoggedin()) { // load module $fu = $modules->get('FrontendUser'); $recaptcha = $modules->get('Recaptcha'); // prepare register form $fu->register(); $form = $fu->form; // process register / form submit $redirectDestination = $pages->get(1)->url; $form->addHookAfter('processInput', function() use($fu, $recaptcha, $input) { if(isset($input->post) && $input->post('fuRegisterForm') == 'fuRegisterForm') { $recaptchaverify = $recaptcha->verifyResponse($input->post('g-recaptcha-response')); if(!$recaptchaverify) { $fu->form->fhSubmitBtn->error('reCAPTCHA validation not ok!'); } } }); $fu->process($redirectDestination); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php echo $title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/mystyle.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/somestyle.css" /> </head> <body> <div class="container"> <p>Ylläpito vahvistaa kaikki rekisteröitymiset. Saat sähköpostia, kun olet saanut käyttöoikeudet.</p> <?php // output register form echo $fu->render(); echo $recaptcha->render(); ?> </div> </body> </html> <?php die(); }
  9. @ukyo: thanks for your tip in PM! Now I could successfully create the user, passing the recaptcha validation!! Adding a post checking condition did the trick: $form->addHookAfter('processInput', function() use($fu, $recaptcha, $input) { if(isset(wire('input')->post) && wire('input')->post('fuRegisterForm') == 'fuRegisterForm') { $recaptchaverify = $recaptcha->verifyResponse($input->post('g-recaptcha-response')); if(!$recaptchaverify) { $fu->form->fhSubmitBtn->error('reCAPTCHA validation not ok!'); } } });
  10. Thanks heaps! Now there are no errors. Now I'm just left wondering, why recaptcha validation is not ok I was testing on localhost and it should work with the API keys, but I'll try in the online website next. Edit: didn't work in the online website either..
  11. http://mnt.io/P/2015-07-13_sabre-katana_a_contact_calendar_task_list_and_file_server.html https://github.com/fruux/sabre-katana Thought you guys might be interested in this.
  12. No, I can't use them like that inside the function. If I do, I get an error like this on submit: Notice: Undefined variable: recaptcha in C:\BitNami\wampstack-5.6.2-0\apache2\htdocs\mysite\site\templates\register.php on line 22 Fatal error: Call to a member function verifyResponse() on null in C:\BitNami\wampstack-5.6.2-0\apache2\htdocs\mysite\site\templates\register.php on line 22 Is there something I'm missing?
  13. It seems the only alternative is for Drupal https://www.drupal.org/project/cforge Couldn't find the source for hourworld's Time and Talents, though.. is it behind a registration or something?
  14. The recaptcha module author answered and I noticed I had wrong syntax for the verifyResponse bit (copied from Nico's post). I also now use wire('') for everything inside the function.. Now there are no other notices than Fatal error: Call to a member function error() on null After submitting my registration. Referring to the fhSubmitBtn->error Here is my complete register.php: <?php if(!$user->isLoggedin()) { // load module $fu = $modules->get('FrontendUser'); $recaptcha = $modules->get('Recaptcha'); // prepare register form $fu->register(); $form = $fu->form; // process register / form submit $redirectDestination = $pages->get(1)->url; $form->addHookAfter('processInput', function() { $recaptchaverify = wire('modules')->get('Recaptcha')->verifyResponse(wire('input')->post('g-recaptcha-response')); if(!$recaptchaverify) { wire('modules')->get('FrontendUser')->fhSubmitBtn->error('reCAPTCHA validation not ok!'); } }); $fu->process($redirectDestination); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php echo $title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/mystyle.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $templatesurl; ?>css/somestyle.css" /> </head> <body> <div class="container"> <p>Ylläpito vahvistaa kaikki rekisteröitymiset. Saat sähköpostia, kun olet saanut käyttöoikeudet.</p> <?php // output register form echo $fu->render(); echo $recaptcha->render(); ?> </div> </body> </html> <?php die(); }
  15. Ok, I was being a bit slow again.. I didn't even render the recaptcha! So I added to the top $recaptcha = $modules->get('Recaptcha'); (also $form = $fu->form and echo $recaptcha->render(); below the fu render. Here is the rendering code from the module: $html = '<script src="'.$this->getJsLink($lang).'" async defer></script>'."\n"; $html .= '<div class="g-recaptcha"'.$this->buildAttributes($attributes).'></div>'; Then this response element is created through JS: <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none; display: none; "></textarea> Yet, the recaptcha answer (=I'm not a robot) seems to somehow not be processed as I get Fatal error: Call to a member function error() on null I guess I'll bother the author of the recaptcha module next.. As a new tangent, I'm giving you this proposition to make the module become aware of EmailNewUser. Edit: well, it is enough to call in my register.php: $modules->get('EmailAdminNewUser');
  16. Ok, now I got to test it on an online site. Some notes: - if creating users with CSV import, the pwd is generated only, if left blank in the CSV. If pwd exists in CSV, it won't be overwritten by a generated one. I don't know, if this is intentional, so decided to mention - users registered via FrontendUser module will not trigger emails! Here is the source for the FrontendUser module in Bitbucket.
  17. Thanks for the guidance. I don't like captcha's either, but for this site, admins need to approve every registration by hand, so no validation emails can be sent. Akismet or http://stopforumspam.com/ might be alternatives. The recaptcha module does not require any additional form fields. So would the hooking thing be something like: $form->addHookAfter('processInput', function() { $recaptcha = wire('modules')->get('Recaptcha')->verifyResponse(wire('input')->post->g-recaptcha-response); if(!$recaptcha) { $form->fhSubmitBtn->error('reCAPTCHA validation not ok!'); } }); It seems I don't understand where to put it, though. If it is in my register.php, I get a Fatal error: Call to a member function addHookAfter() on null. Should I put it somewhere in FrontendUser.module (Build registration form function?) or FormHelper.module (Extended PW form api processing function?)? I'm in no particular hurry to find out, so please focus on your own pressing matters first
  18. Leaflet 1.0 beta is here: http://leafletjs.com/2015/07/15/leaflet-1.0-beta1-released.html I tested it and it didn't work with the module. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.css" /> <script src="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.js"></script>
  19. Is it not working for you, if you put this in the config.js: CKEDITOR.editorConfig = function( config ) { config.skin = "minimalist,/site/modules/InputfieldCKEditor/skins/minimalist/"; };
  20. So this is basically a recreation of a menu tutorial from W3Bits, tweaked to include the Advanced checkbox hack. Demo. Even the Advanced hack itself was tweaked: apparently this bit is causing issues with Safari, so I removed it: @-webkit-keyframes bugfix { from {padding:0;} to {padding:0;} }I found this particular configuration to work quite nicely. A previous menu I tried had a problem with the menu items staying expanded between media query breakpoints, when resizing the browser. Below is the CSS for the menu. You will notice that it is mobile-first: /* Menu from http://w3bits.com/css-responsive-nav-menu/ */ /* Note: the tutorial code is slightly different from the demo code */ .cf:after { /* micro clearfix */ content: ""; display: table; clear: both; } body { -webkit-animation: bugfix infinite 1s; } #mainMenu { margin-bottom: 2em; } #mainMenu ul { margin: 0; padding: 0; } #mainMenu .main-menu { display: none; } #tm:checked + .main-menu { display: block; } #mainMenu input[type="checkbox"], #mainMenu ul span.drop-icon { display: none; } #mainMenu li, #toggle-menu, #mainMenu .sub-menu { border-style: solid; border-color: rgba(0, 0, 0, .05); } #mainMenu li, #toggle-menu { border-width: 0 0 1px; } #mainMenu .sub-menu { background-color: #444; border-width: 1px 1px 0; margin: 0 1em; } #mainMenu .sub-menu li:last-child { border-width: 0; } #mainMenu li, #toggle-menu, #mainMenu a { position: relative; display: block; color: white; text-shadow: 1px 1px 0 rgba(0, 0, 0, .125); } #mainMenu, #toggle-menu { background-color: #09c; } #toggle-menu, #mainMenu a { padding: 1em 1.5em; } #mainMenu a { transition: all .125s ease-in-out; -webkit-transition: all .125s ease-in-out; } #mainMenu a:hover { background-color: white; color: #09c; } #mainMenu .sub-menu { display: none; } #mainMenu input[type="checkbox"]:checked + .sub-menu { display: block; } #mainMenu .sub-menu a:hover { color: #444; } #toggle-menu .drop-icon, #mainMenu li label.drop-icon { position: absolute; right: 0; top: 0; } #mainMenu label.drop-icon, #toggle-menu span.drop-icon { padding: 1em; font-size: 1em; text-align: center; background-color: rgba(0, 0, 0, .125); text-shadow: 0 0 0 transparent; color: rgba(255, 255, 255, .75); } label { cursor: pointer; user-select: none; } @media only screen and (max-width: 64em) and (min-width: 52.01em) { #mainMenu li { width: 33.333%; } #mainMenu .sub-menu li { width: auto; } } @media only screen and (min-width: 52em) { #mainMenu .main-menu { display: block; } #toggle-menu, #mainMenu label.drop-icon { display: none; } #mainMenu ul span.drop-icon { display: inline-block; } #mainMenu li { float: left; border-width: 0 1px 0 0; } #mainMenu .sub-menu li { float: none; } #mainMenu .sub-menu { border-width: 0; margin: 0; position: absolute; top: 100%; left: 0; width: 12em; z-index: 3000; } #mainMenu .sub-menu, #mainMenu input[type="checkbox"]:checked + .sub-menu { display: none; } #mainMenu .sub-menu li { border-width: 0 0 1px; } #mainMenu .sub-menu .sub-menu { top: 0; left: 100%; } #mainMenu li:hover > input[type="checkbox"] + .sub-menu { display: block; } }Below is the markup outputted using mindplay.dk's method. I found it impossible to output with MarkupSimpleNavigation or MenuBuilder. The homepage is added as the first top-level item. Notice the onclicks that make it work on iOS < 6.0. The clearfix class cf for the top ul is important. Otherwise the element will have no height (got bitten by this..). <nav id="mainMenu"> <label for='tm' id='toggle-menu' onclick>Navigation <span class='drop-icon'>▼</span></label> <input id='tm' type='checkbox'> <ul class='main-menu cf'> <?php /** * Recursive traverse and visit every child in a sub-tree of Pages. * * @param Page $parent root Page from which to traverse * @param callable $enter function to call upon visiting a child Page * @param callable|null $exit function to call after visiting a child Page (and all of it's children) * * From mindplay.dk */ echo '<li><a href="' . $pages->get(1)->url . '">Home</a></li>'; function visit(Page $parent, $enter, $exit=null) { foreach ($parent->children() as $child) { call_user_func($enter, $child); if ($child->numChildren > 0) { visit($child, $enter, $exit); } if ($exit) { call_user_func($exit, $child); } } } visit( $pages->get(1) , function(Page $page) { echo '<li><a href="' . $page->url . '">' . $page->title; if ($page->numChildren > 0) { echo '<span class="drop-icon">▼</span> <label title="Toggle Drop-down" class="drop-icon" for="' . $page->name . '" onclick>▼</label> </a> <input type="checkbox" id="' . $page->name . '"><ul class="sub-menu">'; } else { echo '</a>'; } } , function(Page $page) { if ($page->numChildren > 0) { echo '</ul>'; } echo '</li>'; } ); ?> </ul> </nav>Edit: fixed the end part, thanks er314.
  21. It sure would work. Thanks for considering it.
  22. How could we integrate this reCAPTCHA module to the registering action?
  23. This seems to be a very versatile and hackable module, thank you for creating it I've already created a version, which only emails the admin, when a new user is created (=registers on their own). Now I'm tinkering with a version, which only emails the user manually, with the "Send email" feature in the user page. If I want to block the automatic emailing on user creation, is it enough to add if(!$this->page->process == 'ProcessUser') return; in the sendNewUserEmail function before the other exiting conditions? I though I'd ask and share the inspiration, before I even put the site online and can actually test the emailing functionality My goal is to import a bunch of users from another CMS, send them the welcome email on creation, then disable adrian's original module and enable my two modified modules permanently.
  24. Tried that and also /../site/... and they didn't work.
  25. Would be great to be able to use a relative path so we wouldn't have to take into account changing between dev and prod sites (dev sites are usually localhost/mysite/). It might be possible with some JS magic, but I didn't find any complete solution. config.skin = "lightwire," + sitePath + "site/modules/EditorSkinLightwire/skins/lightwire/"; How could we get & set the sitePath variable correctly? This might have some solution, but I couldn't really figure it out: http://stackoverflow.com/questions/2188218/relative-paths-in-javascript-in-an-external-file
×
×
  • Create New...