<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Idowebdesign</title>
	<atom:link href="http://www.idowebdesign.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.idowebdesign.ca</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 21:13:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Allow IP bypass htaccess password with Apache</title>
		<link>http://www.idowebdesign.ca/server-stuff/apache/allow-ip-bypass-htaccess-password-with-apache/</link>
		<comments>http://www.idowebdesign.ca/server-stuff/apache/allow-ip-bypass-htaccess-password-with-apache/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 01:57:54 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[password]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=187</guid>
		<description><![CDATA[Here is a very quick tip on how to protect your whole site with htaccess password but only allow certain IP. This is very usefull when you are working on a development server and you want only your team to access the site.]]></description>
			<content:encoded><![CDATA[<p>Here is a very quick tip on how to protect your whole site with htaccess password but only allow certain IP. This is very usefull when you are working on a development server and you want only your team to access the site.</p>
<p>In the .htaccess file of the root of your web folder, paste the following code:</p>
<p><strong>Deny from all<br />
Order deny,allow<br />
AuthType Basic<br />
AuthName &#8220;Restricted&#8221;<br />
AuthUserFile /path_to_password/.htpasswd<br />
Require valid-user<br />
Allow from 192.168.1.10<br />
Allow from 192.168.1.10<br />
Satisfy Any</strong></p>
<p>First we simply specify the deny allow rule and also reference our authentication method. The we user Allow from with the IP. There is maybe a better way of doing this with IP range. Finally we simply tell apache to satify any Allow Deny rules. That&#8217;s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/server-stuff/apache/allow-ip-bypass-htaccess-password-with-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password Protect Wordpress Attachments (files)</title>
		<link>http://www.idowebdesign.ca/wordpress/password-protect-wordpress-attachments/</link>
		<comments>http://www.idowebdesign.ca/wordpress/password-protect-wordpress-attachments/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 22:27:17 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[password protect]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=183</guid>
		<description><![CDATA[You might have some sections of your Wordpress site that are only accessible for your Wordpress user. Pretty easy to protect the page or post in Wordpress for only the registered user but what about the attachments of the post/page (files, images)?]]></description>
			<content:encoded><![CDATA[<p>You might have some sections of your Wordpress site that are only accessible for your Wordpress user. Pretty easy to protect the page or post in Wordpress for only the registered user but what about the attachments of the post/page (files, images)?</p>
<p>They won&#8217;t be protected by default, this means if a request is made directly to the file it can be accessed without any password. There is potentially the solution where you protect the files in a directory with htaccess password, but do you really want to manage new set of username and password outside or Wordpress? Not really.</p>
<p>Here is the solution, use htaccess to check if a user is logged in the Wordpress site when accessing the files area, if not then redirect to the Wordpress login page. Here is the new .htaccess:</p>
<p># BEGIN WordPress<br />
&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteBase /<br />
<strong>RewriteCond %{REQUEST_URI} ^.*uploads/.*<br />
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]<br />
RewriteRule . /wp-login.php?redirect_to=%{REQUEST_URI} [R,L]</strong><br />
RewriteRule ^index\.php$ &#8211; [L]<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [L]<br />
&lt;/IfModule&gt;<br />
# END WordPress</p>
<p>We simply have protected the whole uploads area and redirect to login if the user is not logged. You can protect a different directory.</p>
<p>Thanks to this support forum thread for the heads up:</p>
<p><a href="http://wordpress.org/support/topic/password-protect-a-whole-directory">http://wordpress.org/support/topic/password-protect-a-whole-directory</a></p>
<p><strong>Update:</strong></p>
<p>I strongly suggest the use of this plugin:</p>
<p><a href="http://wordpress.org/extend/plugins/custom-upload-dir/">http://wordpress.org/extend/plugins/custom-upload-dir/</a></p>
<p>It let&#8217;s you set the name of the upload directory, so we can protect not the whole uploads. Because protecting the whole uploads will also</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/wordpress/password-protect-wordpress-attachments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE select onchange issue</title>
		<link>http://www.idowebdesign.ca/webdevelopment/ie-select-onchange-issue/</link>
		<comments>http://www.idowebdesign.ca/webdevelopment/ie-select-onchange-issue/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 23:32:15 +0000</pubDate>
		<dc:creator>Louis-Michel</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=177</guid>
		<description><![CDATA[This is a quick tip on how to support the onChange behavior for a select box in IE8.]]></description>
			<content:encoded><![CDATA[<p>This is a quick tip on how to support the onChange behavior for a select box in IE8.</p>
<p>For some reason IE 8 does not handle the onChange attribute of a select box.</p>
<pre class="brush: xml;">

&lt;select name=&quot;bowsers&quot; id=&quot;browsers&quot; onChange=&quot;alert('test');&quot;&gt;

&lt;option&gt;FF4&lt;/option&gt;

&lt;option&gt;IE&lt;/option&gt;

&lt;option&gt;Chrome&lt;/option&gt;

&lt;/select&gt;
</pre>
<p>Here is a fix than can be used to make this working</p>
<pre class="brush: xml;">

&lt;select name=&quot;bowsers&quot; id=&quot;browsers&quot;&gt;

&lt;option&gt;FF4&lt;/option&gt;

&lt;option&gt;IE8&lt;/option&gt;

&lt;option&gt;Chrome&lt;/option&gt;

&lt;/select&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
var selectmenu = document.getElementById(&quot;browsers&quot;);

selectmenu.onchange = function()
{
 alert('test');
}

&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/webdevelopment/ie-select-onchange-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pseudo Ajax loading effect with Flash and JQuery</title>
		<link>http://www.idowebdesign.ca/webdesign/pseudo-ajax-loading-effect-with-flash-and-jquery/</link>
		<comments>http://www.idowebdesign.ca/webdesign/pseudo-ajax-loading-effect-with-flash-and-jquery/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:39:14 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[animated gif]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[loading]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=167</guid>
		<description><![CDATA[You want to avoid traffic bounce because of long page loading delay? Here is a quick solution if you want to simulate an AJAX call on long loading forms using a flash animation file and JQuery call. ]]></description>
			<content:encoded><![CDATA[<p>While working on a project where our app is communicating with an external API we had the following issue: form submission can take up to 30 seconds to get the response back from the external API. Basically we have a form that does availability check for hostel reservation to an hostel reservation API. Depending on the number of results returned, the API can take a long time to respond and this could potentially discourage user from staying on the site waiting for results.</p>
<p>We could have done the call using AJAX at first but we decided to go with standard PHP post method with the API. So we had to find a way to let the user know something is working back-end while waiting when it is loading. It is like when you are on the phone with a large corporation while waiting for the tech support to answer, if there is no music or message telling us to wait we will simply hang up.</p>
<p><strong>Solutions: put an animated gif next to the form submit button to show an animation while user is waiting.</strong></p>
<p><strong>Problem:</strong> Well, animated gif can suck in some browser when a post request is submitted and waiting for the server response, the animated gif just stuck on one frame and it is no more an animated gif. This looks even worst as it appears to be broken. Animated gif are very good with Ajax call but for doing a pseudo ajax on post/get call, no go.</p>
<p><strong>New Solutions: using flash loading animation to replace the animated gif.</strong></p>
<p>So I just pick this package from Active Den: <a href="http://activeden.net/item/loading-animations/4572?ref=idowebdesign">Loading Animation</a>. Then I select the right one to show beside my submit button:</p>
<p><img class="alignnone size-full wp-image-169" title="loading" src="http://www.idowebdesign.ca/wp-content/uploads/2011/04/loading.jpg" alt="" width="548" height="243" /></p>
<p>So just below the search button I added the following code:</p>
<pre class="brush: xml;">

&lt;div id=&quot;loading-search&quot; style=&quot;display:none;&quot;&gt;
&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0&quot; width=&quot;70&quot; height=&quot;20&quot;&gt;
&lt;param name=&quot;allowFullScreen&quot; value=&quot;false&quot; /&gt;
&lt;param name=&quot;movie&quot; value=&quot;loading-search.swf&quot; /&gt;
&lt;param name=&quot;quality&quot; value=&quot;high&quot; /&gt;
&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;
&lt;embed src=&quot;loading-search.swf&quot; quality=&quot;high&quot; wmode=&quot;transparent&quot; width=&quot;70&quot; height=&quot;20&quot; name=&quot;loading-search&quot; align=&quot;middle&quot; allowFullScreen=&quot;false&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.adobe.com/go/getflashplayer&quot; /&gt;
&lt;/object&gt;
&lt;/div&gt;
</pre>
<p>Make sure to set the wmode to transparent so it doesn&#8217;t have a solid background. Now we just need to have to display it when the form is submitted. In this case there is a javascript validation so we just put this after the validation with jquery function:</p>
<pre class="brush: jscript;">

$(&quot;#loading-search&quot;).show();
</pre>
<p>Maybe in your case you can use this line in the <a href="http://api.jquery.com/submit/">.submit() from jquery</a>.</p>
<p>Now we have a nice pseudo Ajax animation, looks like ajax but it&#8217;s not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/webdesign/pseudo-ajax-loading-effect-with-flash-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a gradient reflection effect all without any images (CSS3)</title>
		<link>http://www.idowebdesign.ca/webdesign/csstricks/create-a-gradient-reflection-effect-all-without-any-images-css3/</link>
		<comments>http://www.idowebdesign.ca/webdesign/csstricks/create-a-gradient-reflection-effect-all-without-any-images-css3/#comments</comments>
		<pubDate>Sun, 27 Mar 2011 18:24:53 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[CSS tricks]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=147</guid>
		<description><![CDATA[Here is a quick tutorial on how to create a nice gradient with a reflection effect on a div or any other xhtml elements. We will use the CSS3 techniques as all the latest browsers are supporting the standard even if not officially released.]]></description>
			<content:encoded><![CDATA[<p>Here is a quick tutorial on how to create a nice gradient with a reflection effect on a div or any other xhtml elements. We will use the CSS3 techniques as all the latest browsers are supporting the standard even if not officially released.</p>
<p>Here is a screen shot of what we want to achieve:</p>
<p><img class="alignnone size-full wp-image-152" title="gradient" src="http://www.idowebdesign.ca/wp-content/uploads/2011/03/gradient.png" alt="" width="237" height="102" /></p>
<p>Here are the spec:</p>
<ul>
<li>Rounded corners</li>
<li>Dark gradient (can be any color but dark for this example)</li>
<li>Reflection effect like the good old Web 2.0</li>
</ul>
<p>Lets first build our xhtml. Pretty simple for this example:</p>
<pre class="brush: xml;">
&lt;div class=&quot;gradient&quot;&gt;
   &lt;div class=&quot;reflect&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Ok there is no content in it yet but we just define 2 div one that will do our gradient and the other one our reflection effect. Now let&#8217;s do our CSS with a 3.0 touch.</p>
<h2>Gradient</h2>
<pre class="brush: css;">
.gradient{
   position:relative;
   -moz-border-radius:10px;
   -webkit-border-radius:10px;
   border-radius:10px;
   border:1px solid #000;
   background:#222222;
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#666666', endColorstr='#222222'); /* for IE */
   background: -webkit-gradient(linear, left top, left bottom, from(#666666), to(#222222)); /* for webkit browsers */
   background: -moz-linear-gradient(top,  #666666,  #222222); /* for firefox 3.6+ */
   height:50px;
}
</pre>
<p>Here we have used the css3 technique for the gradient to support all major browsers. The start color is the color at the bottom of the box and the end color is the one at the top of the box. So we want a gradient that goes from dark to light.</p>
<h2>Reflection</h2>
<pre class="brush: css;">
.reflect{
   background:#ffffff;
   -moz-border-radius:10px;
   -webkit-border-radius:10px;
   border-radius:10px;
   opacity:0.1;
   filter: alpha(opacity = 10);
   height:50%;
   width:100%;
}
</pre>
<p>For the reflection, wow this is simple, with background with an opacity of 10%. We need to use the filter alpha for IE to support the transparency.</p>
<p>And we are done, this was fast. Here is the demo:</p>
<p><a href="http://www.idowebdesign.ca/demo/css3-gradient/">Gradient-Reflect Demo</a></p>
<p>Next time we will do a slick menu with this technique. Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/webdesign/csstricks/create-a-gradient-reflection-effect-all-without-any-images-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy redirect with Wordpress function wp_redirect</title>
		<link>http://www.idowebdesign.ca/wordpress/easy-redirect-with-wordpress-function-wp_redirect/</link>
		<comments>http://www.idowebdesign.ca/wordpress/easy-redirect-with-wordpress-function-wp_redirect/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 23:56:18 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=141</guid>
		<description><![CDATA[In a recent project, I had to redirect a specific category archive to a Wordpress page. I wanted to show special content when people were accessing the category archive page. This is actually pretty easy using the Wordpress wp_redirect function.]]></description>
			<content:encoded><![CDATA[<p>In a recent project, I had to redirect a specific category archive to a Wordpress page. I wanted to show special content when people were accessing the category archive page. This is actually pretty easy using the Wordpress wp_redirect function.</p>
<p>So I wanted to redirect the category called customers to a specific page. Here is how you can do this.</p>
<p><strong>1.</strong> Create a php file in the template folder called category-customers.php. Using this name Wordpress will pickup this file automatically when the category archive customers is accessed</p>
<p><strong>2. </strong>In the file paste the following code:</p>
<p>&lt;?php wp_redirect( get_permalink(get_option(&#8216;rc4_page_customers&#8217;)), 301 ); exit; ?&gt;</p>
<p>You can actually drop this part:</p>
<p>get_permalink(get_option(&#8216;page_customers&#8217;))</p>
<p>and replace it with a static url. I used this part to determine the url of a page I set in the admin settings for the theme. get_option will find the option called page_customers. This is useful in case the url of the page is changed by the user. So I recommend doing it.</p>
<p>The 301 parameter in the wp_redirect function just tell the search engine and bot the page has been moved permanently.</p>
<p>That&#8217;s it, pretty easy. For more info on wp_redirect, visit this link: <a href="http://codex.wordpress.org/Function_Reference/wp_redirect">http://codex.wordpress.org/Function_Reference/wp_redirect</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/wordpress/easy-redirect-with-wordpress-function-wp_redirect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Best Backup Tool for Wordpress</title>
		<link>http://www.idowebdesign.ca/freestuff/best-backup-tool-for-wordpress/</link>
		<comments>http://www.idowebdesign.ca/freestuff/best-backup-tool-for-wordpress/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 18:19:21 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Free Stuff]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=135</guid>
		<description><![CDATA[I recently discover one of the best backup plugin for Wordpress. What is fantastic with this backup tool is the fact it integrates with the major file sharing services like Dropbox, Rackspace Cloud or Amazon S3. Also you can schedule the backup of the database and files so you don't have to worry anymore about doing this manually.]]></description>
			<content:encoded><![CDATA[<p>I recently discover one of the best backup plugin for Wordpress. It is called Backwpup and can be downloaded here:</p>
<p><a href="http://wordpress.org/extend/plugins/backwpup/">http://wordpress.org/extend/plugins/backwpup/</a></p>
<p>Or install directly with Wordpress plugin manager. What is fantastic with this backup tool is the fact it integrates with the major file sharing services like <a href="http://db.tt/DnbCsj5">Dropbox</a>, Rackspace Cloud or Amazon S3. Also you can schedule the backup of the database and files so you don&#8217;t have to worry anymore about doing this manually.</p>
<p>Give it a shot!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/freestuff/best-backup-tool-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Search and Replace in MySQL for Wordpress Database</title>
		<link>http://www.idowebdesign.ca/wordpress/quick-search-and-replace-in-mysql-for-wordpress/</link>
		<comments>http://www.idowebdesign.ca/wordpress/quick-search-and-replace-in-mysql-for-wordpress/#comments</comments>
		<pubDate>Wed, 26 May 2010 23:30:00 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Search and Replace]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=111</guid>
		<description><![CDATA[At some point you might have to change the url of a Wordpress site for some reason. There is quick and easy way to update all the URL fields in the Wordpress database to make sure there is no trace left of the previous URL. ]]></description>
			<content:encoded><![CDATA[<p>At some point you might have to change the url of a Wordpress site for some reason. There is quick and easy way to update all the URL fields in the Wordpress database to make sure there is no trace left of the previous URL.</p>
<p><strong>At this point before doing anything, make sure you have a viable backup of you Wordpress database if anything goers wrong. MySQL command are permanent, like the dark pen you took to make nice drawings in the living room when you were 6 years old.</strong> Here is an article to read if you never backup Wordpress DB before: <a href="http://codex.wordpress.org/Backing_Up_Your_Database">http://codex.wordpress.org/Backing_Up_Your_Database</a></p>
<p>Login to PHPMyAdmin and click on the Wordpress database. Go to the SQL tab. Grab the following commands and change with the urls needed:</p>
<h2>Search and Replace MySQL</h2>
<p>UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url,  &#8216;www.olddomain.com&#8217;, &#8216;www.newdomain.com&#8217;);<br />
UPDATE wp_options SET  option_value = REPLACE(option_value, &#8216;www.olddomain.com&#8217;,  &#8216;www.newdomain.com&#8217;);<br />
UPDATE wp_postmeta SET meta_value =  REPLACE(meta_value, &#8216;www.olddomain.com&#8217;, &#8216;www.newdomain.com&#8217;);<br />
UPDATE  wp_posts SET post_content = REPLACE(post_content, &#8216;www.olddomain.com&#8217;,  &#8216;www.newdomain.com&#8217;);<br />
UPDATE wp_posts SET post_excerpt =  REPLACE(post_excerpt, &#8216;www.olddomain.com&#8217;, &#8216;www.newdomain.com&#8217;);<br />
UPDATE  wp_posts SET guid = REPLACE(guid, &#8216;www.olddomain.com&#8217;,  &#8216;www.newdomain.com&#8217;);<br />
UPDATE wp_usermeta SET meta_value =  REPLACE(meta_value, &#8216;www.olddomain.com&#8217;, &#8216;www.newdomain.com&#8217;);<br />
UPDATE  wp_users SET user_email = REPLACE(user_email, &#8216;www.olddomain.com&#8217;,  &#8216;www.newdomain.com&#8217;);<br />
UPDATE wp_users SET user_url =  REPLACE(user_url, &#8216;www.olddomain.com&#8217;, &#8216;www.newdomain.com&#8217;);</p>
<p>In less then 3 minutes you are done with the task.</p>
<h2>Little Bonus</h2>
<p>This maybe useless to you but if you want to change all your post status to draft because of some obscur reason, here is the command:</p>
<p>UPDATE wp_posts SET post_status = &#8216;draft&#8217; WHERE (post_status = &#8216;publish&#8217; AND post_type = &#8216;post&#8217;);</p>
<p><span style="text-decoration: underline;"><strong><span style="font-size: medium;">UPDATE 31/05/2010</span></strong></span></p>
<p>I just build a small script to generate the code automatically: <a href="http://www.idowebdesign.ca/mysql-replace/">http://www.idowebdesign.ca/mysql-replace/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/wordpress/quick-search-and-replace-in-mysql-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Building a top contributor list in Wordpress</title>
		<link>http://www.idowebdesign.ca/wordpress/building-a-top-contributor-list-in-wordpress/</link>
		<comments>http://www.idowebdesign.ca/wordpress/building-a-top-contributor-list-in-wordpress/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 17:01:38 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[User]]></category>

		<guid isPermaLink="false">http://www.idowebdesign.ca/?p=92</guid>
		<description><![CDATA[You might be running a site or building a site for a customer where multiple people are contributing to the content. Then there come the time where you need to build a top contributor list of the Wordpress site users. I have been looking for plugins to do this, however I didn't found anything satisfying or the one I tried were not very good for large list of user. So I have decided to poke around the web and combine some code with my own ideas.]]></description>
			<content:encoded><![CDATA[<p>You might be running a site or building a site for a customer where multiple people are contributing to the content. Then there come the time where you need to build a top contributor list of the Wordpress site users. I have been looking for plugins to do this, however I didn&#8217;t found anything satisfying or the one I tried were not very good for large list of user. So I have decided to poke around the web and combine some code with my own ideas.</p>
<p>Thus, In this example we will simple build a list that order the user by the number of articles published and then by the user name.</p>
<p>First of all, you need to create a new template file which you will use in the admin to create the Wordpress page that will show the list.</p>
<p>Now in this template after the loop, let&#8217;s do our custom SQL query to get the list of users:</p>
<pre class="brush: php;">
$query = &quot;SELECT u.ID, u.display_name, count(*) as cnt FROM $wpdb-&gt;posts p, $wpdb-&gt;users u WHERE p.post_parent = 0 AND  p.post_status = 'publish' AND p.post_author = u.ID GROUP BY u.user_login ORDER BY cnt DESC, u.display_name ASC&quot;;
</pre>
<p>Basically this Query is doing what we need, it gets the ID, display name of the users and order them by the number of post (count(*)) they have published. Here we are using count(*) to calculate the number of occurrence the user is appearing for a publishes post and we are grouping the result by user login name. We use an aliases (cnt) because some server can be tricky and not like count(*) term when you do the Order. Let&#8217;s run the query:</p>
<pre class="brush: php;">
$UsersID = $wpdb-&gt;get_results( $query );
</pre>
<p>Now we are ready to enter our loop to display the results:</p>
<pre class="brush: php;">
$counter = 0;
$siteurl = get_bloginfo('template_url');
foreach ( $UsersID as $iUserID ) :

   $user = get_userdata( $iUserID-&gt;ID );
   $numpost = get_usernumposts($iUserID-&gt;ID);

   if ($user-&gt;user_level &lt; 3){

      $counter++;
      $membersince = date('M dS Y',strtotime($user-&gt;user_registered));

      if ($counter == 2){
         $counter =0;
         echo '&lt;div class=&quot;user-block last&quot;&gt;';
      }else{
         echo '&lt;div class=&quot;user-block&quot;&gt;';
      }

      echo '&lt;a href=&quot;'.get_author_posts_url($iUserID-&gt;ID).'&quot;&gt;'.get_avatar( $user-&gt;user_email, '60', $default=$siteurl.'/images/gravatar.jpg' ).'&lt;/a&gt;';

      echo '&lt;h2&gt;&lt;a href=&quot;'.get_author_posts_url($iUserID-&gt;ID).'&quot;&gt;'. $user-&gt;display_name .'&lt;/a&gt;&lt;/h2&gt;

      &lt;p&gt;Articles published: &lt;strong&gt;'.$numpost.'&lt;/strong&gt;&lt;/p&gt;
      &lt;p&gt;Member since: &lt;strong&gt;'.$membersince.'&lt;/strong&gt;&lt;/p&gt;

      &lt;/div&gt;';
   }

endforeach;
</pre>
<p>With this loop we are displaying the user avatar, name, number of post and membership history. The name and avatar are linking to the author archive page with all the articles form this user. We are using a counter to add a class to our user block in order to remove the margin on the right side (2 column design).</p>
<p>Obviously, this could be optimize:</p>
<ul>
<li> The query could have been part of a function, so we don&#8217;t have the sql query showing up in the template page.</li>
<li>We could have got the user meta directly from the query instead of calling get_userdata in the FOR loop.</li>
</ul>
<p>And could be improve with ideas to make this code evolved:</p>
<ul>
<li>Paging the result, if you have more than 50 users, it will be great to page the results.</li>
<li>Install a post rating plugin and get the top contributor order by rating.</li>
</ul>
<p>Please don&#8217;t hesitate to leave a comment if you have other suggestion to  optimize the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/wordpress/building-a-top-contributor-list-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Auto Cropping with TimThumb</title>
		<link>http://www.idowebdesign.ca/webdevelopment/auto-cropping-with-timthumb/</link>
		<comments>http://www.idowebdesign.ca/webdevelopment/auto-cropping-with-timthumb/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 16:09:45 +0000</pubDate>
		<dc:creator>Guillaume</dc:creator>
				<category><![CDATA[PHP script]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cropping]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[timthump]]></category>

		<guid isPermaLink="false">http://idowebdesign.ca/?p=66</guid>
		<description><![CDATA[Darren Hoyt who is one of the best Web Designer out there (in my sense!) and he is providing an auto image cropping php script called TimThumb on his website. When you deploy a project for a customer, last thing you want to do is have them manually resizing the pictures and cropping them before uploading them to the CMS.]]></description>
			<content:encoded><![CDATA[<p>Darren Hoyt who is one of the best Web Designer out there (in my sense!) and he is providing an auto image cropping php script called TimThumb on his website. When you deploy a project for a customer, last thing you want to do is have them manually resizing the pictures and cropping them before uploading them to the CMS. And this is especially true with Wordpress.  TimThumb is a really nice piece of code and it also provide caching so the process is not run every time a page is loading. Here is the link with all the instruction:</p>
<p><a href="http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/">http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/</a></p>
<p>Most important thing is to chmod the script folder subfiles and folder to 777 in order to have it work correctly. Here is an example on how to use it in Wordpress:</p>
<pre class="brush: php; smart-tabs: true;">
&lt;a title=&quot;&lt;?php the_title();?&gt;&quot; href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;

  &lt;img alt=&quot;&lt;?php the_title();?&gt;&quot; src=&quot;&lt;?php echo get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&amp;w=306&amp;h=217&amp;src='.get_thumb_url($post-&gt;ID);?&gt;&quot; /&gt;

&lt;/a&gt;</pre>
<p>This example is part of the Wordpress Loop. You can change the w and h value in the script URL to modify the image width and height. Best way to do it will be to have these setting part of the Wordpress The Options panel. The get_thumb_url() is a custom function we have built to retrieve the value of the post thumbnail which is available since Wordpress 2.9. We will cover this function in an article later on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idowebdesign.ca/webdevelopment/auto-cropping-with-timthumb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

