Quick fix to get Simple Tags plugin working with WordPress 2.9+

Note: There’s a new version of Simple Tags that works with WP 2.9.1 so no need for this hack anymore.

If you’re using the Simple Tags plugin, you might be holding off on upgrading to WordPress 2.9.1 because this plugin is only Compatible up to: 2.8.

Well, turns out the plugin does actually seem to work with WP 2.9.x — but you have to make a quick edit to the plugin file itself. Now, normally i’m not a fan of hacking plugin files to get things working because your changes would be lost with each new release. But, in this case, i figured that when the author does decide to release an update, i would be ok with losing these changes because they would no longer be necessary anyway.

Note: if you’re not comfortable editing plugin files directly (although this edit is really easy), then maybe you should wait until the author releases an official update. Otherwise, i’ve included the bit of code here for reference.

To get Simple Tags working with WP 2.9+

1) Open simple-tags.php and find the line:

if ( strpos($wp_version, '2.7') !== false || strpos($wp_version, '2.8') !== false ) {

2) Change that to:

if ( strpos($wp_version, '2.7') !== false || strpos($wp_version, '2.8') !== false || strpos($wp_version, '2.9') !== false ) {

That’s right, it’s just a matter of adding the additional condition which allows WP version 2.9 to work.

As always, be sure to backup and test this fix on your own site before going live.

This fix was found / documented here:
- http://www.wordpress-fr.net/support/viewtopic.php?pid=173448#p173448
- http://www.herewithme.fr/simple-tags-et-wordpress-2-8#comment-34072

Setting up a Minimal Samba Server in Fedora Core 12

Goal:
Minimal FC12 Samba install with low RAM usage, high security, and least amount of configuration.

Why?
Quickly turn an older machine into a modern Fedora Core 12 file server compatible with linux and windows clients. Less software installed means less setup, less maintenance, less updates, and less chance of human error somewhere along the way. The theory here is, the system starts out relatively secure and (if kept up-to-date) should remains so over time.

Side Note:
There are definitely many other ways to go about setting up a Samba server, much of which depends on your networking environment and overall requirements / constraints. This article is meant more as a guide – my notes which describe the method i happen to use – so that if i have to, i can do it all again.

Assumptions:
- Comfortable with install and use of Fedora Core Linux OS (command line)
- Basic understanding of networking concepts (setting up a static IP)
- Some experience with editing the smb.conf file

Features:
- No GUI / Desktop Environment
- Low RAM usage: boots up @ ~80MB with smbd and nmbd running
- SELinux and iptables firewall enabled / configured for use with Samba
- Samba Security level = User

System Resources:
CPU: AMD @ 700MHz
RAM: 192MB

Steps Involved:

  1. Download and burn the Fedora-12-i386-DVD.iso file to dvd
  2. Boot from the disc and go through install process (with less that 200MB RAM it defaults to text mode install – you can also force a text mode install at the boot: prompt by typing: linux text)
  3. Once install is completed and system is rebooted, login as root
  4. Check that networking is up
    - type:
    ifconfig

    (see if you have an IP address)
    - type:

    dhclient eth0

    (to use dhcp for now)

  5. Bring the system up to date
    - type:
    yum check-update

    (to check for updates first)
    - type:

    yum update

    (say “yes” to install the updates)

  6. - type:

    yum list installed

    (to see a list of all installed packages)

  7. Check to see what package “groups” got installed by default
    - type:
    yum grouplist > grouplist.txt

    - type:

    cat grouplist.txt | more
  8. Remove any unwanted package groups
    - type:
    yum groupremove "Mail Server"
  9. Add the Samba package group
    - type:
    yum groupinstall "Windows File Server"
  10. Configure Samba by editing /etc/samba/smb.conf
    - Note, for Vista support (in the Global section) add:
    client NTLMv2 auth = yes

    - Note, to hide unreadable files like /lost+found/ (in the Global section) add:

    hide unreadable = yes

    - type:

    testparm

    (confirm output has no errors in it)

  11. Deal with SELinux security policies (see default smb.conf file for details)
    - type:
    setsebool -P samba_domain_controller on

    - type:

    setsebool -P samba_enable_home_dirs on

    - type:

    chcon -t samba_share_t /path-to-mounted-directories

    (remember to mount any/all directories first)
    - type:

    ls -ldZ /path-to-mounted-directories

    (to confirm it worked)
    - Note, for existing shares, to make sure this affects all files and folders recursively add:

    chcon -R -t samba_share_t /path-to-existing-mounted-directories

    - Note: to completely disable SELinux protection for smbd daemon (not recommended) type:

    setsebool -P smbd_disable_trans 1

    - Note: you can temporarily disable SELinux by putting it into permissive mode – type:

    getenforce

    to find out whether SELinux is in permissive [0], enforcing [1], or disabled [2] mode.
    - Note: to put SELinux into permissive mode (for testing purposes but not recommended) type:

    setenforce 0
  12. Add samba users
    - type:
    useradd john

    - type:

    smbpasswd -a john
  13. Configure the firewall to accept samba connections
    - type:
    system-config-firewall-tui

    (add an asterix next to the line: “Samba”)

  14. Configure the network to use static IP/netmask/gateway/DNS info
    - type:
    system-config-network-tui

    - select: [Edit a Device Params] and remove the asterix from the line: “Use DHCP”. then, and add static info

  15. Configure the network to use a static Hostname and DNS address (note: DNS settings may not be required)
    - type:
    system-config-network-tui

    - select: [Edit DNS configuration] then, and add static hostname and dns info

  16. Get the network, smb, and nmb to start automatically next time you reboot
    - type:
    chkconfig --level 3 network on

    - type:

    chkconfig --level 3 smb on

    - type:

    chkconfig --level 3 nmb on

    - type:

    chkconfig --list network

    (or smb, or nmb to confirm it worked. you can also leave out the servicename to see a list of all services)

Reboot.
Use another computer to check that everything went well.

Optionally:
1. Install NTFS support.
- type:

yum install ntfs-3g

2. Once it’s done downloading/installing, figure out which device it is (for me it was /dev/sde1) and mount it.
- type:

mount -t ntfs /dev/[your-usb-device] /media/

3. Deal with selinux and ntfs support
- type:

setsebool -P samba_share_fusefs 1

My Favorite Web-based Tools of 2009

After having recently wiped out my main workstation’s RAID array [see twitter link] – i wanted to compile a list of softwares/services i had picked up over the course of the year and couldn’t do without. These were going to be the first things i would need to reinstall after restoring everything else from an older backup. Fortunately, nearly all of my most recent data is stored online and thus, i didn’t lose any “important” information. I did however temporarily lose access to many of my newer web-based accounts, as well as bookmarked shortcuts to these accounts, that sort of thing. Basically, i had to deal with the hassle of downloading and reinstalling anything Firefox might have lost since my last backup.

Anyway, here are all the new webapps and firefox extensions i picked up (and “stuck” with me) over the course of the year:

Web-based Tools:

  • Twitter – Just started using it (less than 3 months ago), but obviously it’s a keeper.
  • Brizzly – Best web-based Twitter app i could find.
  • ReadItLater – One click bookmarks, online sync between browsers, delicious integration.
  • Su.pr – URL shortener of choice with Twitter and StumbleUpon intergration
  • Feedly – Next generation feed reader with Google Reader and Twitter inegration
  • Shareaholic – Social networking tool that integrates with tons of popular services including Su.pr, Del.icio.us, and Twitter.

Here’s some stuff i’ve been using for a while now and will continue to use – although technically all of these were restored from my older backup and i won’t be linking to or describing each of them at this time.

Web Apps:

  • Del.icio.us – Still my online bookmarking tool of choice.
  • Google Products – Gmail / Docs / Reader (and more but i don’t feel like going into detail here).

FireFox Extensions:

  • All-in-One Sidebar
  • Download Sort
  • Download Statusbar
  • Firebug
  • Link Evaluator
  • Live HTTP Headers
  • BookmarkDD
  • SEO for Firefox
  • Tab Kit
  • text/plain
  • Web Developer Toolbar
  • YSlow

Also, I was impressed by the decreasing number of desktop softwares i needed to reinstall.

Desktop Apps:

  • VMware player (win/linux)
  • Firefox (win)
  • 7zip (win)
  • unrar (linux)
  • Inkscape (linux)
  • gftp (linux)

That’s all i could think of at the moment. If i missed any important ones, i’ll probably just add them to the list. I’m sure there are many other great web-based tools out there. These are just the few i’ve been using. I wonder what new and cool webapps will be added to my arsenal in the coming year? In the meantime, feel free to use the comments below to let me know if you’re using a great webapp not mentioned here.

Testing Amazon Affiliate plugins for WordPress

There are so many amazon related plugins – as a result, my testing was pretty brief.

Some notes:

Amazon Associate Filter – nothing happens

Amazon Book Picture from ASIN – just creates images from ASIN , uses shortcodes

Amazon Carousel(*) – flash, uses shortcodes, cool, lots of options, easy to use

Amazon Context Links Ads – does nothing

Amazon Machine Tags – complicated, uses shortcodes, requires an AWS key

Amazon MP3 Clips widget(*) – cool, flash 9.0.45 or above required, shortcodes, lots of options

Amazon Niche Store(*) – shortcodes, lots of options, 10% of the time is plugin author’s Amazon affiliate ID, plugin author linkback, widget included

Amazon Product Ads(*) – widget only, displays 1 item only, self-optimizing (auto) setting

Amazon Reloaded for WordPress – adds setting to post page but ajax not working

Amazon Search – not working, error: MissingParameter / Signature, widget and shortcode links only

Amazon Showcase – Access Identifiers required (AWS keys?)

AmazonSimpleAdmin – Access Identifiers required (AWS keys?)

Amazon SmartLinks Widget – many widget, working pretty well, looks nice

Amazon Widgets Shortcodes(*) – cool, lots of shortcodes, adds section to post page, conflicts with Amazon Niche Store plugin resulting in no output, must know exact widget ID

Keral Patel Amazon WordPress Plugin – requires an amazon web services access key

(*) i liked, but needs further testing

Notes on Event and Calendar related WordPress plugins

Tried and tested some plugins over the last few weeks..
here, are my thoughts, brief and in no particular order:

Gigs Calendar (v0.4.6)
- issues with timestamps posted to the future (but not with filter turned on)
- no multi-day events
- post created automatically

GigPress (v1.4.9)
- lots of setting (maybe too many)

Events Manager (v2.0rc2)
- not creating “real” WP posts (with post IDs)
- all event posts are on same page (eg: domain.com/events?events_id=1)

Events Calendar (v6.5.2.1)
- simple / good
- fills in actual post content

Events (v2.1.1)
- not creating “real” WP posts (with post IDs)

Event Calendar (v3.1.4)
- just adds dates and times to the edit posts screen

Calendar (v1.2.2)
- buggy (widget seems broken)
- not creating “real” WP posts (with post IDs)

Keep in mind, i’ve only tested these specific versions of each plugin. So, newer versions might include significant improvements over previous versions. Also, don’t take my word for it.. test them all out for yourself ;)

How to increase the size of a VMware vmdk file formatted as linux lvm

VMware can run many cool operating systems on a single host computer. But, having run the software for an extended amount of time, i eventually always run out of space on my guest OSes. This happened a few times before, but it wasn’t until my VM really froze up on me that i figured it was time to look into extending or expanding the current virtual disk i had in use.

Have you ever tried increasing the size of a vmdk file / virtual hard disk ?
It’s not that easy.. and it’s kind of confusing.

So, once i finally figured out how to do it, i thought it would be useful to write it down so that i wouldn’t forget next time this happened. Here goes..

In my example i have:
- a Windows Vista host OS running a Fedora Core guest OS
- an 8GB vmdk file (formatted as Linux LVM – fedora fs) on the guest OS which i have backed up before attempting anything here !!!

I want to:
- increase the 8GB vmdk file to 16GB
- not lose any data saved on the vmdk file
- not move any data off/on the vmdk file

Follow these Steps:

  1. Download and Install: VMware Workstation for Windows (trial)
  2. Note the location of the VMware Workstation folder (after install) – in my case it’s “C:\Program Files\VMware\VMware Workstation”
  3. Open a Windows Command Prompt and navigate to the folder where your vmdk file resides and execute the following command:
    "C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x 16GB "Name of Your Virtual Disk File.vmdk"
    Ok, now you just made the disk twice as big but you can’t use the space yet because it’s inactive, unpartitioned, unformatted, and still utterly useless to us. (but not for long)
  4. Next, boot up the guest OS and log in as root. Verify that there is in fact a large amount of unallocated space/sectors by typing the command: fdisk -l
  5. Then we’ll partition and format the new portion of the disk. First select the disk: fdisk /dev/sda
  6. Type “n” at the fdisk menu to create a new partition
  7. Type “p” for primary partition, and then select the appropriate partition number, as well as first and last cylinders to set how large to make the new partition (defaults – ie: use all the free space – worked well for me here)
  8. Type “t” to change the partition’s system id, then type “8e” to switch it to Linux LVM
  9. Type “w” to write the table to disk and exit fdisk. You might get a warning about needing to reboot for changes to take effect – either way, reboot your guest OS just to be safe.
  10. Once rebooted, log in as root again and verify the new partition exists. Type “fdisk -l” to see a list of partitions. In my case, the new partition is: /dev/sda3
  11. Now comes the confusing part. We’re going to merge the new partition into the current Volume Group (which is just what fedora calls it’s own virtual disks that are made up of a bunch of virtual LVM partitions). So, first, to “create” the necessary “physical volume” from our newly created disk partition (/dev/sda3) first type: pvcreate /dev/sda3
  12. You need to find out the name of the Volume Group before you can extend it to include the newly created physical volume. Type: vgdisplay and look for the first line, “VG Name” – in this case it was VolGroup00 [thanks agm]
  13. Next, you need to extend the Volume Group to include the newly created physical volume. Type: vgextend VolGroup00 /dev/sda3
  14. Then, type: pvscan You should see the new partition (/1dev/sda3) in the list of partitions and the total should read approximately 16GB (the amount we set earlier). In my example, it said 15.75GB
  15. Now type: lvextend -L+8GB /dev/VolGroup00/LogVol00 to increase / extend the Logical Volume by 8GB (to a total of 16GB).
  16. Finally, to resize the filing system type: resize2fs /dev/VolGroup00/LogVol00

Now your fedora guest OS should have twice the amount of space and your VM should be running smoothly.
Repeat this process if / when the vmdk file gets filled up again and runs out of space ;)

WordPress Plugin – Notify Admin Only of WP Updates

Update: This plugin is tested and known to be working with WP 2.9.1

ok, with the release of WordPress 2.8.3 – if finally got around to upgrading my Notify Admin Only plugin to work with WP 2.8+

Download Plugin: Notify Admin Only v2.0

in case you’re not sure what this plugin actually does, well, it removes this text from the backend that says: “A new version of WordPress is available! Please notify the site administrator” – (see the images below).

great for admins who don’t want their many users to ever see the WordPress Update nag.

wp notifying the admin

anyway the new code is really simple: (thanks Lazzymonk)


< ?php
function stop_wpupdate() {
if ( current_user_can('manage_options') ) {
return;
} else {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_notices', 'stop_wpupdate', 1 );
?>

the old plugin is here and only works for WP 2.3 – 2.5 series.

Single unified login for multiple WordPress 2.8 installs in subdirectories using cookies

i used to have a single sign on working between several WordPress sites, one in the root directory, others in subdirectories, even a few installs that ran off of subdomains. basically, you could log in to one site and you’d be logged into all of these sites.

that was before the big upgrade of WP 2.5 -

that’s right, i’m sure many out there can remember the chaos that came with upgrading your WordPress blog beyond version 2.5. there was an entirely new backend to get used to, but there were also lots of small code changes that created compatibility issues in many plugins and themes. one of the major changes was the way WordPress was to handle cookies and authentication in general which was made to be more secure. as a result, coders were offered new methods of integrating logins but (at the time) there was little to no clear, accurate documentation detailing how to achieve this task.

i spent many hours last year (with WordPress 2.5 and 2.6), and then again earlier this year (with WordPress 2.7), and then again this weekend (with WordPress 2.8).. until i finally got it working with the help of a relatively new plugin and some new blog posts describing how others attempted this now seemingly daunting task.

anyway, i thought i’d share my notes as well as the steps i took to get this working with my setup. it’s currently being used on indyish.com to unify the various WordPress installs into one cohesive multi-user site.

Note: These steps assume you’ve already got your WordPress sites setup using a shared user database. So, you can log into any of your sites individually with the same credentials, see all the same users under “Users” > “Authors & Users” – but you want to get it so logging into one site automatically logs you into all of your sites.

Therefore, you have already added the following to the wp-config.php files for any of the sites other than the root site:


define('CUSTOM_USER_TABLE','wp_users'); // shared user db
define('CUSTOM_USER_META_TABLE','wp_usermeta'); // shared usermeta

  1. To start with, you’re going to need to download and install this plugin: root Cookie Path. Make sure to activate the plugin on all of the sites (the root site, as well as any subdirectory sites).
  2. Once all your sites are using a root cookie, you need to open up the wp-config.php files for any non-root sites (ie: subdirectory sites).
  3. Now here’s the trickier part… go to your root site (ie: yourdomain.com) and get the following info from your Global Options page: AUTH_SALT and LOGGED_IN_SALT. You can find the Global Options page for your WordPress install at: http://www.yourdomain.com/wp-admin/options.php (replace “yourdomain” with your actual domain)
  4. When you have these 2 values, you need to paste them into the wp-config.php files for every single non-root site you want to integrate. Use the following syntax:

    define('AUTH_SALT', 'some-crazy-wacky-random-long-string-of-characters');
    define('LOGGED_IN_SALT', 'some-crazy-wacky-random-long-string-of-characters');
  5. Then, you need to make sure all of your sites are using the same “secret keys”. Paste that info into the wp-config.php files for each of the non-root sites you want to integrate. You can get secret keys fresh from the WordPress API page if you haven’t already added them to your wp-config.php file. It should look something like this.

    define('AUTH_KEY', 'some-crazy-wacky-random-long-string-of-characters');
    define('SECURE_AUTH_KEY', 'some-crazy-wacky-random-long-string-of-characters');
    define('LOGGED_IN_KEY', 'some-crazy-wacky-random-long-string-of-characters');
    define('NONCE_KEY', 'some-crazy-wacky-random-long-string-of-characters');
  6. Finally, add this cookie information to the wp-config.php files for all your non-root sites:

    $baseurl = 'http://www.yourdomain.com'; // replace with the actual domain name for your root site
    $cookiehash = md5($baseurl);
    define('COOKIEHASH', $cookiehash);

    define ('AUTH_COOKIE', 'wordpress_'.COOKIEHASH);
    define ('SECURE_AUTH_COOKIE', 'wordpress_sec_'.COOKIEHASH);
    define ('LOGGED_IN_COOKIE','wordpress_logged_in_'.COOKIEHASH);
    define ('TEST_COOKIE', 'wordpress_test_cookie');

That should do it!

Note: Some people have gone ahead and modified the WordPress capabilities.php file in order to get a role assigned to newly registered users, but this step is optional and requires editing a core WordPress file (a change which wouldn’t persist from one upgrade to another). I prefer to just assign a role manually to any new user that needs access to one of the non-root sites. Or, you could find another trigger to use before calling the function that sets the new role. Still, if you want to go as far as modifying core WP files, here is the code used by Kiran: (but i haven’t tried it personally)

function _init_caps() {
global $wpdb;
// $this->cap_key = $wpdb->prefix . ‘capabilities’; /* original code */
$this->cap_key = ‘wp_capabilities’; /*modified code */
$this->caps = &$this->{$this->cap_key};
if ( ! is_array( $this->caps ) )
$this->caps = array();
$this->get_role_caps();
}

Finally, here are some resources i used to help me out (most recently):

Here are some other sites (for reference) which i used earlier on this year:

WP 2.3 Plugin – Per Post Creative Commons License

This plugin will add the ability to choose different Creative Commons licensing structures for different posts that you publish to your WordPress blog.

As far as i could tell, there are currently 2 other CC plugins for WordPress – wpLicense and cc-configurator – however both of them only let you set your license on a global level. That is, they let you pick one license for all your posts and pages throughout your entire site. I thought it might be useful if each WP user/author could choose between different CC licenses and be able to set them on a post-by-post basis. So, i modified the wpLicense plugin to do just that.

“The main purpose of this plugin is to give WP admins who run sites with multiple users/authors the option let these users/authors set specific CC licensing terms on a post by post basis.”

How it works:
It uses the CC api and the JsWidget to add a new section to the write/edit post page and then displays a small CC graphic/button and text on your published posts for all to see. The widget lets you choose the appropriate licensing structure and then your choice is automatically saved to a custom field the next time you click “Save and Continue Editing”, “Save”, or “Publish”. Then, it uses the CC api (details-license-uri-uri) to call some javascript that displays a small graphic/button and some text linking back to the definitions for the license you have chosen. Jquery was used to insert the new CC license section to the write/edit post pages as well as to open/close the new section. I also had to use Jquery to fix the tooltips for the JsWidget. Lastly, this plugin is optimized so that it will add only 1 DB query (the cc_js_result_uri) to each post that has set a CC license and stores it to a custom field for that given post – whereas the wpLicense plugin seemed to use 3 seperate db queries to set the global licencing for the site.

Screenshots:
Check out the plugin in action.
cc edit post viewcc view post license

Continue Reading »

Using Subversion with WordPress – Part 2: Maintaining Vendor Branches and Upgrading WP Core Files

This article assumes you have already read, “Using Subversion with WordPress – Part 1: Creating Vendor Branches and Integrating your Existing Code“. In short, you want to use Subversion to track/maintain local versions of both WordPress code and your own internal project code, side-by-side, all in the same svn repository.

In the previously mentioned article we used WordPress version 2.3.1 as our initial vendor drop. The following procedure illustrates how to use svn merge to quickly upgrade WordPress core files from version 2.3.1 to version 2.3.2 – without losing your local changes – but could be used as a general outline for upgrading any version of WordPress provided you followed the steps discussed in Part 1. Note: Backup your files and database before attempting any of this. Also, although not strictly required, the following steps assume you have some kind of shell access (like ssh) and a command line subversion client (like svn).

Maintaining Vendor Branches -
To perform this upgrade, we check out a copy of our current vendor branch (which contains our WP 2.3.1 source code), and replace that code with the new WP 2.3.2 source code. So, we simply copy the new files on top of existing files and directories. The goal here is to make our current directory contain only the new WP 2.3.2 code, and to ensure that all that code is under version control. I use the svn export command to grab the WP 2.3.2 source code – but downloading and extracting the WP files manually works just as well.

Continue Reading »