Leaderboard
Popular Content
Showing content with the highest reputation on 04/20/2015 in all areas
-
Major feature enhancements currently available on dev branch - https://github.com/adrianbj/BatchChildEditor/tree/dev The new config settings rely on the new "OR" options for inputfield dependencies, so this new version requires the dev branch of PW. Please test carefully and let me know if you have any problems or suggestions! Thanks to ideas, testing and feedback from @mr-fan this module now supports the following new features which mostly focus on enhanced, customized CSV importing for page creation: Custom configurations on a page by page basis (on the Settings tab) - you can set up a default config in the module settings, but override these for any parent page. Ability to set up custom titles, descriptions, and notes so the interface can be tailored to the exact needs of your editors with page/template specific examples. Option to have editing tools in a new tab, rather than in the Children Tab. Alternatively, you can now replace the current Children/Subpages list in the Children tab. CSV upload and link to external URL, in addition to the existing textarea manual / paste entry. Ability to predefine "field pairings". This means that editors can upload/link to CSV files that may contain more fields than you want to import, or there are fields in your template that are not included in the CSV. Think of it as a predefined version of the "Connect the Fields" functionality in Ryan's "Import Pages from CSV Files" module. This makes complex imports foolproof for non-tech site editors. I think in most cases this could now replace the need for custom scripts for editor friendly, regular CSV importing. Despite the added options, it should be just as simple to setup as before if you don't need any of the extra features. Here are some screenshots to give you an idea. Shows a very simple, restricted CSV upload setup with custom title, description, and notes fields. Note that it is in a custom labeled new tab, rather than under the Children tab. All the new parent page specific config settings. Note in particular the "Field Pairings" section where you define CSV column numbers to match PW field names. The only thing I am having some issues with is persistence of some error messages - if you have setup some options that conflict or otherwise cause a specific error to be sent, you may need to save the settings a couple of extra times to make the message go away - not sure if this is a PW bug or what at the moment, but it shouldn't affect functionality.3 points
-
I recently had a 500 Internal Server Error after moving a site. The cause in that particular case was that the database was not accessable due to wrong user credentials. The site was migrated from one PLESK host to another PLESK host, and it seemed that the database was correctly migrated but the password was set to something random. Not sure if thats the case with your website. But its probably worth mentioning here. ps. The error log file can reveal a lot of information about what can be wrong, have you looked at the log file yet?3 points
-
Check for the id of the page. It won't have one before the page is saved.3 points
-
The dev version has an options fieldtype which is perfect for simple selects like this when there is no extra value in using a page field. Have a read about it here: https://processwire.com/blog/posts/new-options-fieldtype-processwire-2.5.17/3 points
-
This module adds a "SEO" tab to every page where you can define a special title, description, keywords, etc. Try it http://aluminum-j4f.lightningpw.com/processwire/ Name: demo Pass: demo123 How to use You can choose between include automatically or use the following methods: $config->seo // includes all the default values and configuration settings // e.g.: $config->seo->title $config->seo->keywords $page->seo // includes all the default values mixed with the page related seo data // e.g.: $page->seo->title $page->seo->keywords // for rendering: $page->seo->render . . Screenshot Download You can download it in the modules repository: http://modules.processwire.com/modules/markup-seo/2 points
-
Hi, first of all I'd like to thank you all, and in particular Ryan, for this great project which is ProcessWire. I'm using ProcessWire for the first time and frankly I'm finding it quite good, despite my lack of experience. Anyway, I created this post to introduce you the following module, on which we are working, and I'd like to share it with the community which could benefit from it and maybe improve it. You can find the module here: https://bitbucket.org/mauro_mascia/processwire-social-login/ Basically, it adds the ability to allow a social login (using the HybridAuth library - https://github.com/hybridauth/hybridauth) as well as a standard login, user profile and registration. The module is clearly not complete and it is at its first stage of maturity and I hope you can forgive me if I have not fully complied with the PW best practices2 points
-
If this is a new sub-domain, maybe the DNS information has not propagated properly (i.e. it can't yet been seen). Try refreshing your domain's DNS information, if you are able to.2 points
-
Mel, If you've gone through this guide: http://processwire.com/docs/tutorials/troubleshooting-guide/ and the issue is still not resolved and you've checked the logs, including Apache's if you have access to them, then I would suggest to contact your web host as 500 errors are definitely server related.2 points
-
It should be clear that the module should echo, I removed the echo keyword from my documentation because if you download for example ProcessWire, it contains some basic templates and you will need $content = $modules->get('SimpleContactForm')->render(); to output the form. So if you use a template prepend file or if you use for example TemplateDataProviders it differs. I think about that, for now just enter antiSpamTimeMin = 0 (Maybe I should set this as default?), antiSpamTimeMax = 1000 and antiSpamPerDay=1000. This modules creates two log files (→ documentation), have a look there to figure out what is wrong. If you were redirected to the homepage (→ documentation) the reason is always spam protection. If you change the markup make sure to maintain the names of the fields and you have to hide website(honeypot field) and submitted (→ documentation). If you change the number of inputs manually (adding or deleting a field), you have to adapt antiSpamCountAdditionalInputs (→ documentation). You enter the fields as a comma separated list, maybe there will be more textarea fields like `message`. How should I know which one should be a textarea and which one a simple input or maybe a date input (for example). This module provides some templates as starting point, you have to change / adapt the html! The honeypot field is also displayed because it's better to add a surrounding div assigning a class and hide it using CSS. Feel free to contribute! You could at least help me to improve the documentation! Nobody has to use this module! Go ahead and use formbuilder. You can fill out the form in less than one minute, just set timeMin = 0! It's the same as disabling spam protection. There is much more spam protection and of course there is already a honeypot field.2 points
-
Wire Mail SMTP An extension to the (new) WireMail base class that uses SMTP-transport This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times. The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only). Here are Ryans announcement. Current Version 0.8.0 (from 2024-09-25 -- initial version 0.0.1 was pushed on 2014-03-01) Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md Downlod: get it from the Modules Directory || fetch it from Github || or use the module-installer in PWs admin site modules panel with its class name "WireMailSmtp". Install and Configure Download the module into your site/modules/ directory and install it. In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature. You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts. Usage Examples The simplest way to use it: $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient. You may also use the object oriented style: $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire: $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients. $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array: $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working: $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; } A MORE ADVANCED DEBUG METHOD! You can add some debug code into a template file and call a page with it: $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage. The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one: Following are a ... List of all options and features testConnection () - returns true on success, false on failures sendSingle ( true | false ) - default is false sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+) to ($recipients) - one emailaddress or array with multiple emailaddresses cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses bcc ($recipients) - one emailaddress or array with multiple emailaddresses from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest dispositionNotification () or notification () - request a Disposition Notification subject ($subject) - subject of the message body ($textBody) - use this one alone to create and send plainText emailmessages bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback) addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here (only available if a signature is defined in the config screen) attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename send () - send the message(s) and return number of successful sent messages debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!) getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses, logActivity ($logmessage) - you may log success if you want logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here sentLogReset () - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter sentLogGet () - is called automaticly within the send() method - returns an array containing all previously used emailaddresses sentLogAdd ($emailaddress) - is called automaticly within the send() method Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md1 point
-
Lots of people have been asking for a way for ProcessWire to support sending of email, outside of just using PHP's mail() function. I haven't really wanted to expand the scope of ProcessWire that deep into email sending, but I have been wanting to setup a way so that people could override how emails are sent, with modules. For people that are interested in making other ways of sending email in ProcessWire, I've setup a new module base class called WireMail, and a new function called wireMail(). The wireMail() function will use whatever WireMail module is installed. If none is installed, then it will use PW's default WireMail implementation (based on PHP's default mail function). The wireMail() function replaces all instances of PHP's mail() function in ProcessWire's source. It works in a similar way as PHP's mail() except that supports a few different usages. Standard usage would be this: // to, from, subject, body wireMail('user@domain.com', 'ryan@runs.pw', 'Mail Subject', 'Mail Body'); Another usage would be to give it no arguments, and it'll return whatever WireMail module is installed for you to use yourself. If no WireMail module is installed, then it returns ProcessWire's WireMail. $mail = wireMail(); $mail->to('user@hi.com')->from('ryan@runs.pw'); // all calls can be chained $mail->subject('Mail Subject'); $mail->body('Mail Body'); $mail->bodyHTML('<html><body><h1>Mail Body</h1></body></html>'); $mail->send(); Since all of this stuff is only on the PW 2.4 dev branch at present, I'm posting this primarily for people that are interested in creating WireMail modules. For instance, I know that both Teppo and Horst (and perhaps others?) have put together such modules and ideas, so this is all aimed at coming up with a way for those ideas to be easily integrated into PW by way of modules. To make your own WireMail module, you simply create a module that extends WireMail and provide your own implementation for the send() method. Of course, you can go further than that, but that's all that is technically necessary. I've attached an example module called WireMailTest that demonstrates a WireMail module. When installed, it is used rather than PW's WireMail. This WireMailTest module includes lots of comments for you in the code of it, and you may find it helpful to use it as your starting point. WireMailTest.module For you guys developing modules, please throw any questions my way and I'm happy to help. Likewise, let me know if you think I'm missing anything important in the base interface that the modules are based upon and we can update it.1 point
-
Hey, as I often just copy someone else's (sometimes my own) modules structure as a starting point for a new module I thought there has to be a better way to archive that. That's why I created the "ProcessWire Module Generator": modules.pw If something missing? Or some more wishes for options or best practices? Let me know Here's a screenshot:1 point
-
This tutorial will outline how to create a membership system that requires account activation via email. If you have a decent understanding of ProcessWire it isn't difficult at all! Create additional fields By default ProcessWire has a name, email, and password field for the user template. To allow for account activation we will have to add a couple more fields. Create the following fields and add them to the systems default user template. You can make ProcessWire show the system templates by going to setup -> templates -> toggle the filter tab -> show system templates -> yes. user_real_name user_activation Okay great, now that you have added the two additional fields to the user template we can start to code the registration form. I am not going to spend a lot of time on this part, because there is a tutorial that describes creating forms via the API. Create the registration form Once you have followed the tutorial on creating forms, you will have to add a couple of sections to your new form! <?php include("./functions.php"); require("/phpmailer/class.phpmailer.php"); $out = ""; $errors = ""; //create form //full name field //email field //username field //password field //submit button //form submitted if($input->post->submit) { $form->processInput($input->post); //instantiate variables taking in the form data $full_name = $form->get("full-name")->value; .... /* * Create the activation code * You can add a random string onto the * the username variable to keep people * from cracking the hash * ex $activation = md5($username."processwire"); */ $activation = md5($username); $activation_code = $config->httpHost."/activation/?user=".$username."&hash=".$activation; //check for errors if($form->getErrors() || username_validation($username) == 0) { $out .= $form->render(); //process errors /* * this checks to makesure that no one has the username * I have a functions file that I import to the pages I * need it on */ if(strlen($username) != 0){ if(username_validation($username) == 0) { $username->error = " "; $errors .= "Sorry that username is already taken!"; } } } //the registration was successful else { $out = "Thank you for registering!<br><br>"; $out .= "An email has just been sent to " . $email . " with the url to activate your account"; /* * In this example I am using phpmailer to send the email * I prefer this, but you can also use the mail() function */ $mail = new PHPMailer(); $mail->IsHTML(true); $mail->From = "email@domain.com"; $mail->FromName = "Register @ Your Site"; $mail->AddAddress($email); $mail->AddReplyTo("email@domain.com","Register @ Your Site"); $mail->Subject = "Registration"; $mail->Body = " Hi " . $full_name. ", <br>" . "Thanks for registering at Your Site. To activate your email address click the link below! <br><br>" . "Activation Link: <a href='http://".$activation_code."'>".$activation_code."</a>"; $mail->send(); //create the new user $new_user = new User(); $new_user->of(false); $new_user->name = $username; $new_user->email = $email; $new_user->pass = $password; $new_user->addRole("guest"); $new_user->user_full_name = $full_name; $new_user->user_activation = $activation; $new_user->save(); $new_user->of(true); } } //form not submitted else { $out .= $form->render(); } ?> <h2>REGISTER</h2> <div class="errors"><?php echo $errors; ?></div> <?php echo $out; ?> Okay so that outlines the entire form. Let me get into the important parts. Checking for a unique username /* * check if username exists * return 1 username is valid * return 0 username is taken */ function username_validation($username) { $valid = 1; $check = wire("users")->get($username); if ($check->id) { $valid = 0; } return $valid; } We don't want to try and add a username if the username is already taken, so we need to make sure to validate it. If this returns 0 you should output that the username is already taken, and the user needs to choose a different one. Generating an activation code /* * Create the activation code */ $activation = md5($username); $activation_code = $config->httpHost."/activation/?user=".$username."&hash=".$activation; This generates an activation code. It does so by encrypting the username variable and then combines the username and activation code into a url for a user to visit. Now we have to process the activation code. As the teppo recommended, it is a good idea to add an extra string onto the $username when encrypting it with md5. If you don't do this, people may crack it and allow for mass signups. $activation = md5($username."Cech4tHe"); Activate the user <?php include("./head.inc"); include("./functions.php"); /* * this will pull the username and * activation code from the url * it is extremely important to * clean the string */ $activate_username = $sanitizer->text($_GET['user']); $activate_hash = $sanitizer->text($_GET['hash']); if(wire("users")->get($activate_username)->id) { if(strcmp(wire("users")->get($activate_username)->user_activation, $activate_hash) == 0 || wire("users")->get($activate_username)->user_activation == 0) { echo "Your account has been activated!<br><br>"; $activate_user = wire("users")->get($activate_username); $activate_user->of(false); $activate_user->user_activation = "0"; $activate_user->save(); } else { echo "There was an error activating your account! Please contact us!<br><br>"; } } else { echo "Sorry, but that we couldn't find your account in our database!<br><br>"; } include("./foot.inc"); This pulls the username and activation hash from the url. It then goes into the database and looks for the user. Once it finds the user, it get's the user_activation hash and compares it to the one in the URL. If it matches, it activates the user by setting user_activation to zero. Clean the url You can user the built in $sanitizer->text() method to clean the url. This will keep people from inserting special characters that can break the page. Keeping unactivated users out You aren't done yet! Now you will have to choose which areas you want to restrict to activated users only. An activated user's user_activation field will now equal zero. So if you want to restrict a section check to make sure it is zero...... if($user->user_activation != 0) { echo "Sorry, but you need to activate your account!"; } else { // activated users }1 point
-
Hey Nico The solution to the preview URL wrapping over the text below for your module is this code below: span.SEO_google_link { position: relative; overflow: hidden; white-space: nowrap; background-color: #fff; } span.SEO_google_link:after { content: ""; pointer-events: none; position: absolute; width: 50px; height: 100%; top: 0; right: 0; background-image: -webkit-linear-gradient(right, #ffffff, rgba(255, 255, 255, 0)); background-image: -moz-linear-gradient(right, #ffffff, rgba(255, 255, 255, 0)); background-image: -ms-linear-gradient(right, #ffffff, rgba(255, 255, 255, 0)); background-image: -o-linear-gradient(right, #ffffff, rgba(255, 255, 255, 0)); background-image: linear-gradient(to left, #ffffff, rgba(255, 255, 255, 0)); } All credit to this guy who I've been working with for a while: https://processwire.com/talk/user/2562-jw/1 point
-
@jordanlev, I have read the last couple of posts you've written about your experience with ProcessWire in respect of your 'custom/complex' application and I do understand some of your frustration. However, I think some of your assertions may convey the idea that somehow PW corners you to do things in a certain way. Or that ProcessWire is a one-size-fits-all for all kinds of needs. For instance, PW is not and has never claimed to be an e-commerce application. Whilst you can certainly build and e-commerce site with PW (or even a product - there's one in the mix actually) your end product depends on how you code your application. I am not in any way questioning your coding skills; just trying to point out that PW is mainly a tool....what you do with that tool is really up to you. However, for some jobs, you are better of using tools better suited to those jobs, e.g. foxy cart, etc for e-commerce sites. Secondly, the adage that everything is a page does not mean that you should always take that approach. Again, there are examples here in the forum. You can use custom tables, designed just the way you want. Although using pages gives you access to the PW API, you are not tied to using them. And here is another strength of PW...you can use custom tables with ease, and either use custom CRUD code or PW $database and $db to access them (though with some limitations) and you are good to go. Not many CMS will allow you to do this...at least not with ease Thirdly, I disagree with the notion that PW is not up to the job when it comes to custom applications. There's a couple of examples of custom apps built using PW right here in the forums. I don't agree that its only good in terms of the 'templating and the front-end portion of the site'. So this statement "ProcessWire had nothing to offer me on the "custom dashboard application" side of things." is not exactly true. PW allows you to build your own custom dashboards by not getting in your way. Yes, it may not offer a turn-key experience (although there are one or two dashboard modules) but it allows you to build your own without bothering you. Fourthly, PW does not demand that you use its inbuilt 'input' modules or as you put it 'a rather clunky editing interface' when building custom apps/modules with it. In fact, that's one of the strengths of PW. You can build your custom apps using custom code or extend other libraries and PW will happily let you. The 'input modules' are used internally by PW but are also there for convenience if you need to use them, but you are certainly not tied to using them. Build your complex forms by hand or another library? PW doesn't care nor will it get in your way. Anyway, if I misread your posts, I apologise. However, you've made the same assertions twice or thrice and I thought they needed clarification/qualification especially for newbies. Hope I haven't derailed the original discussion1 point
-
@David...Thanks for reminding me! I forgot the breadcrumbs!!! Will work on this. + the quotes...1 point
-
Hi Bernhard, haven't read mindful... I thought you try to save / create a new page with a uploaded file. Your case is much easier to handle with the mentioned page id check.1 point
-
once more outstanding support in the forum. thank you! also thank you pwFoo but a simple if($page->id) did it1 point
-
Yesterday I thought exactly about this procedure. I use several modules over and over again. And it's a hassle to download always the same modules, even when it's comfortable with ModulesManager. Now I don't have to think further, because you already did it! Great work, and obvious a real time time saver. So it fits perfectly in the ProcessWire galaxy! Thanks!1 point
-
Just found another thing, which could be improved. Automatically add "implements ConfigurableModule" if one selects "include configuration page". Or do I miss something here? Also want to say thank you here. It's really nice to have this and finally get my head around the json and external configuration settings It's a real timesaver as I'm working on lots of modules currently.1 point
-
Update: version 0.1.0 Cleaned-up HTML output by MarkupMenuBuilder, thanks to @David Karich ( + added tab indentation for cleaner markup). Note that for included children things may not always align up properly with their parent/native MB menus Merged all latest changes in dev to master1 point
-
Amazing tool, looks massively helpful! Thanks! (Could we put your generator into a wireshell command, kind of like Mike suggested some days ago?)1 point
-
Andi, nico has build an SEO tool not an encyclopedia.1 point