Jump to content

Pete

Administrators
  • Posts

    4,032
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by Pete

  1. Soma I believe something was fixed recently in this area so you're not going crazy
  2. I know it's not the same thing as David was requesting, but there's also this module for scheduling publishing of pages in the future as well as optional unpublishing: http://modules.processwire.com/modules/schedule-pages/ I use this module on one site on the rare occasions I have lots of news and want to spread the articles out over the week. Just thought I'd mention it as if you were using some of the code the guys above have come up with you want to be careful to match your fieldnames with both modules (changing $page->publish_date in the above code to $page->publish_from would do the trick).
  3. Nice one diogo - there's usually a simple answer and I might do this on a few sites myself
  4. Ooh, that looks nasty. Can you let us know your PHP and mySQL versions please?
  5. Yep - I think a jQuery rating system (as Luis has linked to) as part of a module as ryan says would be great in the longer term and it would be easy to rate ANY content since it's all Pages and just a case of adding the functionality to each template Obviously it would need to take into consideration things like multiple votes from one IP address, flood control (set by session and/or cookie) so someone can't spoof different IP addresses and spam it but ultimately all the checks in the world won't stop someone from finding a way around multiple voting unless you require them to log in first - that's a bit much for most sites' needs though! In the meantime, this code looks great and does the job nicely
  6. Pete

    Member Map

    Gave it a go but it's broken and erroring quite a bit for the current version of the forum software - seems like it needs an update to work past version 3.2 (we're on 3.3.4 and v3.4 is also out now)
  7. Okay, so I did this using nik's example from the other thread and lumped it into a module I've got that interacts with the forum software used here, but for another site. If you're logged into the forums and then leave the forums to browse the site, it checks for a user account in PW with the forum member ID (this is stored in a field as an integer). If it finds one, it logs that user in - no real security issue as 99.9% of people will be a guest and you have to assume staff will be careful - otherwise it creates that user account with the guest role. There's also some other checking for user groups and whether the user has been marked as a spammer. This means that those picked out by the anti-spam measures during registration don't get added as a user on the site and I also added some checks in so that if they turned out to be a spammer later on that their account on the site is trashed as long as they haven't contributed to any pages on the site. Naturally there were a lot more things to check than I first thought, but I'm happy with the solution Now I've paved the way for members to upload and maintain their own files, bookmark useful pages and all sorts of things... but since this wasn't paid work I need to go off and do some of that now Still, it's always nice to have a go at something in ProcessWire every so often just to see how you get on - it's never a question of being able to do it as there's always a way!
  8. Thanks guys - funny thing is I remember reading that a while back!
  9. Ah, I see a possible solution by Apeisa here: http://modules.proce...facebook-login/ The solution there is to auto-generate the user, supply them with a random password on each session login. I think a possible solution for me is the above (random-assign passwords after authentication - nothing could be safer ) and then a custom login module for PW purely for logging into the admin area that checks the username and password against the forum database, sets the corresponding PW password to match and then continues login. If anyone is able to follow my rambling thoughts, does that sound like the most sensible course of action?
  10. Is there any way to log a user in programatically? On the site in question I have forums and the logins are controlled through the forum software. Currently I create a user in PW automatically if they don't have one (forum member ID never changes and is stored in PW against that user) but looking at the login functionality in PW there is no way to log a user in without their password. I know it's not good practice to do this anyway, but rather than create one global login form that logs them in in both places, I've got code to check if they're logged in in the forums and simply want to have them automatically logged in in PW like so: if ($page->forumMemberData['logged_in']) { // Fetch the user or create if they don't exist in PW $u = wire('pages')->get("template=user, user_member_id=" . $page->forumMemberData['member_id'] . ", include=all"); if (!$u->name) { $u = new User(); $u->name = $page->forumMemberData['name']; $u->user_name = $page->forumMemberData['name']; $u->user_member_id = $page->forumMemberData['member_id']; $u->addRole("guest"); $u->save(); } // LOG USER IN HERE } I guess technically I don't need to log them into PW at all and can simply create/retrieve their details above, but wouldn't it be better to actually have them logged in for log purposes etc? A side question that comes to mind - since I won't know their password with the above code, no password gets saved to the database as I haven't specified one. Is this a security issue waiting to happen if I elevate someone to a higher role? If it is I'll change the code to give them a random password (can't copy from the forum database as it's hashed!). (The reason I don't want to create a separate login form for both systems and capture their actual password that way is that the forum software allows for Facebook and Twitter logins too, so I can't get their passwords anyway in those cases - plus I don't want to reinvent the wheel )
  11. Welcome aboard If we assume that these will be the only four child pages then you could do this maybe (untested): if ($page->children()->count() > 0) { break; } else ... Or if there could be more child pages then the other way would be: $skipchildcreation = 0; foreach ($page->children as $child) { if (in_array($child->name, $titles) { $skipchildcreation = 1; } } this way you could use the variable $skipchildpagecreation to skip page creation or not - the important thing is you need to iterate through the child pages to determine the page titles. EDIT: I think there's a third way that is a bit like you're trying to do iterating through the $titles array (which looking at it now should work), but off the top of my head you could delete that foreach and do something like: if ($page->children('title=' . implode('|', $titles)) { ... the | symbol in selectors acts like an OR from an SQL query. One thing I've run into recently that I thought was just me is a selector bug in the Dev branch but I'm pretty sure that doesn't apply here anyway.
  12. Merry Christmas and a Happy New Year from sunny England!
  13. Pete

    ProcessWire on the web

    I like diogo's best so far for the simple reason it fits the theme of the new site and there's no confusion with the lettering.
  14. All the options for sorting new posts are on the left when you click the Latest Posts link at the top-right. By default, it lists them by topic that was replied to last and there is no way to change that. If you're missing some, make sure you have selected "Content I have not read" and not one of the other options. Be aware though that as soon as you view a topic it will disappear from this list whether you reply to it or not, and there is no option to mark content as unread again afterwards (but I am asking around the devs/modding community as this would certainly be useful!).
  15. My thinking was that a PDF of the book could be free, but since we're not even started on that idea yet it's not a concern at the moment
  16. Welcome Sunny It really is pretty easy to build these things in ProcessWire as onjegolders says so if you have a go at it based on the examples above and let us know if you get stuck there will almost certainly be someone here to help you out with advice and examples.
  17. I think ryan mentioned that he was working on an uber-cache type module that caches a static-content-only version of pages for high-traffic websites, but equally it could be nice to use this if there is an unexpected error I guess? As long as the admin is made aware that there was an issue and maybe the end-user gets a message about a page not being as bells-and-whistles as it could be but still showing them the content then that would be quite nice really.
  18. It's reduced Martijn to incomprehensible sentences!
  19. I think a better search module in the admin (no offence ryan, it does work as it is of course!) or at least an alternative could be implemented whereby you can select fields/templates/pages and do some really advanced things without getting overly techy with selectors. As a real-world business example, creating rules in certain versions of Outlook takes you through steps - not that this needs steps - of selecting your first criteria, then a second and so on. It would be neat to be able to chain criteria in a drop-down interface where you can have as many criteria as you like with one per row. For example with drop-downs and some AJAX (for subsequent drop-downs at that stage) you could achieve: 1) Template equals "blog-page" 2) and body contains "pasta" What I mean by this is that for users who aren't the web developer there could be an easier way to present searches in a way that reads exactly how it appears on screen. The two separate lines are for two criteria, but equally you could add 6 for a big site to drill down into some complex stuff. Just thinking that something human-readable (devs are super-human of course) will be better for the less techy content editor whilst devs should be aware of the selectors by the time they've built the site
  20. It was the name that had me stumped - couldn't remember what it was called but, as ever, it's a fitting title!
  21. I think Soma's new module that loads page editing in modal windows and keeps the page tree always in the background (you may not have seen it yet ryan as it's that brand new and I've lost the link already) covers a large part of this and I can see it fitting certain workflows and personal preferences nicely. I'm sure Soma will oblige by linking us to it
  22. ...but it can be painful to go back to after using various other tools But on a more serious note, ryan is right of course.
  23. Soma - off the top of my head you wouldn't want to do it with JS as you might only want particular drop downs to be non-click on the parent (confusing for the end-user I know, but I've seen it before!). I know it's not exactly best practise to mix and match what can and can't be clicked at the top-level of drop-downs, but people will want to be able to do it nontheless I guess one way to achieve this would be to add another field by default that's a simple tick-box that says something like "Simple Navigation Placeholder" or something that can appear on every page template by default, maybe in the Settings tab? That way it's a simple check for a tick in that box per-page when looping through the output. If not, and we assume that there is just a module setting to make all top-level drop-downs be non-click then that could just be a simple check for that setting in the module config and loop through. I've just realised what you mean with the JS as I'm typing this (d'oh) but I was still envisaging that behind the scenes Google could still see a URL to the top-level even if you're telling the browser for the end-user not to be able to click a top-level menu item, so I just wanted to suggest a few options you've likely already considered
  24. I well as far as I'm aware it shouldn't matter unless the form is doing something ridiculous, but it's partially up to the end user to have a look at any third party code they download if you're unsure. As with anything on the internet it's downloaded at your own risk. What I would say is that SQL injection attacks shouldn't exist in the usual way in ProcessWire because the modules never run queries directly - they use selectors and other functions available to the front-end templates too. As such it all runs through sanitisation routines in the core so that out of the box this is a much more secure system than many others, and modules have an extra level of security as a result of not running queries directly. That's not to say someone couldn't code something badly of course which was the purpose of my first paragraph in this post None of this means module authors should forget about validation, but what passes through the core functions is sanitised to at least prevent SQL injection (I'm sure Ryan will be able to step in and go into it in much more detail).
  25. I had thought of a similar scenario where this would be useful yesterday but can't remember it now. In other topics we've said to not bother with this as you can get all the correct info to show on the front-end by just adding a person to a team in one place and using selectors, but I think my scenario where this falls down was if one person is in charge of adding teams and only has those permissions and someone else is im charge of adding/editing team members and you want both to be able to see each others content im the relevant pages. The easiest way would be with a module that's coded so that an update in one field updates another field - relatively easy I think - but what I think would be even better is a module that extends the Page fieldtype so that you can specify other fields that the current field updates in the field config so it doesn't have to be hard-coded in a separate module. What do others think, assuming I made sense?
×
×
  • Create New...