Archive

Archive for the ‘WordPress’ Category

WordPress 3.8 – update plugins prompting for FTP Login

December 20th, 2013 6 comments

The Problem

After upgrading to WordPress 3.8, trying to update plugins fails with the prompt for FTP login credentials.

The error message reads:

“To perform the requested action, WordPress needs to access to your web server. Please enter your FTP credentials to proceed.?

The solution

After reading many pages about the issue everyone says it is down to security on the file system or the user who owns files on the file system not matching the user running the WordPress site.

So I attempted to edit an existing plugin by changing a version number from 1.3.0 to 1.3.1 and saving the plugin. This saved and the plugin UI updated with the new version number so this proved that security was not the issue.

In my wp-config.php file I have the following defined:

define ('FS_METHOD', 'direct');

This tells WordPress that I wish to force the “direct” method of plugin updates.

The problem is found in .\wp-admin\includes\file.php

The method in question that is causing all the problems is “get_filesystem_method”

I debugged through this method and it gets all the way to the bottom and $method = ‘direct’

The final line of this method is:

return apply_filters('filesystem_method', $method, $args);

I changed this to:

//return apply_filters('filesystem_method', $method, $args);
echo($method . '<br/>');
$method = apply_filters('filesystem_method', $method, $args);
echo($method . '<br/>');
return $method;

When you try to update a plugin you will see the “echo” statements printed out on-screen and it shows that $method is being changed from ‘direct’ to ‘ftpext’, by the apply filters method.

To fix the problem change the return statement of ‘get_filesystem_method’ as follows:

//return apply_filters('filesystem_method', $method, $args);
return $method;

Now you are forcing ‘get_filesystem_method’ to return ‘direct’, and when I attempt an update a plugin it works.

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)

Categories: WordPress Tags:

JetPack Post Statistics Link Plug-in

January 25th, 2012 No comments

You may have noticed that the jetpack plugin provides you with some great statistics on the hits to your website.

It also allows you to drill down on the statistics for each post, with one problem…

If your post does not appear in the top 10 results for the day then you have no way to see the statistics.

That is where the “JetPack Post Statistics Link Plug-in” comes in.

The plug-in provides an extra column on your Posts admin page and provides a link to the statistics for each post.

To download a copy go to my main website.. >> Download Link <<

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Categories: Free Software, WordPress Tags:

How to move wordpress.com site to a sub domain hosted on IIS – Tips and tricks

November 9th, 2011 No comments

I have recently moved my free wordpress.com blog (the one that you are reading) to my own domain.

If you read the contents on this site I hope you think I am reasonably technically savvy, but the feat of moving my site and redirecting the WordPress.com links was problematic and it took me a few days and many wrong turns to get it done.

I found that most instructions are based on apache/linux hosted solutions and I had issues using my IIS/Windows based host. My windows based host uses Plesk 10 (@ the time of writing).

Before you even begin to touch a computer there are a few things you have to think of first!

1. Root site or sub-domain?

Is this the only thing that you will have on your domain or are you going to have something else hosted on http://www.yourdomain.com? You need to answer this now as when you go to buy your domain mapping from wordpress.com you can only map a whole domain. So you would be better off hosting it @ http://blog.yourdomain.com, leaving the www for other things.

I started by creating my wordpress site with a click once install under a sub-directory in my httpdocs folder (main root web folder on my host), so I had my wordpress site setup @ http://www.homedev.com.au/ntsblog but as you can’t register a sub directory I had to start again.

So in my case I went and created a new sub-domain, http://ntsblog.homedev.com.au, and now I could register the sub-domain with my wordpress.com site.

2. Permalinks!!!!

Before you go any further you need to consider permalinks.

The issue

WordPress.com by default uses links that are styled as “Pretty Links” and default to a format of /%year%/%monthnum%/%day%/%postname%/” which means a posts will appear as http://blog.yourdomain.com/2011/11/31/post_title

The problem is that with version 3.2.1 of wordpress on a Windows host the “Pretty Link” is not supported by default and most “Permalinks” contain “index.php” in the path. see image..

Why is this a problem? Consider the link to your wordpress.com article that gets returned in a google search. When you try and do the domain mapping from wordpress.com to your domain, google will pass through a URL that your hosted wordpress site cannot handle.

This article discusses the various ways of mapping pretty links, and the section you are taken to is specifically for IIS/Windows systems.

http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite

My hosting provider already had a copy of Microsoft “URL Rewrite Module”, so I created a web.config file as per the suggestion in this article and applied it to my site but it would not work.

Assume the URL was
http://ntsblog.homedev.com.au/2011/11/09/how-to-move-wordpress-com-site/

The URL re-writer would try to go to:

http://ntsblog.homedev.com.au/2011/11/09/how-to-move-wordpress-com-site/index.php/2011/11/09/how-to-move-wordpress-com-site/

In the end I did a little bit of tweaking and came up with the following solution…

web.config

Put this is the root directory of your wordpress site.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
	<rewrite>
		<rules>
			<rule name="Main Rule" stopProcessing="true">
				<match url=".*" />
				<conditions logicalGrouping="MatchAll">
					<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
					<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
				</conditions>
				<action type="Rewrite" url="redirect.php?path={R:0}" />
			</rule>			
		</rules>
	</rewrite>
  </system.webServer>
</configuration>

If you look at the “Action Type” link this is re-writing the url to go to a page called “redirect.php” passing in a parameter of the relative path. So we now need to create the “redirect.php” page.

redirect.php

Again, create this file in the root of you wordpress site.

<?php

	$relative_url = $_GET['path'];
	$new_relative_url = 'index.php/'. $relative_url;
	$hostname = $_SERVER['SERVER_NAME'];
	$new_url = 'http://' . $hostname . '/' . $new_relative_url;
	
	header("Location: " . $new_url)

?>

So what is this doing?
The URL re-writer matches the invalid URL and re-writes the url to “redirect.php”. This page then takes in the parameter, and rebuilds the full url to the site based upon inserting “index.php” in the chain. This works and also the “referrer” and “search engine” stats are not affected by the extra redirect.

To test this take an existing post on your new site, remove the index.php and paste that into a new browser window. The site should redirect to the index.php version. This means any link to your wordpress.com site will redirect to your new domain and be successfully passed along to the index.php page.

The only problem with this is that I don’t see how you could reverse the process and return to your wordpress.com site. The new articles will be found with index.php and if you try to go back to worpress.com as the primary domain the links with index.php will all break. Solution don’t go back. I will follow this up with wordpress and see if I can find a better solution.

Buy a domain from wordpress.com

Before you buy a domain read these wordpress articles about mapping domains or mapping sub-domains

Now seeing as I had created a sub-domain I went down the route of creating a CNAME entry. In plesk this means going to your DNSSettings and adding in a new CNAME. But being new to plesk I did not notice that when you make a DNS setting the settings shows with a warning like this
and right up on the top of the page you need to confirm the change by clicking Update.

So failing to notice that I handn’t saved the CNAME entry I gave up in frustration. So even though it told me not to I bought a domain and followed the full domain mapping instructions and it worked.

The instructions are fully mapped out in the mapping domains article but here are some extra tips.

  1. Go to your domain name provider site and find your name server settings, copy and paste them into a .txt document so you don’t forget them.
  2. With my name server provider, my names servers had a “Registrar Lock” on them. To update the ns1.wordpress.com, ns2.wordpress.com, ns3.wordpress.com, I had to
    1. Un-tick the checkbox and click save to clear the registrar lock.
    2. add the wordpress name servers and click save.
  3. now go to your wordress.com site and go to Store –> Domains.
  4. enter your domain, blog.yourdomain.com and click Add, follow the process to purchase the domain mapping
  5. Once registered, select your domain as the “Primary Domain” and click “Update Primary domain”
  6. Return to your name server and enter in the previous name server settings that you backed up to the text file.
  7. Re-enable the “Registrar Lock” if you have one.

Your wordpress site should now all be working.

What Plugins?

Now you’ve been using wordpress.com for a while and you probably have it configured how you like it, so how do you make your new site just like wordpress.com.
Most of the plugins on wordpress.com are special to wordpress.com, so I found it difficult to find and install the plugins to get the functionality I am used to.
So here is a mapping between functionality and the plugin you can freely download and install:

# wordpress.com Plugin Equivalent
1. Site Statistics Jetpack
2. Importer WordPress Imported
3. Ratings GD Star Rating

Other plugins I have found of interest;

  • Easy AdSense Lite
  • Google Analytics for WordPress
  • Preserve Code Formatting – keeps spaces and formatting when posting code snippets into your post.

Thats it for now.

Cheers
John

VN:F [1.9.22_1171]
Rating: 1.0/10 (1 vote cast)

Categories: Blogging, WordPress Tags: