WordPress Hack: Users Choose Their Own Password
I've been using WordPress for a couple of years, and have intended to learn how to make plugins properly for just about as long. I'm not quite there yet though, since whenever anything comes along which requires some form of thought and understanding, I convince myself that it doesn't really need to be done at all and discard the idea. I can, however, spend 10 minutes editing a few php files and that's what this hack involves. In the coming days and weeks, I intend to have a real attempt at making a WordPress plugin properly, so I'll try to make a couple of simple ones and see if it is possible to implement the below hack as a plugin.
When someone registers on a WordPress site, they ordinarily have to enter a username and e-mail address, then WordPress generates a password and e-mails it to them. This hack allows the user to choose their own password when they register, rather than changing it later. Of course, this means that they don't have to give a valid e-mail address anymore, since they needed one to receive their password. In addition, some may argue that letting users choose their own password is a security flaw, but if they can change their password anyway then I don't see how that is so different, and it doesn't really concern me anyway since I'm the only one who will have access to post on this blog.
When I wanted to do this, I Googled but all I found was an out of date file following from a discussion on the WordPress forums. My attempt involves editing wp-login.php directly, basically copying lines from some other files which dealt with the user changing their password. Since this involves editing a core WordPress file, it is probably not a good idea and could cause problems, but it does the job for me. Also, whenever you upgrade WordPress, wp-login.php will be overwritten, and you'll have to make the changes again. The changes described are for WordPress 2.2.
Read more...
Categories: Wordpress Tags:
My Experiences Of Moving from Movable Type to WordPress 2.0
Until recently, I'd been using Movable Type to operate a music news website, however I'd installed WordPress 2.0 elsewhere and had it impressed me with how pleasant and satisfying it is to use. What also impressed me was the WordPress theme, k2, which is by the same designer as the infamous (and now WordPress default) Kubrick theme. Although still in beta, k2 is clean and functional; it is lovely to look at and to use.
So I'd made up my mind - I was going to "upgrade" that site from Movable Type 3.2 to WordPress 2.0 (and I intend to do the same with a couple of other websites I had operating on that MT installation. Google led me to a page in the WordPress documentation: Importing from Movable Type to WordPress, which looked like it would tell me exactly what I needed to know in the form of a step-by-step guide. By reading that, I learnt that the biggest issue when converting is that of trying to preserve the permanent links, since WordPress and MT each use slightly different structures.
I followed the guide through the exporting from MT stages and had no problems doing so. When I reached the section on importing the entries to WordPress, I noticed that the guide was significantly out of date. It gives instructions to upload the text file of exported entries which MT generates to your server using FTP, then edit and manually navigate a file called import-mt.php. I'm using WordPress 2.0 and I couldn't find this file where it was supposed to be. Instead I found that the process had been improved vastly since that guide was written.
Once you save the textfile of exported entries generated by MT, you can login to the Site Admin section of your WordPress blog and you will find that the rightmost item in the main menu is entitled Import. Clicking on that leads to a screen with various choices of file to import, which includes Movable Type. Then you are asked to choose the text file that MT generated using a file input box. A little CHMODing and some options about the import later, I had the articles in my blog and I was ready to set up the redirection of the old articles to their new WordPress locations.
For this I used Alex King's solution as suggested by the WordPress Guide: Movable Type template for individual entries, which provides templates for Movable Type which simply work out what the new URL will be and redirect the user accordingly. This worked almost perfectly for the individual articles, but that's all it handles.
It was then that I noticed the first major problem: I could no longer log into the WordPress Site Admin section, infact I couldn't recover my password either! When importing articles, WordPress had prompted me to enter author names or to select a user on this blog to assign the articles to. I wanted them to be assigned to me and there were two seperate selection boxes so I selected my admin username from the drop down menus in both and assumed that all would work ok. What actually happened was that WordPress then seemed to create another user with the username admin, but no email address or other details assigned. I was locked out!
My solution to that problem was to manually edit the database, using phpMyAdmin provided by my web host, and delete the extra admin. That didn't fix my problem so after a minute or two of panicking I decided to login to the FTP and clear the contents of the WordPress cache folder: /wp-content/cache and from that point it was working properly. I dont think that this extra user was because of a WordPress bug but instead by something I'd done (maybe I can blame poor usability for that though).
Another issue I came across was that of setting up redirects for things which Alex King's individual entry templates did not cover. And I failed trying to do this but I have no idea why.
mod_rewrite has always been a strange beast to me. I have, once or twice, managed to tame it but 99% of the time I can't, and this was one of those times - even though I was copying and pasting code from the WordPress site. I was trying to set up a redirect to point users asking for Movable Type's RSS feeds towards the new WordPress ones, but for some reason nothing I did would work properly and I always ended up with a WordPress 404 page. I gave up on this one; it was not a big blog, and the majority of my readers wouldn't know what RSS so it's not of particular importance. There are also other URLs which weren't set up to redirect, for example the MT category and date archives, though again I decided that they weren't important enough to try and fail to establish redirects myself.
The last "problem" that I had was that none of the old comments on my articles were present in WordPress after converting. There were only four of these though and two were spam so again, not a problem for me.
If you're reading this article thinking "Will I bother converting to WordPress?" then I'd say, definately, to go for it. WordPress is an excellent application and will soon make up for any issues encountered with the transition. A lot of the problems that I had were perhaps my fault, but they didn't effect me because the blog in question isn't a very popular or particularly large blog, so I was able to disregard many issues. If that doesn't sound like your blog, then I'd suggest you read the documentation a lot more thoroughly and take your time at every step to ensure that it's done right.
As I mentioned above, I also plan to convert a couple of other MT powered websites to WordPress so I'll report back if the experience is any better - or worse - the second time around.
Update: 24 Jan 2006 - Moving another blog
I've just managed to move another blog from Movable Type to WordPress and it went much better than the last time. There was no problem with an extra admin user being added, and I figured out how to redirect the feeds from the Movable Type blog to the WordPress one using .htaccess. The only problem this time is that the comments still don't appear to have imported correctly - even though the list of imported posts mentioned comments next to the post names.
Categories: Wordpress Tags: