Jump to content

adrian

PW-Moderators
  • Posts

    10,902
  • Joined

  • Last visited

  • Days Won

    349

Everything posted by adrian

  1. You should have a good read of this thread: https://processwire.com/talk/topic/992-problem-with-assetsfiles-folder/
  2. I know this is a post that Soma started on this topic, but I still think it is relevant to link to here since we got into talking about checking to see if a module is loaded or not: https://processwire.com/talk/topic/5477-check-if-a-module-is-loaded/
  3. If the allowable child template settings for the destination page tree allow it, then there should be no reason you can't move the page, so it sounds like that might be what's stopping you. What does the permission error say?
  4. Hey Ryan, Just a quick note about the new 1 step page adding. It seems to have some weird effects if you create the page via the API. Doing this: $p = new Page(); $p->template = "basic-page"; $p->parent = $pages->get("/about/"); $p->save(); resulted in two new pages which is weird: untitled untitled-4 and even weirder, this was on a fresh install so for one not sure why it jumped to 4 for the second one. The other problem is that because you need to save the page to create it at all via the API, the name is actually populated with "untitled" already, which means that if someone then goes to edit the title, it won't automatically set the name to match. If I add $p->status = 2561; to the above code then the new page is created with the new temporary status setting which is great - the name is not populated so things work as expected. The only problem now, is that there are still two new pages created. I know this feature was not really designed for API adding of pages, but I can still see people using it that way, unintentionally or maybe even intentionally. Another more important side effect I just discovered - if you create the page with no status setting, but with just a title (no name), like this: $p = new Page(); $p->template = "basic-page"; $p->parent = $pages->get("/about/"); $p->title = 'TestMe'; $p->save(); then two pages are still created. The titles are correct, but the names are: untitled-n. I think this could be quite problematic for some existing modules and chunks of template code that rely on automatic name generation from the title. If you set the name as well, then all is good again - one page created with everything named correctly. EDIT: OK, I am going to crawl back in my hole now - I was running these tests with Hanna Code's test functionality - I have been using it for a while now as an easy way to test code snippets. Turns out the double issue was all because of Hanna. I re-ran these tests using my Code Tester module (which I used to use all the time) and everything seems to work as expected. The $p->status = 2561; was still obviously key to making things work as expected though. Feel free to unlike this post now EDIT2: Actually, I think there is still one potential issue - I still seem to be having the issue that a newly created page that is assigned a title but not a name ends up with "untitled" as the name. Does anyone else see this?
  5. This is sounding even cooler now While you are on a roll, any thought about having an option to generate the name and the title from more than one other field. Like being able to concatenate first_name and last_name fields. I am thinking it would be great to be able to set the title to locked (visible but not editable) for the specific template. And once the page is saved, it (name and title) will be populated from the first_name and last_name fields. Would that be much more work?
  6. This is mostly stolen from Ryan: https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919 But it adds the functionality to redirect back to the page the user was on when they started the login: $requested_pid = (int) $input->get->pid; $t = $pages->get($requested_pid)->path; if($user->isLoggedin()){ if($requested_pid == ''){ $session->redirect('/'); } else{ $session->redirect($t); } } if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $tmp_pass = $u->tmp_pass; $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page if($tmp_pass == $pass){ $session->redirect('/profile/'); } else{ $session->redirect($t); } } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; echo " <h2>$headline</h2> <form action='./?pid=".$requested_pid."' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input class='bluebutton' type='submit' name='login' value='Login'> </form><hr /><br /> <p><a href='/reset-pass/'>Forgot Password?</a></p> "; Keep in mind that this also includes "forgot password" functionality, but doesn't include all the code for that - take a look at that post of Ryan's to get the rest.
  7. What is your username? If you log $username with both different sanitizer options, is it the same? Do you have debug set to true? Are there any other php errors? Anything in the PW assets/logs/errors.txt file?
  8. I am not sure why you are ending up with the numerical character reference in there. Does it appear that way in the HTML of the mail subject field, or not until it is actually sent? Are you using one of the new custom email modules, or the built-in one? Can you try to figure out exactly when it is being converted? When you view the source, are you seeing &#039; or just ' There are functions out there to decode NCRs, but it is overkill for your needs and also I think it would be better to figure out why/where it's happening in the first place. If you can't manage to figure out the cause and you're in a rush, you could just do a str_replace in your email script to put it back to a single quote.
  9. Is the page completely blank? It sounds like you have a PHP fatal error which is a code issue, rather than a login attempts issue. What happens if you remove that code you just added - can you login again, does the error go away?
  10. Isn't that what Joss linked to above: https://processwire.com/talk/topic/5869-forgotten-password-on-the-front-end/ There is also this solution which I use all the time: https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919 Hope that helps.
  11. I submitted a pull request for similar functionality. It copies the cropped images to a separate images field. I put this together very early in my experience with PW and I know that antti wanted an option to opt in or out of this feature which is why he hasn't accepted it. It would be easy to modify to make it optional, but perhaps you can make use of my code anyways: https://github.com/adrianbj/Thumbnails/commit/c3539ada4306acd7f98c667864aa5ebe1fd0a244
  12. I have used that PW comments reply version and it works quite nicely. Along with the comments manager module (http://modules.processwire.com/modules/process-latest-comments/) it works out to be pretty powerful. I guess the one thing we are missing is a comment rating/like system.
  13. CafePress or Zazzle might be lower risk than ordering ahead, but probably not as much profit?
  14. This is how I have done it in the past: "id!=2, id!=7, has_parent!=2, has_parent!=7, template!=admin, sort=id, include=all" Soma suggested (https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=44508): "has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all" Ryan suggested (https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=44782): "template!=admin, has_parent!=2, include=all" Those should help you with the getting of all pages. From there, getting pages fields is simple enough. Not sure about the memory usage issues - maybe you can test and see how it goes
  15. It's definitely getting closer to being ready diogo. To be honest I hadn't really thought about automatically capturing changes - I kinda thought that was already in the works here: https://processwire.com/talk/topic/2117-continuous-integration-of-field-and-template-changes/ PTM is structured so that everything that is exported is based on the content of a parent page - all the child pages, templates, fields, page field content pages, etc. So it is designed to migrate new blocks of content. It can certainly update changes to these blocks to a live server too though. I guess it might be possible to make what you are saying work by using "Home" as the parent page of the export, so changes to the entire site are migrated. The automatic recording of changes so that the JSON file only contains changes is obviously the tricky part I'll read through mindplay.dk's experience in detail and see what suggestions I can garner. Off the top of my head I am thinking that maybe a simple approach might work - use the module's config data field to store and add to an array of pages, fields, and templates that change, captured whenever they are saved. That way I am not trying to record exactly what all the changes are, but rather just that something changed and therefore we should add that page/field/template to the list of things that needs to be exported. I'll think about it some more!
  16. To clarify what WillyC is saying - there are DB tables that store the settings for template and fields. If you fire up something like PHPMyAdmin you should get the idea. The Page Tree Migrator (PTM) module that horst linked to is still in alpha, although I hope not for much longer. I just pushed a new update literally a couple of minutes ago that deals with some bugs that were introduced with a major new feature in the last version. I think PTMis very powerful and is a huge time saver when it comes to migrating fields, templates, and trees of new pages and their content. It should be able to solve your issue if you choose the correct settings (I have gone a little nuts on this?). It should allow you to export the new template structure (with the newly added fields) from your dev site and import them to the live site. The one thing I need to get this out of alpha is testers, but please do your testing first on two test PW installs. If it works as expected for your given scenario, then you should be good to use it on the live site.
  17. If I understand correctly, I don't really see how that make sense. Currently the Skyscrapers site has a parent page called Architects with a lot of child pages with just a title field which lists the names of all the architects. I am not sure how it would be easier to try to rename all of these to the names of the companies you need. It would be more logical and easier to just create the company pages from scratch. You could use Page Field Select Creator like we talked about in another post, or you could use the batcher module, or the CSV importer, or write a simple script like the following: $pagesToCreate = array('McDonalds','Nike','Apple','Google'); foreach ($pagesToCreate as $ptc){ $np = new Page(); $np->parent = $pages->get("/companies/"); $np->template = $this->templates->company; $np->title = $ptc; $np->of(false); $np->save(); }
  18. http://modules.processwire.com/modules/process-batcher/ https://processwire.com/talk/topic/5835-lister/ EDIT: was on mobile before. Batcher won't actually let you rename existing pages, but you can batch create pages easily. It will be possible with the upcoming Lister module though, or you could write some code to do it yourself - it's not that hard, but you do need to consider how you would batch rename - can you give an example of the format you might want, because you have to consider not just the title of the page, but also the name with determines the url of the page, unless you are talking about hidden pages (perhaps those that belong to a page field). I can't imagine you want page-1, page-2 etc. Do you have a schema in mind?
  19. I am guessing you mean the page field select creator: http://modules.processwire.com/modules/process-page-field-select-creator/ Based on a post in the forum thread for it, I guess you found it already though. But that module that SiNNuT linked to is also very cool
  20. Hi bwakad, Do you mean the name of the child template suffix? That is configurable in the module settings, but there is also no reason why you can't change the name of the template itself after creation - like any other template, go to the Advanced Tab > Rename Template. The parent page for the list of options (the child pages) is created on the fly - it matches the field name. If you are referring to the page selector called Parent Page - I don't think it makes sense to be able to create this on the fly - it can be the Home page, or a hidden options or tools, or selects page - somewhere where to store a whole range of pages that aren't part of the site tree. I would recommend filling out the fields in the module and you can see exactly what happens. You'll end up with a field (such as Province) that you can then add to your required template and the content for the select will automatically be linked to it. Try it out and then me know if you still have questions or suggestion for improvements.
  21. You have a good point about the head and foot inc files. It looks like Ryan used the text from the default PW profile which does use that approach. His Foundation profile however actually uses a different approach using _main.php Take a look at: https://github.com/ryancramerdesign/FoundationSiteProfile/blob/master/templates/_main.php Notice that this file contains the entire structure needed for an html page. The content from the PW pages is echoed in various places in this template. For example: <div id="bodycopy" class="large-8 columns" role="content"> <?php echo renderBreadcrumbs($page->parents); echo $body; ?> </div><!--/#bodycopy--> PW lets you work exactly how you want, which can be confusing for some users at first, but you'll come to appreciate it.
  22. Here's a bootstrap 3 profile from phillip: http://modules.processwire.com/modules/process-wire-bootstrap3/
  23. There are two profiles linked to and they are both in the first post of this thread. gebeer's is the one most similar to the Foundation 4 profile created by Ryan (basically exactly the same except that it is running on v5).
  24. This is a replacement profile for PW, rather than a module in the strict sense. Because you this, you must replace those folders before installing, just like it says in the Readme. Good luck.
  25. Bootstrap: http://modules.processwire.com/modules/bootstrap-admin-theme/ https://github.com/jsanglier/Bootwire-Starter-Profile Zurb Foundation: http://processwire.com/talk/topic/5293-zurb-foundation-5-profiles/
×
×
  • Create New...