-
Posts
4,054 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
It should be a matter of a few hours once you've had a look at the tutorials by the sounds of it. The good thing about ProcessWire is that once you get things set up each template will be super easy for editors to add pages to.
-
Thanks - always learning something new with ProcessWire!
-
I've not used much non-open source software and haven't used EE, but even those revised prices look silly to me - but hey, I'm used to free or cheap software What's the turnaround time on a support ticket from EE, or is there actually an option to call someone on the phone directly within that price (and if there is has anyone called it if so to see if someone is there)? I'd say that ProcessWire's free support is worth more than a lot of paid support options with other software packages. With support tickets from various web hosts for example I'm used to 15-30 minute response times, forum software is more like 24 hours (but it's cheap, so you're not paying for premium support), but you'll usually get a response here on the forums with ProcessWire within an hour, maybe 2, and quite often with chunks of useful code supplied which I would rate at more useful than the extortionate price of $3588 for "guaranteed first response in 4 business hours" which sounds like it could just be an acknowledgement of your initial request if I put my skeptical hat on for a minute - but again I don't know about EE or the company behind it. I know many business customers would like a paid support option for ProcessWire but I think that's something for ryan to weigh in on. For some random form of not-really-comparison, with a hundreds-of-thousands-of-pounds server solution from HP, the guaranteed 4 hour response time costs around £15k. That's actually nearly equivalent to the $23998 for the 4 hour guaranteed response time from Ellislab. Their product does not cost hundreds of thousands of pounds and is not as complicated as a reasonably high level server solution so there is something wrong with that figure to my mind. (P.S. I'm not affiliated with ProcessWire myself - I just look after the forums and make module occasionally )
-
And here's some additional code in case anyone might need to do something similar: It basically runs in a module if the user is logged into the forums already and they're now viewing the site and are marked as either banned or a spammer in the forum software, plus they have a user account in PW (that's all the boring code I didn't include below). $count = 0; $count += wire('pages')->find("authors=" . $u . ", include=all")->count(); $count += wire('pages')->find("dm_owner=" . $u . ", include=all")->count(); $count += wire('pages')->find("created_users_id|modified_users_id=$u")->count(); if ($count == 0) { $this->session->logout(); wire('pages')->delete($u); // Delete as we cannot trash a user } It simply counts 2 fields with Page fieldtype to see if thecurrent user is linked to any content via those fields, as well as checking to see if they've ever created or modified a page. If the count is zero, the user can be deleted, otherwise we must leave it in place to prevent things from breaking. It would be interesting to see if there's a way to find all fields that could link to a user - basically any Page fields I think as users are just pages like everything else - and iterate through them instead of the manual way I've done it for the fields above. That would certainly future-proof the code a bit and I'm sure it's possible, but I don't have the mental capacity to tackle that right now
-
I've been dealing with how to programatically delete a user account. Oddly, ProcessWire throws an error when you try and put them in the trash - whether you do this through the admin interface or via the API you can't trash users it seems. Deleting them via the API works fine doing something like this in my module: wire('pages')->delete($u); So is there any reason why you can't easily delete a user? I'm guessing it's because there will be a chance that anyone with a user account in ProcessWire would normally have written at least one page, so in this case I guess deleting a user will break ProcessWire somehow...? In my case it's more forum software integration so I want to have it delete user accounts that are spammers or banned (there's a simple way to check this in the forum software) and delete their corresponding user account in ProcessWire as long as they're not linked to any content - uploaded a file or written an article in this case. I guess I should check to see if they've ever created or modified a page as this could break the site too. I think I may have answered my own question, but if someone could confirm it that would be great
-
Oddly enough I had a similar issue yesterday upgrading from quite an old version to the latest in the dev branch - my error message was "cannot redeclare SessionHandler, sessionhandler is already defined" or something like that - can#t remember what it was exactly. Emptied the cache a few times and no joy, re-uploaded the wire folder and no luck either. Deleted the existing wire folder and uploading it again worked though. Weird!
-
Happy New Year. I'm going back to bed in a bit... the website won't stop spinning!
-
The module diogo linked to does just that with these few lines: $this->config->scripts->add($this->config->urls->ProcessCropImage . "ProcessCropImage2.js"); $this->config->styles->add($this->config->urls->ProcessCropImage . "ProcessCropImage2.css"); $this->config->scripts->add($this->config->urls->ProcessCropImage . "Jcrop/js/jquery.Jcrop.min.js"); $this->config->styles->add($this->config->urls->ProcessCropImage . "Jcrop/css/jquery.Jcrop.css"); The $this->config->scripts/styles->add basicall ensures that the following file is added to the admin template. As you can see, in the above example, you can get the URL to the module folder itself really easily by using the module name -no need to put stuff directly into the admin template if you're creating a module
-
Oh my word The poor thing!
-
Without actually installing it, what does this profile actually have by default?
-
Cheers for the info - wasn't aware of the cache time clause, but I was thinking of having it update details (prices, discounts, availability etc) at least every 24 hours so that should be fine. I've not got a pro merchant account but that's useful to know - historically Amazon has been one of those sites I'd love to interact with but they've not made it easy unless you're a rocket scientist until now
-
I've dabbled with fetching data from Amazon over the years, but they make it so hard that the few times I've achieved some integration it's been a matter of months before it broke. Part of the problem is that nobody was keeping any of the PHP classes (3rd party, not Amazon) up to date so that put me off. This chap however seems to be doing a marvellous job: https://github.com/Exeu/Amazon-ECS-PHP-Library - demo here: http://amazonecs.pixel-web.org/ I'm actually quite excited about the possibility of looking up products, saving the details locally in ProcessWire (not that you need to, but some sort of local catalogue is always nice and you can have it update prices etc. once or twice a day) and making some money on otherwise not-for-profit sites I've had running around in my head for years now. Interesting stuff!
-
Not had any problems with Servint, plus they have an Amsterdam datacentre now as well for us European folks. Used LiquidWeb and then StormOnDemand (by Liquidweb, but cloud hosting) when the site that was hosted on the normal hosting there got a bit big. Being able to scale resources using Storm is a nice touch - had a few popular weeks on one site in particular and was able to just increase the CPU and RAM in a short space of time and, whilst you pay extra (to the end of the month on the higher resources I think) if you scale it back after your busy period you only pay for the time you used it at the higher resources - they basically sort it out over the next bill or two depending on what you used. The only issue with StormOnDemand is a recent issue whereby mod_seurity got upgraded and wiped out all of my rules. Since these rules were from years ago, it was a pain making it so every script worked again (fortunately it's only forum software, MediaWiki and ProcessWire, but it was still a few days of 404 errors when editing certain things). I think ServInt uses some other system entirely for handling attacks - some firewall that they've got set up - so I wouldn't have faced that particular problem with ServInt, but all that aside, I've not had any other problems with LiquidWeb at all over the last 5+ years. Stellar support at both companies so take your pick
-
Lemonstand optionally uses Twig (PHP by default like PW but nowhere near as simple as PW ) and from what I saw it looks pretty straightforward so that would be the one I'd go for. That's my limited experience/input
-
Soma I believe something was fixed recently in this area so you're not going crazy
-
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).
-
Nice one diogo - there's usually a simple answer and I might do this on a few sites myself
-
Ooh, that looks nasty. Can you let us know your PHP and mySQL versions please?
-
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
-
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)
-
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!
-
Thanks guys - funny thing is I remember reading that a while back!
-
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?
-
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 )
-
How to automatically create a bunch of child pages when saving?
Pete replied to titanium's topic in Module/Plugin Development
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.