thingelstad

Jamie Thingelstad's personal website

Tag: WordPress (page 1 of 3)

Adding Email Mention Notification to WordPress P2

I’m using the P2 theme on a couple of websites, one of them is for the team minne✱ to help coordination and collaboration. P2 supports the ability to use a @user notation to mention other users on the site, but it doesn’t do anything other than highlight the user. This snippet of PHP added to the bottom of the P2 functions.php will send email notifications on those mentions. This isn’t heavily tested but it works well for me.

/**
 * Custom code added to P2 to enable email notifications
 * when a user is @mentioned in the site.
 *
 * Original at http://trepmal.com/2011/06/24/using-wordpress-multisite-p2-and-more/
 * and modified from there.
 */
add_action('publish_post','send_email_notification_once',9);
function send_email_notification_once($postID) {
	$post = get_post($postID);
	$author = get_userdata($post->post_author);
	global $p2;
	$mentions = $p2->components['mentions']->find_mentions($post->post_content);
	$permalink = get_permalink($postID);
	$blog_title = get_bloginfo('name');
	foreach ( $mentions as $match ) {
		$email = get_user_by('slug',$match)->user_email;
		$message = "You have been mentioned in this post:\n $permalink </p> {$post->post_content} ";
		wp_mail($email, "[$blog_title] You've been mentioned by {$author->display_name}", $message);
	}
}
 
add_action('comment_post','send_email_notification_once_comment',9);
function send_email_notification_once_comment($commentID){
	$comment = get_comment($commentID);
	global $p2;
	$mentions = $p2->components['mentions']->find_mentions($comment->comment_content);
	$permalink = get_permalink($comment->comment_post_ID);
	$blog_title = get_bloginfo('name');
	foreach ( $mentions as $match ) {
		$email = get_user_by('slug',$match)->user_email;
		$message = "You have been mentioned by {$comment->comment_author} in this comment:\n $permalink </p> {$comment->comment_content} ";
		wp_mail($email, "[$blog_title] You've been mentioned in a comment by {$comment->comment_author}", $message);
	}
}

Holy crap did the WordPress plugin Hot Linked Image Cacher just save me a ton of effort in moving things off of Tumblr.

Using Google Reader "Send To" with WordPress

I was pretty excited to read about recent enhancements to Google Reader, particularly the “Send to…” feature that allows you to post items from Google Reader into Facebook, Twitter, Delicious and many other sites.

But, I wanted to send things to WordPress and that isn’t in the list. However, the Reader team smartly left a way for you to manually add your own “Send to…” destinations. I considered this and thought it may match well with WordPress built-in “Press this” function. And it does!

You cannot use the “Press this…” function directly in Reader as it is Javascript and Reader wants a URL. But, you can just post directly to press-this.php. The URL is (make sure to replace with your own domain name!)

http://www.YOURDOMAINHERE.com/wp-admin/press-this.php?u=${url}&t=${title}&s=${source}&v=2

Google Reader will substitute the items in braces. Now you have an easy “Send to…” option from Google Reader.

To create this go to Google Reader and open Settings. Select the “Send To” tab and click on the “Create a custom link” button. Then fill it in similar to this picture:

google-reader-send-to-for-wordpress2

Also, if you want the nice WordPress icon next to the link put the Icon URL in as

http://s.wordpress.org/favicon.ico?3

Have fun blogging!

Now Reading for WordPress 2.7+
A “more updated” version of the Now Reading plugin for WordPress.

P2: The New Prologue

I was a fan of the original Prologue, and this new iteration of it looks even better.

I’m struck by how easy it would be to setup a private Twitter-like service for just the people you want to hang with. That could be fun, particularly as Twitter becomes less and less interesting and more and more overcrowded.

Upgraded to WordPress 2.7

I just took the plunge this evening and updated WordPress to 2.7. So far I’m pretty impressed. I wasn’t sure what I would think of the new admin interface but after using it I like it a lot. I can’t wait to give the automated upgrade feature a workout. If anything seems amiss, let me know.

Now the race is on to see how long it takes for good themes to come out that take advantage of the threaded comments feature in 2.7.

MinneWordCamp Not Happening

Back in February I posted a feeler to see if people would be interested in getting a Minneapolis WordCamp together. The response was pretty great, without any date, promotion or agenda nearly 75 people signed up to indicate interest.

While there has been a lot of interest, I’m not going to be able to lead the effort to get a WordCamp going here in Minneapolis. Coordinating an event like this is far outside my interest area and not something I do all that well. Plus we weren’t getting great uptake on sponsorship and the current economic meltdown is not going to make that better. We also lost our keynote speaker and were again going to have to look for a new date.

I’m hopeful that someone else is interested in seeing this happen and may take the lead and run with it.

WordPress iPhone Application and RSD Link

I posted before from the WordPress iPhone application when it was released. Its pretty nifty. When they upgraded it to 1.1 though I could no longer get it to work on my blog anymore. I was mighty confused since it worked for every other blog that is hosted on my server, but not mine.

I finally did some digging into the problem and for some reason my blog wasn’t outputting an RSD link which is needed for the application to find the XML-RPC endpoint. A quick grep -R rsd found the issue.

remove_action('wp_head', 'rsd_link');

That was hiding out in my functions.php file. I removed it and I’m cooking along with the iPhone WordPress application again. Beware if your theme does something similar. Found and fixed just before leaving town!

Themes: The Worst of the WordPress Ecosystem

This is frustrating.

I’ve spent the last couple of hours trying to find a new WordPress theme for Tammy’s blog, Smaller Than a Redwood. This is so frustrating.

First, she can’t do it herself easily because the look of a theme is completely unpredictable of its functionality. I would argue that a theme that doesn’t support sidebar widgets and tags right out of the box, should just be deleted. Why do we still have this junk floating around the Internet?

Worse still is the volume of themes that are just purely broken. We found a theme and I started to “fix” it, meaning add tagging support, and then found out several of the themes own images were not in the download and cannot be found on the Internet.

Argh! Now, back to Google to try to sift through thousands of piles of crap and see if I can find a workable theme.

Power WordPress Presentation Materials

I’m doing my Power WordPress presentation at Minnebar today. I decided to do the presentation today without any slides but instead give everyone handouts with the relevant tips & tricks. To share the wealth here are links to the PDF files for the three sections I’m covering, Performance, Plugin Review and SEO Basics.

Older posts

© 2014 thingelstad

Theme by Anders NorenUp ↑