Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/10/2017 in all areas

  1. FacebookEvents ProcessWire module to get Facebook Page Events using the Graph API. Create an app on Facebook developers website You have to create an app to get appId and appSecret. Those keys are required. Go to Facebook Developers and add a new app. Congrats! Now you can copy your Facebook appId and appSecret. Get your Facebook page ID You can either enter your facebook page ID or the facebook page name. If you enter the Facebook page name, this module will get the page ID for you! Call Module $events = $modules->get('FacebookEvents')->getEvents(); Output Events {% for event in events|reverse %} {% if event.start_time|date('U') > date().timestamp %} <div> {% set dts = modules.get('FacebookEvents').getDates(event) %} <a href="https://www.facebook.com/events/{{event.id}}/" title="Facebook">{{dts.dates}}:</a> {{event.name}} <em>{{dts.times}}</em> </div> {% endif %} {% endfor %
    9 points
  2. GUID Generator Generate a globally unique identifier (GUID) for Inputfield Text. Usage For each instance of a text field the field settings will be extended. Navigate to Admin > Setup > Fields and edit the desired field. Click on the Input Tab and click on the "Generate GUID" area. It extends downwards and reveals a form to enable automatic GUID generation. After having enabled GUID generation for a text field, edit a page which has a template containing this field. You'll see the field filled with a GUID.
    8 points
  3. GithubConnect ProcessWire module to connect a Github OAuth application. Register a new OAuth application Fill in module settings Click the Authorize! link to generate code and access token There are some predefined endpoints to fetch informations about an user or a repository, get a list of repositories belonging to an organization, fetch content of readme or certain file.. I used it to choose a repository from a list and import the content (e.g. readme, description) to the corresponding fields. Visit the Github Repository to get a full overview.
    8 points
  4. I thought I would just pop by to say how much fun I am having. I don't really get the chance to put websites together at the moment for some complicated reasons, but I have put some days aside to nail together a new blog about something. And I have thoroughly enjoyed it. Especially all the little tweaks I have been making. For instance, I want the layout on the front page to be very neat, but that means the titles of articles have to be a certain length, as do the summaries and the images, where they are available. That particular constriction doesn't necessarily work in other areas of the site. With PW, the answer is dead simple. TWO title fields, both with the counter switched on and a little note reminding me of the ideal length. I also have two summary fields for the same reason. I have a similar thing with images. I have made up a Photoshop template with Artboards for all my various image sizes - featured image, summary image for the front page, story images for the article, sidebar images and the SEO image. Of course, the fact that I can have an assortment of images in my PW template means I can take advantage of this PS template. And, because some articles just don't have an image, I have a little note telling me to write a longer summary if there is no image. Oh, and a bit of PHP that looks for the short title and uses the long one if I forgot to write a short one ... and so on. I know this is all mundane stuff compared to some of the cleverer functionality Ryan and the various mod devs are coming up with, but for me, it is this simpler versatility that makes Processwire so powerful. That I can just shove in another field to get around a certain problem and bring it up as an alternative with one line of PHP makes sites a joy to develop. Enough so that I actually spent a happy hour today neatening up my code, indenting it nicely and putting helpful little comments everywhere. I didn't need to do it, but I have worked so much faster than I could have with any other system, I had the time - so I had my little bit of fun.
    7 points
  5. This week we’ve got a new core version on the dev branch (3.0.55). This version has a whole bunch of fixes and adjustments. It also adds a new drop-down page tree that we cover in more detail in this blog post. https://processwire.com/blog/posts/processwire-3.0.55-core-updates/
    5 points
  6. The "mess and a nightmare" bit refers to this list expanding and becoming more difficult to manage. But it seems I shouldn't be too concerned about this I don't earn an income from making websites, I'm a charity worker 3/4 days a week so web stuff has to get squeezed in evenings/weekends and 1 or 2 days a week. I've been doing it since about 2004 off and on, made a go of it self-employed in 2012-2015, made some £££ with Drupal (websites plus consultancy on responsive design) but couldn't continue because of working full time, balancing family life and doing a computer science diploma at the same time drained me. Just not enough hours in the week! I have a part time job now (so more time to give self employment a decent shot) so this is another reason why workflow has to be fast (and why I have enjoyed PW so much), although it hasn't 'saved' me any money so far because I gotta make some first. I'm striving towards doing this full time, although 'custom websites' seems quite a difficult niche to carve out because if all the templates available online. Still debating whether to offer 'all bespoke' or have a cheapo option where I plug in a template of their choice. Of course, PW makes this easy and I did exactly this for my stepson, grabbed a static template, converted to PW, job done. I've made three PW sites so far, my own (work in progress) and two freebies for local charities, but I've already heard the dreaded "why not use a free wordpress template, then I can install plugins as required". The influence is strong with WP. <?php define( 'WP_USE_THEMES', false ); get_header(); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <p>Bang head repeatedly against the wall</p> <?php endwhile; else : ?> <p><?php _e( 'Sorry, better get back to the codex.' ); ?></p> <?php endif; ?> Anyway, thanks for the advice people, I'm also off to the store to buy profields. --EDIT-- Installed and ready to go, pretty excited
    5 points
  7. It's those little things where you find some elegant, succinct way to do exactly what you want that make development so satisfying. The only frustrating thing is that unless you work in an office of fellow code nerds you don't get to share those "nailed it" moments. Like, in your home office you call your loved one over and gesticulate enthusiastically at the screen but they're all...
    5 points
  8. TLDR: Buy ProFields I don't understand why that brief list of fields is a "mess and a nightmare". I know the general advice given is to reuse fields where possible but I think people sometimes take this suggestion a bit too seriously. Create the fields you need and forget stressing about whether you have perfectly optimised the reuse of fields. If you have less than, say, 100 fields in your site you really have nothing to worry about. I think I saw a post recently where Lost Kobrakai was talking about a site of his with over 800 fields. But ProFields... You mention client editing experience, so I take that to mean you (like me) earn an income from developing websites. With that in mind here are some things to consider when making your decision whether or not to purchase ProFields... Have you thought about how lucky we developers are that we can earn an income with virtually no overhead costs? With so much fantastic open-source software made available to us at no cost we are in a very fortunate position. We could design and develop websites entirely with free software if we so choose. Hell, if we wanted we could go to the landfill and probably pick up a free old computer that would be perfectly adequate to develop a website on. Now think about the carpenters and dentists and all those other professions that must purchase real physical tools (that wear out) in order to earn a living. £100 doesn't go very far if you need to buy a table saw. On the topic of open-source, think about what Mr Ryan Cramer has provided us with in ProcessWire. People with his level of skill do not need to be contributing their time for free to open-source projects - they are in very high demand for all kinds of lucrative work. Purchasing a Pro module from Ryan is a way to show appreciation for the generous work he puts into PW. PW is not just great free software, it is great software full-stop. You mention previously having worked with Drupal and Craft CMS. Time is money, so think of all the money you have saved by the quick development workflow that PW allows vs Drupal. And Craft CMS costs USD$299 per website and is still not as powerful as the PW core. Ryan's Pro modules are insanely good value for money. The price that you can purchase a dev license that allows you unlimited use of the modules is more than reasonable. For comparison, here is one of the most popular addons for Concrete5: http://www.concrete5.org/marketplace/addons/block-designer-pro There is no unlimited license, and a license for 5 installations costs USD$276.25. And it requires "Block Designer" so that's another USD$120 for 5 installations, bringing the cost to USD$396.25. I haven't used it but it looks like it is basically the equivalent of Repeater Matrix. But probably not as elegant. And with ProFields you get another four modules bundled in. For unlimited use. For USD$129. Hope this has helped make the decision a little easier.
    5 points
  9. ProcessWire Twig Extensions Allows customizing twig, e.g. add extensions. Dependencies: TemplateEngineFactory TemplateEngineTwig Instructions: After installation go to module settings and enable/disable the required extensions/functions. Includes: Twig Extensions Repository Usage: Adds the following extensions/functions: Debug // only if debug mode is turned on {# dump - dumps information about a template variable #} {{ dump('Hello World!') }} string(12) "Hello World!" Intl {# localizeddate - format dates into a localized string representating the date #} {{ "now"|date_modify("-2 day")|localizeddate('medium', 'none', 'en') }} Mar 8, 2017 {# localizednumber - format numbers into a localized string representating the number #} {{ '50.5555'|localizednumber('decimal', 'default', 'en') }} 50.556 {# localizedcurrency - format a currency value into a localized string #} {{ '50.5555'|localizedcurrency('EUR', 'en') }} €50.56 Text {# truncate - cut off a string after limit is reached #} {{ 'Hello World!'|truncate(5) }} Hello... {# wordwrap - split your text in lines with equal length #} {{ 'Hello World!'|wordwrap(4) }} Hell o Wo rld! Array {# shuffle - randomize an array #} {{ [ 'one', 'two', 'three', 'four' ]|shuffle }} [ 'two', 'three', 'one', 'four' ] Date {# time_diff - difference between two dates #} {% set start = "now"|date_modify("-2 day") %} {% set end = "now"|date_modify("+2 day") %} {{ start|time_diff }} 2 days ago {{ start|time_diff(end) }} 4 days ago
    4 points
  10. You can also use timestamps in a PageFinder selector or anything that works with strtotime(): $zaehler = $page->children("einsatzdatum>=first day of January 2017, einsatzdatum<=last day of December 2017");
    4 points
  11. You can use status!=hidden in your selector, so in "Custom selector..." you'd input something like: parent=[id of Content Blocks page], status!=hidden
    3 points
  12. When I worked with Drupal, then discovered PW...
    3 points
  13. I don't want to live without ProFields anymore! If your fields have all the same requirements then ProFields Textareas is your friend. The name a bit misleading, because it covers more than just Textareas. Also oneline inputs and more(Email, Datetime...). Imagine 10 or more input type text with different sizes, titles and notes, all grouped together but just a single database field! My clients love it! And so do I. RepeaterMatrix is a work of art in itself. Those two fields alone are worth every Penny/Cent/CurrencyOfChoice!
    3 points
  14. Hello. Just wanted to ask if there if there is a way to NOT delete Repeater (or Matrix) Items directly but move them to the Standard Trash if the Trash-Icon on the Edit Screen is clicked? This would be helpful when editors accidently delete some Repeater-Items. There is also no Confirm Message when deleting. Especially in Repeater matrix Items there can be a whole lotta Content wich is gone forever. Thanks for every Info...
    2 points
  15. The dd.mm.yy format is what PW outputs, MySQL itself expects a standard datetime literal. Therefore, if you want to get all pages with a date in the current year, you need to search for a minimum date (and perhaps maximum if there are dates in future years present). <?php $startdate = date('Y') . "-01-01"; $enddate = date('Y') . "-12-31"; $zaehler = $page->children("einsatzdatum>=$startdate, einsatzdatum<=$enddate"); Or you could be daring and try out my (still beta) DatetimeAdvanced module that makes use of MySQL's builtin date and time functions. With it, you could say: <?php $year = date("Y"); $zaehler = $page->children("einsatzdatum.year=$year");
    2 points
  16. As fas as I know, currently there is no way for a module developer to include a changelog in a way that enables us to check out the changes in the admin before upgrading.
    1 point
  17. I created a simple module that allows you to log in using your e-mail address rather than username: https://github.com/m...lAuthentication A couple of thoughts: This should be a built-in option in the login module, rather than an add-on - most sites have taught users to log in with their e-mail address. (I tend to forget what my username is - on most sites I don't have one!) The Session and ProcessLogin APIs need to be more extensible - for instance, to allow modifications to the form or fields. Modules like "login via Twitter" etc. will soon be something that people demand. I wish the build...form() methods in PW were more generally open to hooks...
    1 point
  18. Hello again, @Robin S . No matter how strange it could sound, I included the jQuery that was provided with the demo folder by moving it to the proper scripts direction and including it in the header of the page. That did not work but including the online version from googleapis or code.jquery.com did the trick. One less task to concur and now the only thing to do is to style it place the rating in the proper location and style it appropriately. But that is a story for another day. I am again extremely thankful to your kind assistance and most of all - the patience Once I have the working code, will share it with the audience here so that we can move forward with the theme.
    1 point
  19. His pearls of wisdom were an attempt to help you and others who may come across a similar situation. I'm out!
    1 point
  20. Wow, thank you all for the nice and quick help! the pw community is unbelievable! this works perfectly for me: <?php $startdate = date('Y') . "-01-01"; $enddate = date('Y') . "-12-31"; $zaehler = $page->children("einsatzdatum>=$startdate, einsatzdatum<=$enddate");
    1 point
  21. @MilenKo, it won't be a PHP issue if you can see the markup in your page source. Could it be that you do not have jQuery included in your template? jQuery is a requirement for the module according to the GitHub readme. Here is the module working with the "Blank" profile (note that I added jQuery to the head):
    1 point
  22. It seems to be the "double span" issue again. Could you try replacing the same line as in my post above with this: $event->return = str_replace('<span ', '<span data-pid="' . $page->id . '" ', $event->return);
    1 point
  23. @modifiedcontent Works the same as everywhere else, you have a form, form gets submitted, you process it (do what you need with the values submitted). I showed you how to save the values in a page, the same way you can create a user. <?php // $input->post->username same as $_POST["username"] if($input->post->submit) { $u = new User(); $u->name = $input->post->username; $u->email = $input->post->email; $u->pass = $input->post->password; $u->registrationDate = time(); $u->addRole("member"); $u->save(); }
    1 point
  24. 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
  25. @modifiedcontent Did you see my PW 3 compatible module https://github.com/jmartsch/processwire-social-login? Maybe you want to use it instead? It has account validation/email confirmation and login via Facebook.
    1 point
  26. To avoid this you need to add the line: RewriteCond %{HTTP_HOST} !^dev\. [NC] So the full directive is: RewriteCond %{HTTP_HOST} !^dev\. [NC] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] First line checks if this is NOT the subdomain 'dev'. The next line checks if it is NOT the subdomain 'www'. Finally, if both conditions are true, redirect to 'www'. So if the subdomain is 'dev' or 'www' this rule is ignored, saving you from commenting it out all the time. That is why I wanted to stop using http://localhost:8888/websites/example.com, because you have to comment that rule out for local. Be sure to clear your cache after adding that line to the www directive in your htaccess file. This works on all of my builds. My assumption now as to why I am getting the 403 with the builds from my team members is that they used a prepackaged version of ProcessWire for use with Foundation. I use the ProcessWire install that is provided by ProcessWire. If I get any new information about my 403 issue, I will reply with what I discover.
    1 point
  27. The module offers the possibility to add as many fields as you want. Why not using this in-build functionality? Sure, you can store newsletter subscribers under another page or inside of a repeater or in a pagetable or ... There are a lot of options. For my use case it was the easiest solution to store them as a user with a specific role. Users are pages as well! If you want to change this behaviour, you need to rewrite a lot. I wrote a few lines of JavaScript myself to achieve this. This project has no jQuery dependency. Furthermore I do not swap the order, I just need to know, whether the input is empty, focused or filled to be able to set the desired styling. See it in action!
    1 point
  28. Looks like this can be resolved by making sure the same modules are installed on both websites. (Just like Ryan mentions in the docs...)
    1 point
  29. But are you positive you are actually connecting to the local site when you visit dev.example.com? If you haven't configured your hosts file correctly your browser may be attempting to connect to an online server where that address does not resolve to anything and hence the error. If you put a file "test.txt" in your local site root and visit dev.example.com/test.txt can you see your file?
    1 point
  30. It is weird and not worth spending time on I think. I thought it was some general error but it actually only happens on one page and relates to something I was testing with FieldtypeSelectExtOption and hooks. The field and hooks apply to several pages containing similar data yet I only got the panel error on one - I tried a few things to narrow it down but couldn't see the cause. Then I removed and readded the Select External Option field to the template and all is well now. So just one of those strange things that spontaneously resolves.
    1 point
  31. Hi @Robin S - thanks for confirming the Captain Hook and form builder template fixes. That issue on the PW Info panel is very weird. The created field for that image is already a string rather than a timestamp, but I haven't ever seen that. I know how to fix, but it would be helpful to know why it is like that in the first place - do you have any special settings on that image field? Is the error on all your pages with images? PS Just did a little testing and it looks like it is likely only with images in repeaters that we even get to this line in the code, but even so, I am still getting a timestamp returned. I would expect it has something to do with outputformatting being on, but I still can't seem to replicate - at thoughts at your end?
    1 point
  32. @MilenKo, my tip is that if you want to really accelerate your learning of ProcessWire and PHP the single most important thing you can do is install Tracy Debugger and start dumping variables. Whenever you are confused or curious about something, dump it and explore it in the debugger. Installing Tracy also makes sure you are seeing PHP errors when they occur. If you dump $page->recipe_rating you will probably find out where you are going wrong.
    1 point
  33. PHP doesn't let you use dashes/hyphens in variable names. Either $ground_equipment or $groundEquipment will work.
    1 point
  34. @alexmercenary I found a little bug: The module uses a imaginary field named 'date'. Normally there is no 'date' field (naive assumption, I know) and everything works as expected. But if you create a field named 'date' for something else, the condition matches and the form has one more field than desired. The same counted for a field named 'ip'. I just released a new version 1.0.1. Please try if it's working now. @Tom Walcher The form just validates every field how it is configured in the field settings. If you want to have email validation, set the field type to email. If you want a field to be required, just check the corresponding checkbox in the field settings. Same counts for html5 validation. Hiding the website and date field via CSS is not dirty. The website field is already of type hidden, so you just have to hide the corresponding label. The website field is intentional not hidden. It's a trap for spambot. Have a look at the documentation.
    1 point
  35. New Version 1.0.4: @Robin S use label tag if it isn't a multilangual site @jploch, @adrian changed hook InputfieldFile::processInputFile to InputfieldImage::processInputFile
    1 point
  36. No mockery from this group. We're here to help. If you have a statement comparing two conditions (eg. variable to1037, and variable to 1038) then there are four possible combinations: FF FT TF TT. Basically, for every n elements there are 2^n possible outcomes. Example 1. If you want to perform a conjunction (AND) then the statement is true only when both components are true, as follows: Assume $page->id = 100 IF ($page->id !== 1037) AND ($page->id !== 1038) THEN TRUE Example 2. If you want to perform a disjunction (OR) then the statement is true when either component is true, as follows: Assume $page->id = 100 IF ($page->id !== 1037) OR ($page->id !== 1038) THEN TRUE The problem you are experiencing is wanting to use the disjunctive case, as in Example 2. Because when the $page->id does not equal one of the test values (1037 or 1038) the result will also be true, which is not the desired outcome. Hope this helps.
    1 point
  37. The subject is translatable. So even if the page is not multi-lingual, you can overwrite the subject this way.
    1 point
  38. In Soma's tutorial he covers the $options array - does setting 'forceDownload' to false achieve what you want?
    1 point
  39. Been coding days and nights in php and processwire for a long while now. Took a little break and made this.
    1 point
  40. This is amazing and so easy to skin, I noticed a few CSS errors, I will put them on GitHub Great work Ryan!
    1 point
  41. There were a few talks about user avatars here on the forums. Like it means something. I never thought it does. But today I suddenly realized how far the right avatar can take you. I was just testing something in the incognito mode in chrome and... here he is, mr. @kongondo himself! I know, I know, you can say it is only someone that closely resembles @kongondo, but does it matter? If he could make it into my subconscious that far, he could easily penetrate the browser .
    1 point
  42. I would also love to see this - I think it would be great if we could define it in a Github repo changelog.md file and have the automatically imported into the text in the modules directory, and perhaps even displayed in the module info within a PW install. Perhaps it would even be nice to have a way to add a flag about breaking changes that would show up in the ProcessWire Upgrades module so you are warned before upgrading. @ryan - any thoughts on this? I'd be happy to work on it - obviously I could do the PW side of it from the repo, but would need access to the php files for the modules directory to make that side of things work.
    1 point
  43. Tracy went to language school! Now she shows page titles and names in the current language, along with the title and name of that language in the Summary section. And she has a completely new Language Info section showing a summary of the title, name and active status of each language. Hopefully this should help to debug why something is not showing on the front-end. The ⓘ icon highlights titles/names that are missing in the current language. It shows the default title/name instead, along with this icon. Let me know if you notice any problems!
    1 point
  44. Hi Sephiroth, I'm not a professional module developer, but a person from your target group So my suggestions are from the "beginner's point of view", and are as follow: You probably want to clean it up by fixing typos, missing spaces, extra spaces and similar errors. When referring to code, you might want to copy stuff instead of typing, so ProcessPageImageEditSelect vs. ProcessPageEditImageSelect is spelled right, out of the box. You might also want to list the following resources: v3.x API docs: https://processwire.com/api/ref/#modules Blog post: New module configuration, https://processwire.com/blog/posts/new-module-configuration-options/ Blog post: Module configuration is now even simpler, https://processwire.com/blog/posts/processwire-core-updates-pull-requests-and-more-2.5.25/#module-configuration-is-now-even-simpler Blog post: Config arrays..., Expanded module configuration..., Module configuration methods..., https://processwire.com/blog/posts/processwire-core-updates-2.5.27/#expanded-module-configuration-options-within-module-file What really bugs me is the fact that Ryan has already documented so much in the blog, but it is really hard to find what one is looking for. It often occurs to me that I know I've read something in the blog, I just do know know were... We have tons of useful info buried in the blog. Nice incentive anyway, keep it up!
    1 point
  45. I try to build a basic login, logout and register module which could be extended by plugins (PW hooks), but have to be optimized and maybe merged into one module before it will be released... Basic register module (check if username / email already exists) https://bitbucket.org/pwFoo/frontenduser/src/ac39eb355e49016efd2e5f8595bfc1917ebea80f?at=master Plugin (PW hooks) examples like email pre-validation, add default registration role without hack the module itself. https://bitbucket.org/pwFoo/frontenduser/wiki/FrontendUserRegister It's work in progress. So some things may change (thinking about to merge login and register module...). Form handling is done by FormHelper (simplify value sanitizing, take care about form creation, submit button, processing, field errors and prepare file uploads). You can take a look at username / email validation (checks if already exists). It's done as a Inputfield hook.
    1 point
  46. User creation is an administrative task, so if you need non admin/superusers to create users, you'd probably want to create your own form to do it. It would be relatively simple. Creating a user from the API is as simple as: $u = $users->add('username'); $u->pass = 'password123'; $u->addRole('example'); // optional, if role other than guest needed $u->save(); From the sounds of it, you don't want to create actual PW users, but maybe something like them using pages. You could certainly do this (perhaps mapping them all to 1 single PW user behind the scenes). However, I'd encourage you to use PW's users. There is a roles system that is designed to separate users, so the typical way to maintain this separation is by role assignment.
    1 point
  47. Unless I'm missing something, randomBase64String should be bound to the same characters that an MD5 hash would be. Base 64 strings are compatible in GET vars or even URL segments. It's just ascii letters and numbers.
    1 point
  48. Thanks for posing this Kyle! A few things to mention: For even more security with the activation code, you might want to use something completely random that isn't influenced by the username. We have something built-in that will do the trick: $p = new Password(); $hash = $p->randomBase64String(100); // 100=length of string See here how it works: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Password.php#L154 (code is originally from Anthony Finta's password_compat library). Make sure that you are using $sanitizer->pageName("username"); for your username sanitization. Using $sanitizer->text(); is not adequate for sanitizing usernames or any selector values. In your function that checks for duplicate usernames, check for duplicate emails as well. When you check for users or emails do $users->get("name=$username") rather than $users->get($username); as this will ensure it's checking for only the username, and not potentially confusing a numeric username with a user ID. I recommend using $input->get->var rather than $_GET['var'] because the $input->get version makes it so that you never have to worry about PHP's magic_quotes setting. Last thing to mention is that it might be good to include what type of fields the user_real_name and user_activation are. I believe these are supposed to be text fields, but wasn't sure (especially for user_activation) until later.
    1 point
  49. Hope my writing isn't coming off the wrong way -- this is good discussion and collaboration to me. I've been neglecting my duties at the forum for the last few days and trying to participate better now that I had a little break today. I'm having fun, learning and hopefully contributing something worthwhile too. Soma if you view this our any of our past interactions as confrontational in any way (which the word 'war' implies), I apologize because I felt much the opposite. Stubborn really? My wife will think that's hilarious, she thinks I'm a gullible pushover.
    1 point
×
×
  • Create New...