<?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>Danwebs.dk - Webdesign &#38; Hosting</title>
	<atom:link href="http://danwebs.dk/feed/" rel="self" type="application/rss+xml" />
	<link>http://danwebs.dk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 13 Aug 2010 12:54:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title></title>
		<link>http://danwebs.dk/uncategorized/167/</link>
		<comments>http://danwebs.dk/uncategorized/167/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 12:54:43 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://danwebs.dk/uncategorized/167/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/8fj2HVYlD_4?fs=1&amp;hl=da_DK&amp;color1=0xe1600f&amp;color2=0xfebd01"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/8fj2HVYlD_4?fs=1&amp;hl=da_DK&amp;color1=0xe1600f&amp;color2=0xfebd01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/uncategorized/167/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress: get users by role</title>
		<link>http://danwebs.dk/php/wordpress-get-users-by-role/</link>
		<comments>http://danwebs.dk/php/wordpress-get-users-by-role/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 16:48:10 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[roles]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=159</guid>
		<description><![CDATA[Here's a little function I cooked up to fetch users by their roles.]]></description>
			<content:encoded><![CDATA[<p>I needed a simple way to get all users by their roles, and none of WP&#8217;s built in functions seemed to be able to do this.</p>
<pre class="brush: php;">
	public function get_users_by_role($role = 'all')
	{
		global $wpdb;
		$query = $wpdb -&gt; prepare(&quot;SELECT {$wpdb -&gt; users}.ID as `id`, {$wpdb -&gt; usermeta}.meta_value as `capabilities` FROM {$wpdb -&gt; users} JOIN {$wpdb -&gt; usermeta} ON {$wpdb -&gt; users}.ID = {$wpdb -&gt; usermeta}.user_id WHERE {$wpdb -&gt; usermeta}.meta_key = 'wp_capabilities'&quot;);
		$userdata = $wpdb -&gt; get_results($query);
		$users = Array();
		foreach($userdata as $data)
		{
			$caps = unserialize($data -&gt; capabilities);
			if($caps[$role] == true || $role == 'all')
			{
				$users[] = get_userdata($data -&gt; id);
			}
		}
		return $users;
	}
</pre>
<p>
There&#8217;s a pretty long query in there which pretty much just selects the ID from the wp_users table and the wp_capabilities value from the wp_usermeta table.
</p>
<p>
Then there&#8217;s a loop which checks that the selected user id has the wanted role, and then an array of all users with their data is returned. Pretty simple.
</p>
<p>
Use it like this:</p>
<pre class="brush: php;">
$admins = get_users_by_role('administrator');
foreach($admins as $admin)
{
	echo $admin -&gt; user_nicename . '&lt;br /&gt;';
}
</pre>
<p>Outputs something like:<br />
admin<br />
admin2
</p>
<p>
If anyone knows of a simpler way of doing this, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/php/wordpress-get-users-by-role/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Komma-separerede landelister</title>
		<link>http://danwebs.dk/php/komma-separerede-landelister/</link>
		<comments>http://danwebs.dk/php/komma-separerede-landelister/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 10:00:50 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=139</guid>
		<description><![CDATA[Kilde
Alle
'Afghanistan', 'Albanien', 'Algeriet', 'Andorra', 'Angola', 'Antigua og  Barbuda', 'Argentina', 'Armenien', 'Australien', 'Azerbajdjan',  'Bahama-øerne', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus  (Hviderusland)', 'Belgien', 'Belize', 'Benin', 'Bhutan', 'Bolivia',  'Bosnien-Herzegovina', 'Botswana', 'Brasilien', 'Brunei', 'Bulgarien',  'Burkina Faso', 'Burma', 'Burundi', 'Cambodja', 'Cameroun', 'Canada',  'Centralafrikanske Republik', 'Chile', 'Colombia', 'Comorerne', 'Congo',  'Congo, Den Demokratiske Republik', 'Cook Islands', 'Costa [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.um.dk/da/menu/Udenrigspolitik/LandeOgRegioner/Landeliste/">Kilde</a></p>
<h4>Alle</h4>
<pre>'Afghanistan', 'Albanien', 'Algeriet', 'Andorra', 'Angola', 'Antigua og  Barbuda', 'Argentina', 'Armenien', 'Australien', 'Azerbajdjan',  'Bahama-øerne', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus  (Hviderusland)', 'Belgien', 'Belize', 'Benin', 'Bhutan', 'Bolivia',  'Bosnien-Herzegovina', 'Botswana', 'Brasilien', 'Brunei', 'Bulgarien',  'Burkina Faso', 'Burma', 'Burundi', 'Cambodja', 'Cameroun', 'Canada',  'Centralafrikanske Republik', 'Chile', 'Colombia', 'Comorerne', 'Congo',  'Congo, Den Demokratiske Republik', 'Cook Islands', 'Costa Rica',  'Cuba', 'Cypern', 'Djibouti', 'Dominica', 'Dominikanske Republik',  'Ecuador', 'Egypten', 'Elfenbenskysten', 'El Salvador', 'Eritrea',  'Estland', 'Etiopien', 'Fiji', 'Filippinerne', 'Finland', 'Forenede  Arabiske Emirater', 'Frankrig', 'Gabon', 'Gambia', 'Georgien', 'Ghana',  'Grenada', 'Grækenland', 'Guatemala', 'Guinea', 'Guinea-Bissau',  'Guyana', 'Haiti', 'Honduras', 'Indien', 'Indonesien', 'Irak', 'Iran',  'Irland', 'Island', 'Israel', 'Italien', 'Jamaica', 'Japan', 'Jordan',  'Kapverdiske Øer', 'Kazakstan', 'Kenya', 'Kina', 'Kirgizistan',  'Kiribati', 'Demokratiske Folkerepublik Korea', 'Republikken Korea',  'Kosovo', 'Kroatien', 'Kuwait', 'Laos', 'Lesotho', 'Letland', 'Libanon',  'Liberia', 'Libyen', 'Liechtenstein', 'Litauen', 'Luxembourg',  'Madagaskar', 'Makedonien, den tidligere jugoslaviske republik (FYROM)',  'Malawi', 'Malaysia', 'Maldiverne', 'Mali', 'Malta', 'Marokko',  'Marshall-øerne', 'Mauretanien', 'Mauritius', 'Mexico', 'Mikronesien',  'Moldova', 'Monaco', 'Mongoliet', 'Montenegro', 'Mozambique', 'Namibia',  'Nauru', 'Nederlandene', 'Nepal', 'New Zealand', 'Nicaragua', 'Niger',  'Nigeria', 'Norge', 'Oman', 'Pakistan', 'Palau', 'Panama', 'Papua New  Guinea', 'Paraguay', 'Peru', 'Polen', 'Portugal', 'Qatar', 'Rumænien',  'Rusland', 'Rwanda', 'Samoa', 'San Marino', 'Sao Tomé og Principe',  'Saudi Arabien', 'Schweiz', 'Senegal', 'Serbien', 'Seychellerne',  'Sierra Leone', 'Singapore', 'Slovakiske Republik, Den', 'Slovenien',  'Solomon-øerne', 'Somalia', 'Spanien', 'Sri Lanka', 'St. Kitts og  Nevis', 'St. Lucia', 'St. Vincent og Grenadinerne', 'Storbritannien og  Nordirland', 'Sudan', 'Surinam', 'Sverige', 'Swaziland', 'Sydafrika',  'Syrien', 'Tadjikistan', 'Tanzania', 'Tchad', 'Thailand', 'Den Tjekkiske  Republik', 'Togo', 'Tonga', 'Trinidad og Tobago', 'Tunesien',  'Turkmenistan', 'Tuvalu', 'Tyrkiet', 'Tyskland', 'Uganda', 'Ukraine',  'Ungarn', 'Uruguay', 'USA (Amerikas Forenede Stater)', 'Uzbekistan',  'Vanuatu', 'Vatikanstaten', 'Venezuela', 'Vietnam', 'Yemen', 'Zambia',  'Zimbabwe', 'Ækvatorial Guinea', 'Østrig', 'Østtimor (Timor Leste)</pre>
<h4>A</h4>
<pre>'Afghanistan ', 'Albanien ', 'Algeriet ', 'Andorra ', 'Angola ', 'Antigua og Barbuda ', 'Argentina ', 'Armenien ', 'Australien ', 'Azerbajdjan '</pre>
<h4>B</h4>
<pre>'Bahama-øerne ', 'Bahrain ', 'Bangladesh ', 'Barbados ', 'Belarus (Hviderusland) ', 'Belgien ', 'Belize ', 'Benin ', 'Bhutan ', 'Bolivia ', 'Bosnien-Herzegovina ', 'Botswana ', 'Brasilien ', 'Brunei ', 'Bulgarien ', 'Burkina Faso ', 'Burma ', 'Burundi '</pre>
<h4>C</h4>
<pre>'Cambodja ', 'Cameroun ', 'Canada ', 'Centralafrikanske Republik ', 'Chile ', 'Colombia ', 'Comorerne ', 'Congo ', 'Congo, Den Demokratiske Republik  ', 'Cook Islands ', 'Costa Rica ', 'Cuba ', 'Cypern '</pre>
<h4>D</h4>
<pre>'Djibouti ', 'Dominica ', 'Dominikanske Republik '</pre>
<h4>E</h4>
<pre>'Ecuador ', 'Egypten ', 'Elfenbenskysten ', 'El Salvador ', 'Eritrea ', 'Estland ', 'Etiopien '</pre>
<h4>F</h4>
<pre>'Fiji ', 'Filippinerne ', 'Finland ', 'Forenede Arabiske Emirater ', 'Frankrig '</pre>
<h4>G</h4>
<pre>'Gabon ', 'Gambia ', 'Georgien ', 'Ghana ', 'Grenada ', 'Grækenland ', 'Guatemala ', 'Guinea ', 'Guinea-Bissau ', 'Guyana '</pre>
<h4>H</h4>
<pre>'Haiti ', 'Honduras '</pre>
<h4>I</h4>
<pre>'Indien ', 'Indonesien ', 'Irak ', 'Iran ', 'Irland ', 'Island ', 'Israel ', 'Italien '</pre>
<h4>J</h4>
<pre>'Jamaica ', 'Japan ', 'Jordan '</pre>
<h4>K</h4>
<pre>'Kapverdiske Øer ', 'Kazakstan ', 'Kenya ', 'Kina ', 'Kirgizistan ', 'Kiribati ', 'Demokratiske Folkerepublik Korea ', 'Republikken Korea ', 'Kosovo ', 'Kroatien ', 'Kuwait '</pre>
<h4>L</h4>
<pre>'Laos ', 'Lesotho ', 'Letland ', 'Libanon ', 'Liberia ', 'Libyen ', 'Liechtenstein ', 'Litauen ', 'Luxembourg '</pre>
<h4>M</h4>
<pre>'Madagaskar ', 'Makedonien, den tidligere jugoslaviske republik (FYROM) ', 'Malawi ', 'Malaysia ', 'Maldiverne ', 'Mali ', 'Malta ', 'Marokko ', 'Marshall-øerne ', 'Mauretanien ', 'Mauritius ', 'Mexico ', 'Mikronesien ', 'Moldova ', 'Monaco ', 'Mongoliet ', 'Montenegro ', 'Mozambique '</pre>
<h4>N</h4>
<pre>'Namibia ', 'Nauru ', 'Nederlandene ', 'Nepal ', 'New Zealand ', 'Nicaragua ', 'Niger ', 'Nigeria ', 'Norge '</pre>
<h4>O</h4>
<pre>'Oman '</pre>
<h4>P</h4>
<pre>'Pakistan ', 'Palau ', 'Panama ', 'Papua New Guinea ', 'Paraguay ', 'Peru ', 'Polen ', 'Portugal '</pre>
<h4>Q</h4>
<pre>'Qatar '</pre>
<h4>R</h4>
<pre>'Rumænien ', 'Rusland ', 'Rwanda '</pre>
<h4>S</h4>
<pre>'Samoa ', 'San Marino ', 'Sao Tomé og Principe ', 'Saudi Arabien ', 'Schweiz ', 'Senegal ', 'Serbien ', 'Seychellerne ', 'Sierra Leone ', 'Singapore ', 'Slovakiske Republik, Den ', 'Slovenien ', 'Solomon-øerne ', 'Somalia ', 'Spanien ', 'Sri Lanka ', 'St. Kitts og Nevis ', 'St. Lucia ', 'St. Vincent og Grenadinerne ', 'Storbritannien og Nordirland ', 'Sudan ', 'Surinam ', 'Sverige ', 'Swaziland ', 'Sydafrika ', 'Syrien '</pre>
<h4>T</h4>
<pre>'Tadjikistan ', 'Tanzania ', 'Tchad ', 'Thailand ', 'Den Tjekkiske Republik ', 'Togo ', 'Tonga ', 'Trinidad og Tobago ', 'Tunesien ', 'Turkmenistan ', 'Tuvalu ', 'Tyrkiet ', 'Tyskland '</pre>
<h4>U</h4>
<pre>'Uganda ', 'Ukraine ', 'Ungarn ', 'Uruguay  ', 'USA (Amerikas Forenede Stater) ', 'Uzbekistan '</pre>
<h4>V</h4>
<pre>'Vanuatu ', 'Vatikanstaten ', 'Venezuela ', 'Vietnam '</pre>
<h4>Y</h4>
<pre>'Yemen '</pre>
<h4>Z</h4>
<pre>'Zambia ', 'Zimbabwe '</pre>
<h4>Æ</h4>
<pre>'Ækvatorial Guinea '</pre>
<h4>Ø</h4>
<pre>'Østrig ', 'Østtimor (Timor Leste)'</pre>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/php/komma-separerede-landelister/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google translate desktop application</title>
		<link>http://danwebs.dk/c-sharp/google-translate-desktop-application/</link>
		<comments>http://danwebs.dk/c-sharp/google-translate-desktop-application/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 07:37:07 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[C sharp]]></category>
		<category><![CDATA[google translate]]></category>
		<category><![CDATA[google translator]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=122</guid>
		<description><![CDATA[Just a small desktop app I made to have a translation handy when I study and read blogs and whatnot..
googleTranslator
]]></description>
			<content:encoded><![CDATA[<p>Just a small desktop app I made to have a translation handy when I study and read blogs and whatnot..</p>
<p><a href='http://danwebs.dk/wp-content/uploads/2010/02/googleTranslator1.zip'>googleTranslator</a></p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/c-sharp/google-translate-desktop-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Catching facebook</title>
		<link>http://danwebs.dk/php/catching-facebook/</link>
		<comments>http://danwebs.dk/php/catching-facebook/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 09:37:55 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=116</guid>
		<description><![CDATA[Showing special content to the facebook crawler, when using the "share on facebook" feature.]]></description>
			<content:encoded><![CDATA[<p>
I needed to catch when Facebook was checking out an app I did via the &#8220;share on facebook&#8221; feature. This can very simply be done with</p>
<pre class="brush: php;">
$_SERVER['HTTP_USER_AGENT']
</pre>
<p>Facebook sends a special &#8220;facebook&#8221; useragent when crawling the site.
</p>
<p>
So to catch facebook, and show special stuff you could do</p>
<pre class="brush: php;">
if(preg_match('/facebook/', $_SERVER['HTTP_USER_AGENT'])
{
    //show stuff to facebook
}
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/php/catching-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress &#8211; qTranslate and Mailpress fix</title>
		<link>http://danwebs.dk/php/wordpress-qtranslate-and-mailpress-fix/</link>
		<comments>http://danwebs.dk/php/wordpress-qtranslate-and-mailpress-fix/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 13:03:41 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=101</guid>
		<description><![CDATA[Providing an ugly quick-fix to the qTranslate/Mailpress incompatability issue. But a fix none the less..]]></description>
			<content:encoded><![CDATA[<p>
I had a problem with<a href="http://www.qianqin.de/qtranslate/" title="qTranslate"> qTranslate</a> and <a href="http://mailpress.org/" title="Mailpress">Mailpress</a> not cooperating, and thought I&#8217;d share my quick-fix. qTranslate would wrap both title and content in it&#8217;s own syntax, and it would mess up the CMS tinymce editor.
</p>
<p>
There didn&#8217;t seem to be any solution to this at all, so I had to hack one out myself. What I quickly came up with was to comment out the wordpress function the_editor in Mailpress, and replace it with HTML.
</p>
<p>
Edit file: <em>mailpress/mp-admin/includes/write.php</em>, and find the following function call (around line 220-225):</p>
<pre class="brush: php;">
the_editor((isset($draft-&gt;html)) ? $draft-&gt;html : '', 'content', 'title', apply_filters('MailPress_upload_media', false), 5);
</pre>
<p>And replace it with this:</p>
<pre class="brush: php;">
&lt;div id='editorcontainer'&gt;
&lt;textarea class=&quot;theEditor&quot; name=&quot;content&quot; style=&quot;color:#000;width:760px;height:200px;&quot;&gt;&lt;?php echo $draft-&gt;html; ?&gt;&lt;/textarea&gt;
&lt;/div&gt;
</pre>
</p>
<p>
It&#8217;s extremely ugly, and the wysiwyg editor will not work, but hey.. It&#8217;s sending proper newsletters at least, and if you know enough to change this, you&#8217;ll probably know enough HTML to add your own markup to the newsletter.
</p>
<p>
I might create a prettier solution when I get more time, and/or need the function again.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/php/wordpress-qtranslate-and-mailpress-fix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook API &#8211; Using fql_query to get status and fan count from pages</title>
		<link>http://danwebs.dk/php/facebook-api-getting-status-from-pages/</link>
		<comments>http://danwebs.dk/php/facebook-api-getting-status-from-pages/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 09:43:46 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://danwebs.dk/?p=27</guid>
		<description><![CDATA[Using the Facebook API to get the latest status updates and fan count for a facebook page.]]></description>
			<content:encoded><![CDATA[<p>Today I needed to get the 5 latest status updates from a Facebook page. A client had asked me if I could create a widget for wordpress that would show the latest blog posts, tweets and facebook updates in one widget.</p>
<p>While the latest blog posts and tweets were easy enough to set up, I had a few kinks figuring out how to get the data from Facebook, without requiring a session key (i.e. without logging in to Facebook).</p>
<p>This took a while to dig out, and I tried around 5 different approaches before figuring out that it was pretty simple actually. The Facebook API documentation is just terrible&#8230;</p>
<pre class="brush: php;">
include('facebook-platform/php/facebook.php');

class fbPageStatus
{
 public static function getStatusUpdates($fbkey, $fbsecret, $page_id)
 {
 $fb = new Facebook($fbkey, $fbsecret);
 $fql        = &quot;SELECT message, updated_time FROM stream WHERE source_id = '&quot; . $page_id . &quot;'&quot;;
 $fbupdates    = $fb -&gt; api_client -&gt; fql_query($fql);
 return $fbupdates;
 }
}
// Usage:
var_dump(fbPageStatus::getStatusUpdates('7bc1ef16567735546bef620c32a23s76', 'ab3dfc4b7d8591f7ef2197ba754f16d1', '17975046895'));
</pre>
<p>Some simple FQL returns the result.</p>
<p>To get the number of fans, you would do:</p>
<pre class="brush: php;">

$fql         = &quot;SELECT fan_count FROM page WHERE page_id = '&quot; . $page_id . &quot;'&quot;;
 $fans         = $fb -&gt; api_client -&gt; fql_query($fql);
</pre>
<p>Hope someone will find this usefull.</p>
<p>EDIT: All keys are fake, obviously. Replace with your own.</p>
]]></content:encoded>
			<wfw:commentRss>http://danwebs.dk/php/facebook-api-getting-status-from-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
