Leaderboard
Popular Content
Showing content with the highest reputation on 02/19/2016 in all areas
-
http://ukmoths.org.uk Hi, I launched this back in late 2015 but just decided to post it here. It's a complete rebuild in ProcessWire of a site that's been running and growing for at least 15 years in one form or another. The site aims to illustrate all of Britain's moths (not quite there yet!), and despite the obscure subject matter, gets quite a lot of traffic. Hence I've used ProCache to keep things snappy and I'm pleased with the performance. There are over 7000 photos on the site. I should say that the design is not mine, but a purchased template. It took a while to find a template that I thought could portray these under-appreciated creatures in a good light. The most challenging aspects were importing all the data and images from the old system, and getting aspects of the search to work in the way I wanted. The best part is that it's so much easier to add new content! Thanks for ProcessWire, and thanks Ryan and everyone else in the forums! Cheers, Ian.15 points
-
I am just about to go to bed so will continue working in the morning. Just thought I would say I have succeeded in getting SAML logins working All i had to do was set the session name in the ProcessWire config and do a bit of work on the user matching and signing in Now when I go to the admin URL when not logged in it will do a SAML login, if the user logging in has a ProcessWire user (matched by email at the moment) then it will log them in. Need to work on log outs though, as when you log out it takes you back to the ProcessWire login page which then of course starts the SSO process again and just lands you right back where you started in the admin panel with a helpful notification saying "logged out" despite being logged into the admin panel :| Will work on that tomorrow, I may release this module if I can polish it up enough need to add configuration pages and such before I will consider that though.6 points
-
Latest version has two new features: Performance panel Shows memory usage and execution time between breakpoints. You add breakpoints using one of these: TD:addBreakpoint('Breakpoint Name'); addBreakpoint('Breakpoint Name'); bp('Breakpoint Name'); PW Logs viewer panel This shows the last 4 entries for the PW errors, exceptions, messages, warnings logs. This is just meant to give you a quick look at the last few entries without needing to go to the PW admin to the Setup>Logs section5 points
-
This week it's a relatively focused blog post, largely in part to much focus going into the ProDrafts documentation today. Specifically, ProDrafts is now in pre-release! Here is today's post: https://processwire.com/blog/posts/prodrafts-now-available-in-pre-release/4 points
-
Or maybe we just wait for 'Media Manager' ...could save us a few brain cells, huge folders and a couple of monkeys at the zoo will be the merrier... The person developing MM...(I know him/her from the forums) has recently told me it should be out for sale very soon. Fingers crossed...4 points
-
https://github.com/ryancramerdesign/ProcessWire/tree/devns Downgrading to 2.7So long as you haven't modified your template or module files to add PW 3.x specific code to them (like a namespace), you can easily switch between ProcessWire 2.7 and 3.0 simply by swapping the /wire/ directory and /index.php file from the appropriate version. ProcessWire 3.x doesn't make changes to the database, so the database should be identical between 2.7 and 3.0.3 points
-
Hi Chris, Welcome to the forums. In addition to what @adrian said, I am wondering why you can't check for and reject duplicates at the point of creation? If listings are pages and they all share a single parent (id #1070) and they are created by users, you should be able to reject listings when they are being created...Something like: $p = new Page(); $p->title = $sanitizer->text('Some Title'); $p->parent = $pages->get(1070); $p->template = $templates->get('listing'); $p->surname = $sanitizer->text($l);// or however you sanitize if($p->title) $p->name = $sanitizer->pageName($p->title);//sanitize and convert to a URL friendly page name //check if name and surname already taken within same parent if($p->parent->child("name={$p->name}, surname= $p->surname, include=all")->id) { // if the same name and surname exist, don't create the listing page $msg = 'That listing already exists'; } else { $p->save(); $msg = 'Successfully created listing'; } echo $msg; This way, you will never have duplicates. What about shared surnames?3 points
-
Your translation is technically correct, but so far no-one has tried to force a maid's uniform on me. To answer your question, I bet I'd look awesome in one of those. As a potential downside my credibility could take a slight hit in the process. Seriously speaking "financial officer" or something along those lines would be a better translation in this case3 points
-
Thanks for the prompting. The latest version should now work with the 2.7.x branch, but please let me know if you find any problems.3 points
-
Hi there, I'm currently starting out with some already quite big projects in cooperation with a partner agency in Munich. There are different scopes of work from rather simple-in-structure content websites to a quite complex SaaS webapp in the pipeline. Therefore I'm looking for possible partnerships with at least one freelancer to assist in these projects, possibly as long-term collaboration. Some proximity to our office in munich would be preferable, but is not required, as is knowledge of the german language. Please drop me a line on the forum if you're interested, so we can get into the details. Greetings, Benjamin2 points
-
2 points
-
You need to allow credentials for cross domain requests for ajax calls in the mobile framework you use. For regular xhr objects this just means setting xhr.withCredentials = true; but depending on the library, this may have to be done in a less direct way (like in beforeSend in jquery where you have access to the xhr object).2 points
-
You don’t actually need to load the page at /url-one/, since you already know its url, and that’s all you need for your switch logic. Also, your variable $styleSwitcher refers to a Page object, but you’re comparing it to a string (the current page’s url). I would suggest simply comparing $page->url to "/url-one/".2 points
-
Yeah, you do need to read up on get() and find() and the lot... What you statement is saying is this: Go and get the page 'url-one' If you got that page, echo one.css Else (if you didn't get the page 'url-one') echo two.css Pausing for a moment, do you see where your mistake is? ...As long as you have a page called 'url-one', $styleSwitcher will always be true irrespective of which page is currently being viewed and one.css will always get loaded. What you really want is to check if the current page (being viewed) has a url that is equal to the page 'url-one' URL. You haven't done that in your conditionals/logic. That's what you are missing. Quick tip: sometimes it is best to write down the logic you are after in 'plain language/word form' and the translate that to code. OK, I think I've given you enough hints to get you going....I'm trying to help you to learn. If you get stuck, let us know and we'll help2 points
-
Adrian, I give you – in the spirit of the Oscars – the golden medal for "Best Off-Topic Comment in February 2016" for this comment! Congratulations, you earned it!2 points
-
Tracy Debugger for ProcessWire The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger Modules Directory: http://modules.processwire.com/modules/tracy-debugger/ Github: https://github.com/adrianbj/TracyDebugger A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.1 point
-
Hey, The Form API has CSRF protection build in, but if you for some reason don't want to use the API you can however use the CSRF protection. Its very simple but it took some time for me to find out, so i figured i share my findings with the rest. What is CSRF? First you need to create a token and a token name you do that as following: $tokenName = $this->session->CSRF->getTokenName(); $tokenValue = $this->session->CSRF->getTokenValue(); Very simple. Now what you want to do is create a hidden input field like this: $html .= '<input type="hidden" id="_post_token" name="' . $tokenName . '" value="' . $tokenValue . '"/>'; Now this will generate something that will look like this: You are done on the form side. You can now go to the part where you are receiving the post. Then use: $session->CSRF->validate(); This will return true (1) on a valid request and an exception on a bad request. You can test this out to open up your Firebug/Chrome debug console and change the value of the textbox to something else. Basicly what this does is set a session variable with a name (getTokenName) and gives it a hashed value. If a request has a token in it it has to have the same value or it is not send from the correct form. Well I hope I helped someone.1 point
-
The simplest way would be locking the AmountDiscounted field in the backend and hook to Pages::saveReady and set the value accordingly on each save.1 point
-
1 point
-
There are no changes on database level, so you could downgrade as long you don't rely on pw3.0 only modules.1 point
-
How about include_once("./_functions.php"); ? $config->urls->templates returns a URL but you can only include a local file, so no need for this.1 point
-
You can't use a wildcard in Access-Control-Allow-Origin if you want to do XHR. A simple workaround would be to return the value of the Origin request header instead of the wildcard.1 point
-
No pun intended - but now I wish I had thought of that! Yes, each moth is a page, and in fact each photo is a child of the 'moth' page, so has it's own page too. This is a historical thing - lots of other sites are linking directly to the individual photo pages from the old site, so I made the new site replicate that structure albeit now with friendly urls. It probably would have been a lot simpler to have the photos as a repeater field in the moth template but I needed individual urls for these external links. Thanks Dave. I submitted it but I think it's still working its way through the system.1 point
-
This may have nothing to do with your current issue, but you may want to do your sandbox tests and actual implementation using the HTTPS/TLS protocol. Some pertinent resources: https://devblog.paypal.com/upcoming-security-changes-notice/ https://developer.paypal.com/ https://developer.paypal.com/docs/classic/lifecycle/info-security-guidelines/ https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1913&expand=true&locale=en_US1 point
-
I think this might best be handled in your template as getting into having multiple formatted versions for each phone field in the module might get a little out of control. All you would need to do is build the number like this: $automaticDial = '+' . $page->phone->country . ' ' . ltrim($page->phone->area_code, "0") . $page->phone->number; Or something like that - I am sure you get the idea1 point
-
Obviously I don't get the full picture but a couple of things come to mind.. Use IDs to log duplicates? At review stage, use limit and pagination to get listings in batches (i.e. don't get all the 5K children!), ordered by surname or other criteria that will ensure duplicates appear on the same list then do whatever...?1 point
-
This gave made me chuckle. Pun intended? Moth => light, LoL Lovely site, very snappy. How are you handling the data, each moth is page?1 point
-
Of course PW is able to follow symlinks. This isn't related to PW. Check your .htaccess and vhost config ( I always use symlinks to exclude cache/sessions/files/ ...)1 point
-
Just set a default css in _init.php, then use the template file of a page to override the default value. If you want to use compare, using page id would be more easy.1 point
-
Hello Tom, thank you for that hint. It may work in the most cases. Unfortunately in my special field setup it didn't work. Anyways I've came up with another solution: // Admin > Setup > Fields > Custom PHP code to find selectable pages $categories = $pages->find('has_parent="/categories/", template="category"'); foreach ($categories as &$category) { $breadcrumbs = wire('helper')->buildBreadcrumbList($category); $category->title = join(' / ', $breadcrumbs); } return $categories; Since I don't execute $category->save() that should be perfectly fine there and it seems to work like a charm without any side effects.1 point
-
Raising this from the dead, but setLanguageValue() and getLanguageValue() are pretty useful for those kind of things. From code/Page.php * Methods added by LanguageSupport.module (not installed by default) * ------------------------------------------------------------------ * @method Page setLanguageValue($language, $fieldName, $value) Set value for field in language (requires LanguageSupport module). $language may be ID, language name or Language object. * @method Page getLanguageValue($language, $fieldName) Get value for field in language (requires LanguageSupport module). $language may be ID, language name or Language object. *1 point
-
It sure can be, look at philo/laravel-blade (30K downs) or duncan3dc/blade (26K downs). But there are (quite a few) requirements to run those packages though, and if you're ok dealing with external dependencies that might go without a head dev anytime, suit yourself. Not that I think Laravel is going to die anytime soon, but those projects — not so sure. I've been burned enough times on forks to have learned that lesson. I'd rather stick with twig/twig (14.6M downs) which has literally no dependencies, though personally I'm more of a "PHP's already a good at templating and I don't want to learn yet another template engine syntax" kind of guy, though I see how they are nice to use in their "native" environment, where their value seems higher to me. /r1 point
-
Sorry haven't had time to test yet; please clarify...apart from the 1 issue you mentioned a couple of posts up, this should work just fine in PW 2.7.x? Thanks.1 point
-
Ok, I have now added the ability to enable Tracy for non-superusers. Users with a role that has the "tracy-debugger" permission will have access. I would recommend created a dedicated "tracy-debugger" role with just the "tracy-debugger" permission. That way you can easily give a user the required permission without giving any other users access. There is also a new "Allowed Non-Superusers" panel that warns you that you have given some non-superusers permission to view Tracy and lists the users and roles affected. For the moment I have decided not to allow everyone access when the PW debug mode is on. I see the logic in this, but Tracy provides a lot more information than what the debug mode does, so I am hesitant to enable anyone to see that information without specifically being given the appropriate permission. Please let me know what you guys think of the current version. If there are no issues, I will release this to the modules directory tomorrow. Thanks again for all the testing and feedback!1 point
-
I'm sure I read somehwere that Blade could easily be used outside of the Laravel scope. Never really tried it, though, because I'm a Twig fan.1 point
-
Hi, Here is our web site done in ProcessWire: http://gsbelarus.com/pw/en/ Background image will change with every page reload, so use Refresh to view all gallery.1 point
-
I know this is a little old, but perhaps this new module might help with the multilanguage issue: http://modules.processwire.com/modules/process-setup-page-name/ Have a read of this message in the support thread: https://processwire.com/talk/topic/8576-name-format-children/?p=110656 - maybe posting a followup there might also help to motivate kixe (the module author) to work on the multi-language stuff.1 point
-
1 point
-
1 point
-
Amazing work with this module. Image magik is light years ahead of GD in terms of how will it sizes PNG files. Especially logos where you need to see hard clean lines. I have noticed that of the 30 logos I have sized with image magik 4 of them came out looking like this. if I save the file again in photoshop it totally fixes the issue. might be the images have some kind of bad data that only image magic picks up and GD doesn't? Or it might be the module...I just wanted to bring it to your attention, just in case it's helpful. Here is the original: Again, amazing module!1 point
-
[news from the trenches] I created a page called "Question Bank" and populated it with 3 questions. I'm showing one per page and storing the answers in the session, along with the user id. I'm using the session values to mark the choice made (if the user goes back to a previous question) and I'll save it in the DB on the end of each quiz attempt. The code is on github (along with a db dump) -> https://github.com/sjardim/ProcessWire-Quiz-App This is the admin so far.1 point
-
Another plugin that's similar to RAMP: https://github.com/stenberg/content-staging1 point
-
You're right that it requires a form to run processInput(), creating and saving a page via API doesn't validate anything Like this, but won't work with file fields. $p = new Page(); $p->template = "basic-page"; $p->parent = 1; // $p->save(); $in = new WireInputData(); $in->setArray(array("title" => "")); $form = $modules->InputfieldForm; foreach($p->fields as $field){ $inputfield = $field->getInputfield($p); $form->add($inputfield); } $form->protectCSRF = false; $form->processInput($in); foreach( $form->getErrors() as $err ) { $content .= $err; }1 point
-
Are you talking about the permission to access the module? Or different behavior based on roles? The first one could be solved pretty simple like this: public static function getModuleInfo() { $permission = (wire('page')->parent->name == 'setup') ? 'role-a' : 'role-b'; return array( 'title' => 'Foo', 'summary' => 'Bar', 'permission' => $permission, ); }1 point
-
Just in case. This login code in here with custom login code, will break if login throttle is enabled and kicks in: See here for how to handle this: https://processwire.com/talk/topic/107-custom-login/?p=586271 point
-
Hi circlet, welcome to ProcessWire! How is your current setup for the users? I Assume you created two different roles to distinguish them and assigned one of them to your users. You can log-in a user with the API: http://processwire.com/api/variables/session/ Short example: /* After the form with username/password was sent... */ // Log in the user $username = $sanitizer->pageName($input->post->username); //Sanitize username $u = $session->login($username, $input->post->password); // Check if a user was returned or null if (!is_null($u)) { // Redirect based on role if ($u->hasRole('role-A')) { $session->redirect($pages->get('/path/to/page/for/role-a/')->url); } } else { // Wrong username or password }1 point
-
It might be feasible to do something like Soma's function above, where it populates the old (valid) value back when an invalid value is received. But rather than throwing out the old value, remember it a session variable. Then your module would also hook after ProcessPageEdit::buildForm and cycle through the any saved session variables, populating back the values it recorded (and removing them from the session). It's necessary to use session variables here just because there is a redirect between saving an editing again, something that is not obvious when you are using PW to edit pages. I would recommend something like: $values = array( 123 => array( // indexed by page_id 'date_from' => 'October 33, 2013', // invalid date 'body' => 'some bad words here', // invalid value ); $session->set('PageEditBadValues', $values); Also wanted to recommend hooking ProcessPageEdit::processInput rather than InputfieldForm::processInput, just so that you are limiting the action to the PageEdit form and not getting involved with other InputfieldForms unnecessarily. Your after(ProcessPageEdit::buildForm) function might look like this: function hookPageEditBuildForm($event) { $form = $event->arguments(0); $page = $event->object->getPage(); $values = $this->session->PageEditBadValues; if(empty($values) || empty($values[$page->id])) return; $values = $values[$page->id]; foreach($values as $fieldName => $value) { $inputfield = $form->getChildByName($fieldName); if(!$inputfield) continue; $inputfield->attr('value', $value); } }1 point
-
It is a CMS page after all and not a front-end from where you make submission and it won't get sent before all errors are corrected. I understand what you're saying and in future this for sure will be possible. Currently publish/unpublished, creating, editing page is limited to that there's only one version of a page and one status. So editing a page and not being able to save it because a field is not valid may cause issues and keeps the page in a state the user can't go on (maybe he doesn't know etc) and all data will get lost. Anyway many scenarios and things that can happen with such validation. Saving in session wouldn't scale. It's not as simple and we're even in a privileged situation where PW at least has validation and field dependencies etc, I don't know of a similar CMS that has this anyway. PW is designed to do it all and more you can't even dream of , but Ryan has only two hands and one brain, 16 hours a day. But I'm sure he could provide more and better worded answers than me. Yes exactly: versioning/draft versions of pages will for sure give you more what you need here.1 point
-
I don't know how to prevent page from getting saved. Whatever you mean by definition "save page". What about other fields that are correct and edited, they will get lost? So PW will save page regardless, except for fields that are validated, the inputfield processInput defines what get's saved (not sure in details and have no time to test out). But required fields will just throw an error. So in this case PW saves the page but you won't be able to publish it until all "validation/required" errors are gone, only then the page can be published. So whatever you do with old and new value is up to you. As soon as you throw an error PW says this: Session: Change: body Session: Saved Page: /de/about/ (1 change) - Cannot be published until errors are corrected Session: Go away! (body)1 point
-
Usually this is a good and simple method: In a autoload module you hook into the processInput of InputfieldTextarea. public function init(){ $this->addHookAfter("InputfieldTextarea::processInput", $this, "validateText"); } public function validateText($event){ $field = $event->object; if($field->name == "body"){ $page = $this->modules->ProcessPageEdit->getPage(); $oldValue = $page->get("$field->name"); $newValue = $field->value; echo "old value: " . $oldValue; echo "new value: " . $newValue; if($newValue !== $oldValue){ $field->value = $oldValue; $field->error("Go away!"); } } } For a error message you simply add error("text") to the field. It will get showed after saving. What this examples also shows nicely is how to get the old value and new value. The code may slightly varies for different type of fields but the principle is always the same. There's also a method to hook into Pages::saveReady() but I'm not sure what the advanced really are atm.1 point