Jump to content

flydev

Members
  • Posts

    1,358
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. Hi Jee, if empty, the inputfield set himself with the right value on the page save(). Doing something like this should work : // set outputformatting to false $page->of(false); // set the date field to an empty string $page->datenow = ''; // save the page, the date field should be updated $page->save(); // set outputformatting to true $page->of(true);
  2. Another little info : memory_limit must be > post_max_size to prevent poorly written scripts for eating up all available memory. And also the LimitRequestBody Apache's directive allows the user to set a limit on the allowed size of an HTTP request message body (set to 0 (illimited) by default).
  3. On the details tab of the field, look at Inputfield Type option, you should be able to switch between textarea / CKEditor.
  4. woohoo thanks you! how I missed that - its working
  5. I thought that the core function was doing the job : if(!is_array($options['exclude'])) $options['exclude'] = array($options['exclude']); Anyway I tried to assign an array, it does not work. Really it drives me crazy lol
  6. Thanks horst, yes but it wont work. For information the core function add and test the trailing slash : if(count($options['exclude']) && (in_array($name, $options['exclude']) || in_array("$name/", $options['exclude']))) continue; Also I remember a detail, when I developed the profiles for Bootstrap and Foundation, I used ProcessExportProfile to export them, and this module try to exclude itself from the generated profile but it fail. So it look like an issue that is here since PW 2.7. // code from ProcessExportProfile [...] $options = array( 'dir' => $dir, 'exclude' => array("$dir/modules/ProcessExportProfile") ); [...]
  7. I am working on a module and I need to exclude files/folders from a zip file created by wireZipFile() running on PW-3.0.38, without success. In the following test code, for example I want to exclude the folder errors and his child files. It create the zip file but fail to exclude the folder even if $option['exclude'] is filed. <?php namespace ProcessWire; $foldertozip = $config->paths->templates; $zipfile = $config->paths->templates.'test.zip'; $result = wireZipFile($zipfile, $foldertozip, array('exclude' => $config->paths->templates.'errors')); $content = ""; foreach ($result['files'] as $file) { $content .= "Zipped $file<br>"; // the listing show the folder 'errors' and his child files } I also tested to modify the core file WireFileTools.php, function zip(), hardcoding the path to exclude, again without success... already many hours trying to figure what the problem is Any idea guys ? thanks you.
  8. @Marvin Earp , Hi and welcome ! Which version of ProcessWire are you using and what is the admin theme ? You should try the fix of @valan :
  9. Hi Kai, I don't see any requirements here that is not manageable by ProcessWire, the only limit will be knowledge of PHP. 1. You could implement OAuth easily with 3rd party libraries or integrate each provider's API into ProcessWire. 2. You can manage users by using API and/or by playing with roles, permissions into ProcessWire backend. 3. Yes - very easy, for example, you can just use "pages" and page filedtype for relations. 4. Yes - by playing with urlSegments. 5. Yes - you can implement this feature easily + there are one or two modules which might help you to achieve that. 6. Yes - you have to implement it. 7. Yes - by using the API . 1. Yes 2. Yes 1. Yes (hooks come to my mind). 2. No problem at all. 3. From what I've read on the forum, I want to say : superfast. (ProCache)
  10. @modifiedcontent Imagine we have 3 pages : Home, Register, Member Area and 3 templates : home, register, member-area. In the template home, if the user is not logged in, the login form appear on the homepage - there is also a link to our register page, another for the member area page and the logout link. Code of home.php : In the register template, we show the registration form. First step, once the form is filled, a validation email is sent to the user. Then if the user go to his mailbox and click to the validation link, he return to our register page and submit the form with the validation token. If everything went smooth, we use a hook before the form is saved to add a role "member" to the user. Then we use a hook after the form is saved to send a confirmation email with the details (username, email, passowrd, welcome message, etc.). Code of register.php : And then in the member-area template, just show welcome message and a logout link. Nothing special here. Code of member-area.php : To test it, just create and copy paste the code of each template. FAQ: Check the hook in the register.php template above. Check the hook in the register.php template above. Read this post and ask for example/help if needed. You could do something like that : $markup = $fu->render(); $markup = str_replace('<ul', '<div', $markup); $markup = str_replace('<li', '<div', $markup); $markup = str_replace('</li>', '</div>', $markup); $markup = str_replace('</ul>', '</div>', $markup); $out .= $markup; (I am sure there is a better way to do it) You can modify the file emailValidation.php or use your own in /site/modules/FrontendUser/templates. Hope it help
  11. Perfect, it work fine on the three versions. Thanks for the update
  12. I think it was just an observation, no offence there It is good to see you trying again to build something with this piece of software.
  13. Today I managed to get it working for the three version. Tested. In the file FrontendUserRegisterEmailValidation.module line 110 I replaced the following code : // Load the plain / html email templates $emailContentHtml = wire('page')->render(wire('fu')->getFile('validationEmail.php', 'templates'), $vars); by this code : // Load the plain / html email templates $file = wire('fu')->getFile('validationEmail.php', 'templates'); $emailContentHtml = wireRenderFile($file, ['options' => $vars], ['default_path' => '']); As wireRenderFile was introduced in ProcessWire 2.5.2, there is no problem of compatibility. We can now receive email validation on PW 3.x with all information to create new user account
  14. It is simply not compatible with ProcessWire 3.x.
  15. I dont know, let me test on a 2.7 and 2.8, I will give you feedback. edit: installing the two version... edit 2: on 2.7.2, 2.8.33 and 3.x, after installation of the FURegisterEmailValidation, it give this error when accessing the frontend page : Fatal error: Call to a member function attr() on a non-object in [...]\site\modules\FrontendUser\FrontendUser\FrontendUserRegisterEmailValidation.module on line 160 Commenting the line 160, the form is rendered on the frontend page. Email testing - @pwFoo there are the results : on 2.7.2 : After filling the form, the email is sent and it contain all the information. It works. on 2.8.33 : After filling the form, the email is sent and it contain all the information. It works. on 3.0.33 : After filling the form, the email is sent and is empty. It do not works.
  16. If I understand correctly, you want the email activation plugin. In the backend, install the module FrontendUserRegisterEmailValidation then you call the module like that (but read the rest of the post and test it) : $fu = $modules->get('FrontendUser'); // add emailValidation to the form $fu->register(array('username', 'email', 'emailValidation', 'password')); $fu->process($pages->get('/login/')->url); echo $fu->render(); --- @pwFoo I implemented FU on a PW 3.0.33 with the FURegisterEmailValidation module. The email is sent but empty. Using TracyDebugger, I dump $emailContentHtml and $emailContentPlain, they are always empty . // Load the plain / html email templates $emailContentHtml = wire('page')->render(wire('fu')->getFile('validationEmail.php', 'templates'), $vars); bd($emailContentHtml); it return : "" (empty string)
  17. Thanks for sharing. I have one comment. I have a doubt about this variable : $input->post->g-recaptcha-response - it return a PHP notice undefined constant (or I am dumb).
  18. Hi Enrico and welcome to the forum. You will get good answers for sure, meanwhile, you can read this tutorial:
  19. Ok sorry, so lets get started with a step-by-step coding moment. I based the work on your form I found there : http://pingu.eb-zuerich.ch/kurs/bildungsgang28/beglinger/cms/#shop What we are going to do : installing a module in order to get working with Google ReCaptcha Setting a variable which contain the site owner's address email. What the code do : check that GoogleRecaptcha is correct check the client's submitted data for security reasons show the form on the page show a message to the client only if captcha and submitted data are correct send email to the site owner and send email to the client's email You can copy the code, it should work fine. But I advice you to try to read it understand so we will go with more PW API next time Anyway, the following code is taken from here (a topic that is worth to read) and modified for your needs, more infos on the end of the post. 1) Install the module MarkupGoogleRecaptcha and configure it : Now the code : <?php $emailTo = ''; // address mail of the site owner (you can get this value from a field!) $emailBackMessage = 'Thanks you for your purshase.'; $captchamod = $modules->get("MarkupGoogleRecaptcha"); // get the module for GoogleReCapatcha $captcha_form = $captchamod->render(); // render Google ReCaptcha for including it in our form $sent = false; // check for error $error = ''; // error message $out = ''; // this variable will contain our HTML markup // sanitize form values or create empty $form = array( 'product' => $sanitizer->text($input->post->product), 'fullname' => $sanitizer->text($input->post->fullname), 'address' => $sanitizer->text($input->post->address), 'email' => $sanitizer->email($input->post->email), 'telephone' => $sanitizer->text($input->post->telephone) ); // check if the form was submitted and if ReCaptcha was check if($input->post->submit && isset($_POST['g-recaptcha-response'])) { if (!$captchamod->verifyResponse()) { $error = "<p class='error'>Please check the Google ReCapctha.</p>"; } // determine if any fields were ommitted or didn't validate foreach($form as $key => $value) { if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>"; } // if no errors, email the form results if(!$error) { $message = "Full name: {$form['fullname']}\n" . "Email: {$form['email']}\n" . "Address: {$form['address']}\n" . "Tel: {$form['telephone']}\n" . "Product: {$form['product']}"; // send mail to the site owner mail($emailTo, "Contact Form", $message, "From: {$form['email']}"); // send mail to the client mail($form['email'], "Contact Form", $emailBackMessage, "From: {$emailTo}"); // populate body with success message, or pull it from another PW field $out = "<div class='alert alert-success'>Thank you, your message and your item has been recorded. An email confirmation as been sent to your inbox.</div>"; $sent = true; } } if(!$sent): // if the message was not sent successfully // the form markup $out = <<<HTML <div class="alert alert-warning">{$error}</div> <form role="form" id="frmContact" method="post" action="./"> <div class="form-group"> <label for="product">Article:</label> <select class="form-control" name="product" id="product"> <option>T-Shirt: white, slim</option> <option>Jacket: leather, black</option> <option>T-Shirt: grey, logo-print (reserved)</option> <option>T-Shirt: green, bus-print</option> </select> </div> <div class="form-group"> <label for="fullname">Name:</label> <input type="text" class="form-control" name="fullname" id="fullname" required> </div> <div class="form-group"> <label for="address">Address:</label> <input type="text" class="form-control" name="address" id="address" required> </div> <div class="form-group"> <label for="email">Email:</label> <input type="email" class="form-control" name="email" id="email" required> </div> <div class="form-group"> <label for="telephone">Telephone:</label> <input type="tel" class="form-control" name="telephone" id="telephone" required> </div> {$captcha_form} <button type="submit" class="btn btn-warning" name="submit" id="submitBtn" value="submit">Buy</button> </form> HTML; endif; // end if | email not !sent echo $out; // echo the markup ?> The code is well commented and self explanatory. 2) Set the email of the site owner. In the code : $emailTo = ''; // address mail of the site owner (you can get this value from a field!) Now you should be able to copy-pasta the code in place of the form in your page
  20. Yes. You should use WireMail. First option, you want to use AJAX to change your HTML markup dynamically. For example, if a client click on the button 'Buy', it will replace the form markup by a custom message like 'Thanks for your order!' WITHOUT reloading the page. For that, you need a PHP script which handle the mail process (you can found example here on the forum), bootstrapping ProcessWire and a simple Javascript script. Second option, you set your form action attribute to the same page - <form action="./"> ... </form> - and you process the $_POST variable (or $input->post) in the same page with PHP. This will reload the page, but do not redirect you to another page.
  21. You could simply add the size of the article (I mean, a t-shirt (the article) and XL (the size)) in the title of the select/option by concatenating your fields (article_title and article_size) and include in the email the value of the <select>/<option> element , so your client can see in his email a line with the correct item bought. I dont see in your code the select/option HTML element which is appearing on the website.
  22. @benbyf I forked the module and added the functionality, you can find the module at github: https://github.com/flydev-fr/MarkupTwitterFeed To search hashtag use it as the following : $options = array( 'searchQuery' => 'ProcessWire', 'limit' => 3 ); $t = $modules->get('MarkupTwitterFeed'); $out = $t->search($options); echo $out; The function search() act like render(). Thanks again for the suggestion (searching for hashtag). I think we can improve it a bit, let me know for any needs.
  23. I am used to deploy Vesta on the latest stable Debian (currently Jessie). No issue detected on my side during the installation and setup, everything is coherent. Configuration of new virtual host is setup in one click, same for user access and database. The only drawback is about the DNS, some knowledges is required to get working with (as always and each CP), but not required at all to run websites. Really, using it once is like adopting it.
×
×
  • Create New...