Vote Up! Vote Down!

In general, WordPress and Automattic do a horrible job of comunicating the difference between WordPress.com and WordPress.org and how they interact. However, here’s a great answer by happiness engineer Jeremy Herve when asked the following:

“I don’t fully understand the differences between follower vs. users vs. subscribers.”

  • Jetpack Followers, also called Jetpack subscribers receive email notifications about each new blog post from your site. You can follow the instructions here to see your list of Jetpack subscribers. Readers have different ways to become Jetpack subscribers:
    • They can use the Subscription widget in your sidebar (first option in your list).
    • Whenever someone leaves a comment on your site, they can subscribe to your blog by checking the option ” Notify me of new posts by email.”
    • A WordPress.com user can start following your site right from their WordPress.com home page, here: http://wordpress.com/#!/read/edit/
  • Registered Users are people who used this form to register to your site. When they do so, they gain access to your site’s dashboard, and will appear under Users > All Users in your dashboard. They will not receive notification emails when you publish a new post. If you do not offer any specific features to registered users, I would suggest that you disable registrations on your site, by going to Settings > General in your dashboard.
  • Comment subscribers are people who chose to subscribe to a specific post; they will receive a notification email each time someone comments on that post. You can subscribe to a specific post by checking the “Notify me of follow-up comments by email.” option when leaving a comment under a post.

Your site proposes one more Follow option (number 2 in your list), thanks to a plugin named “Follow“. SInce you already use Jetpack, I would suggest that you remove this plugin, and use another plugin instead, named “Follow Button for Jetpack“.

Excellent reply!

The original is found here:

http://wordpress.org/support/topic/jetpack-subscription-and-followers-vs-users-vs-subscribers

  Vote Up! Vote Down!

Develop WP by adding just the /themes and /plugins folders to your repository. We’ll use symlinks to connect these folders to a WP local dev install on an Apple MacBookPro.

A. Set up your local box.

1. Create a site locally using DesktopServer, well call it project.dev

2. Install Tower

 B. Set up your Git repository

1. Set Up a beanstalkapp.com Account

2. Create a repository on Beanstalk, we’ll call it “projectname”

3. Clone it to local into a repository folder ~/Documents/Repo/projectname/

4. Copy your production themes and plugins folders into the new  ~/Documents/Repo/projectname/ folder. When you finish copying you should have your projectname folder with two folders underneath.

~/Documents/Repo/projectname/plugins

~/Documents/Repo/projectname/themes

5. Commit and push this up to your repository.

C. Connect the Repo to your local dev instance of WordPress

1. Go to the wp-content folder for you new project.dev and delete the plugins and themes folders. Don’t be alarmed. We’ll connect them to the repo versions via symlink.

2. Open the Terminal program.

3. Go to the wp-content folder and

ln -s ~/Documents/Repo/projectname/plugins/ ./plugins
ln -s ~/Documents/Repo/projectname/themes/ ./themes

4. If you’re using the MyCred Plugin add this into your wp-config.php

/** This is staging */
define('WP_STAGE', 'true');

That’s it! Except I must give a big shout out to Alex Vasquez (What! What!) for giving me an intro to Tower at WordCamp LA.

  Vote Up! Vote Down!

1. Desktop Server

2. Create site: tt.dev

- make it a NON-WP site

3. FTP files to Documents/Websites/tt.dev folder

4. Export DB

5. Import DB to 127.0.0.1

6. Create User

7. Change wp-config.php to your new DB, DBUser, PW

8. Change bb-config.php if your site has one (BuddyPress)

9. Add searchreplacedb2.php to the root of tt.dev and replace http://yoursitename.com with http://tt.dev

10. Log into the Admin ( http://tt.dev/wp-login.php ) and save the permalinks. Go to Settings, Permalinks and click “Save” to do this.

11. Develop on your own local version of the site!

Note: If you’ve done it correctly, the site will look and operate like your production site. To avoid confusion, I normally change the site title and background color on the local site.

Extra credit: commit the local site to a Git Repository like Beanstalk and us Git (or a Git App like Tower) to branch, make your changes, then deploy them in a controlled manner to the live site.

 

  Vote Up! Vote Down!
  Vote Up! Vote Down!

If you’ve tried to run a javascript function within WordPress you may have run into this issue. You grab the script, something that starts with a ‘script’ statement and then a shorthand function like:

$(function(){
...
});

and you drop it into your plugin or template file and… nothing. Or more correctly, JavaScript errors that the ‘$’ is not recognized. Very frustrating.

Here’s what’s going on.

No Conflicts, man

This is a syntax issue, the jQuery library included with WordPress loads in “no conflict” mode. This is to prevent compatibility problems with other javascript libraries that WordPress can load. In “no-confict” mode, the $ shortcut is not available and the standard and slightly longer “jQuery(document).ready(function ($) {” construct is used instead of “$(function() {“, i.e.

jQuery(document).ready(function ($) {
... your code here ... ending with });

So, replace the

$(function(){

line with

jQuery(document).ready(function ($) {

and you’ll be running your JavaScript and on to the next issue!

Thanks to the RedEyedMonster for this description on stackoverflow.

Note: I blame Perl programmers for all errors resulting from shortcut functions and all problems resulting from shortcuts of any kind.

  Vote Up! Vote Down!

Here’s how to save a click for your readers by automatically redirecting to the post if only one result is found.

Just paste the following into your functions.php:

add_action('template_redirect', 'redirect_single_post');
function redirect_single_post() {
    if (is_search()) {
        global $wp_query;
        if ($wp_query->post_count == 1) {
            wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
        }
    }
}

Hat tip to WPSearchEngine

  Vote Up! Vote Down!

Backup Gmail Using Getmail

Getmail is an open source Python program that can backup your Gmail account. Getmail will work on any *nix system, including OS X, and even Windows as long as you have Cygwin installed.

 

Installing Getmail

Ubuntu users have it easy, since Getmail is in the Ubuntu repositories.

For other operating systems, you can either add the repository to aptitude or you can compile from the source like so:

Download Getmail, then open a terminal windows and type:

tar xzvf getmail*.tar.gz

cd [the directory it was unpacked into]

sudo python setup.py install

For Cygwin, you will probably first have to “rebase” your Cygwin installation. Briefly, that means closing Cygwin, opening cmd.exe and using it to run “dash” from C:\cygwin\bin, then typing “/bin/rebaseall” at the prompt it gives you. More on that here.

Setting Up Getmail

Now you just need a configuration file to tell Getmail how to connect to Gmail. There are a ton of sample configuration files on the Getmail site, but here’s one that works well with Gmail. Create a file at ~/.getmail/getmail.gmail and put the following text in it:

 

   [retriever]
   type = SimplePOP3SSLRetriever
   server = pop.gmail.com
   username = yourname@gmail.com
   password = yourpassword
   [destination]
   type = Mboxrd
   path = ~/gmail-archive/gmail-backup.mbox
   [options]
   verbose = 2
   message_log = ~/.getmail/gmail.log

 

Edit the yourname@gmail.com and yourpassword in the file to your specific values, of course. Note: this doesn’t have to be an @gmail.com address. If you are using Google for mail on a custom domain, just fill it in here.

Getmail won’t create the mbox file, so before we get started, create a new empty file called gmail-archive.mbox in the gmail-archive folder of your home directory (or where ever you choose to store it). From the command line this will do the trick: touch ~/gmail-archive/gmail-backup.mbox

 

Running Getmail

You have everything set up, so it’s time to actually make the backup. Fire up a terminal window and enter the following line:

getmail -r ~/.getmail/getmail.gmail

You should see a long string of messages begin printing out as Getmail starts grabbing the contents of your Gmail account. If the script stops, fear not — Google has some limits on how many messages can be retrieved at one time. Just run the above command again the Getmail will pick up where it left off. SeeGetmail’s documentation for more about this “cutoff” issue.

Now you have an mbox-formatted local backup of your Gmail account and you can access it with any e-mail client that understands mbox files, which is pretty much everything except Microsoft Outlook.

To automate this process, just create a shell script and attach it to a cron job that runs once a day or however often you feel is necessary.

  Vote Up! Vote Down!

On a vanilla BuddyPress install, the members page shows the Activity tab. For many communities the is great, but for the team site we’re building for booktrope.com the activity is not the main thing right now. I wanted to have the profile page show up as active when users go to the a member’s page. If you’re a coder and know your way around WordPress and BuddyPress the three steps can become one:

<?php

// force profile to show first on members page.

if ( ! defined( 'BP_DEFAULT_COMPONENT' ) ) define( 'BP_DEFAULT_COMPONENT', 'profile' );

BOOM! You know where to put that code and you’re off to the races.

If not, it’s just 2 more steps:

1. Create a bp-custom.php file in your plugins folder /wp-content/plugins and drop the skeleton code there.

2. Add the lines above to the file.

3. Save the file and reload a member’s page.

You should see the Profile tab show up as active from now on!

  Vote Up! Vote Down!

I was asked last week how best to develop a large redesign and update a WordPress site without destabilizing the live site. John Hawkins had described a great setup at Las Vegas WordCamp which I had adopted.

I added a few additional elements via a recommendation from John James Jacoby after seeing his setup at BuddyCamp in Vancouver, and my local dev setup was in great shape. I had the answer.

Below are the basic steps

  1. Download and install Desktop Server.
  2. Set up a .dev site locally.
  3. No Production Site? Go for it!
  4. On Production: MySQL Dump of your production database.
  5. On Production: Copy wp-content folder to your local (Local site is in the Documents/Websites folder with the name you gave the site).
  6. Delete Local MySQL tables ( http://127.0.0.1/phpmyandy.php )
  7. Import the production data.
  8.  Get a copy of searchreplacedb2.php (from here) and copy it into the root folder of your dev site.
  9. run devsite.dev/searchreplacedb2.php and use it to replace all occurrences of your production site name to the .dev site name. I.e., change mysite.com to mysite.dev via the script.
  10. Go for it! You may now work on your local box.
  11. I add one more element that allows me to have full syntax highlighting and reference, code tips, and trace running code via the NetBeans IDE, so I do the following: Download NetBeans for PHP and install it.
  12. Set up a project, set a break point on the code you’re changing and Press ‘Play’ on the IDE. You’ll be able to reference each line of code as it executes and see the value of all variables.

Full details on getting started in NetBeans will need to be a topic for another day.

  Vote Up! Vote Down!

The exquisite Timeline Verite .js framework has arrived as a plugin for WordPress. There is a plugin (find it here) but it doesn’t pull from my WordPress posts or RSS feed as I might have expected. The plugin expects a Google Drive Spreadsheet or JSON object to feed the ‘line. No need to despair, a quick and free hack will get your site content feeding the timeline automatically. Here’s how to set up Timeline with a WordPress blog to auto generate the ‘line.

1. Install the plugin. The plugin page is here.

2. Create a Google Spreadsheet from the timeline template, here.

3. Follow the instruction to publish the spreadsheet to the web and use the link as you build the shortcode. Keep the sample data in place for a few minutes so you can  test the timeline and have something to display.

4. Create a new Post in your blog and insert the timeline by clicking the ‘T’ above the post edit area. Save it.

5. Test the timeline page you’ve just created. (Note: if the page doesn’t display, you can add an iframe from the generator instead of using the shortcode.)

6. Now, here’s the trick. Sign up for If This Then That and activate a WordPress and a Google Drive channel.

7. Create a recipe to watch for WordPress posts and add a line to the Google spreadsheet based on this one I built for Booktrope.com.
(Note the recipe watches for “any new post” on the site and takes the Date, Title, Content, and 1st Image and adds it to the Google Drive Spreadsheet specified in the recipe.)

8. Finally, create a new post in your blog. Be sure to insert an image IN THE POST as the IFTTT.com WordPress channel doesn’t pick up the featured image, it looks for the 1st imbedded image in the body of the post.

9. Now, just wait about 10 minutes and IFTTT.com should kick in and append your a new line to the Google Spreadsheet which Timeline will see and you’ll have a new datapoint on your timeline.

10. Now you can go back and delete the sample data and replace it with your previous posts to fill out the timeline.

Once you get the historical data entered into the spreadsheet, you’ll be set. From then on, IFTTT.com and our sweet new recipe will add to your timeline automatically as you post.