<?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>Nutsmuggling &#187; Wordpress</title>
	<atom:link href="http://davidebenini.it/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidebenini.it</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 29 Apr 2010 10:34:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to allow tags in Wordpress comments unobtrusively</title>
		<link>http://davidebenini.it/2010/04/29/how-to-allow-tags-in-wordpress-comments-unobtrusively/</link>
		<comments>http://davidebenini.it/2010/04/29/how-to-allow-tags-in-wordpress-comments-unobtrusively/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 10:31:08 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[allowed]]></category>
		<category><![CDATA[allowedtags]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[span]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=580</guid>
		<description><![CDATA[How to allow tags in comments without touching the wp core]]></description>
			<content:encoded><![CDATA[<p>Scenario: I am using the <a href="http://wordpress.org/extend/plugins/tinymcecomments/">tinymcecomments</a> plugin to give some formatting capabilities to commenters.<br />
With the latest WP update I realised the <code>span</code> tag was removed from comments; colors attributes are filtered by the kses filter.</p>
<p>Hum.</p>
<p>After investigating I come across <a href="http://codex.wordpress.org/FAQ_Working_with_WordPress#How_do_I_stop_people_from_posting_HTML_in_comments.3F">this suggestion</a> in the Codex:</p>
<blockquote>
<p>Acceptance of HTML tags in the comments field is managed in the file kses.php, located in the wp-includes folder.</p>
<p>Open this file in a text editor, and locate the list of HTML tags near the top of the file. Each HTML tag is listed on a separate line, in the construction of a PHP array of allowed tags. Lines which begin with // are commented-out, or disabled, so lines which begin with // designate HTML tags that are not allowed in comments.</p>
<p>To stop people from posting HTML in comments, edit your kses.php file as desired to allow or disallow specific HTML tags in comments, by adding // to the very beginning of the appropriate lines of the list. To exclude all HTML tags, comment out all lines which allow HTML tags. Be sure to save your file when done.</p>
</blockquote>
<p>That&#8217;s a start but hey, is the Codex really suggesting that I alter the WP core? Next update my all precious settings will go away. C&#8217;mon, we can do better than that!</p>
<p>In the kses source code I find this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CUSTOM_TAGS'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CUSTOM_TAGS'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>CUSTOM_TAGS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>     
	etc</pre></div></div>

<p>So basically I can redefine all the allowed tags structure in a constant. Not bad. But hey, do I really want to redefine  both the $allowedposttags and the $allowedtags variables? Naaah&#8230;</p>
<p>So I scavenged in the source code and I came across a fit filter. I wrote a little function for my functions.php file; needless to say, this could have gone into a plugin.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'preprocess_comment'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'fa_allow_tags_in_comments'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> fa_allow_tags_in_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$allowedtags</span><span style="color: #339933;">;</span> 
	<span style="color: #000088;">$allowedtags</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'span'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'style'</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$allowedtags</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'p'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>See? Much more concise than overwriting the variables. And more future-proof: if subsequent versions of Wordpress change the variable there is no constant barring the changes.</p>
<p>Cheers,<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2010/04/29/how-to-allow-tags-in-wordpress-comments-unobtrusively/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Events Manager 2.2, security hole closed</title>
		<link>http://davidebenini.it/2010/04/10/events-manager-2-2-security-hole-closed/</link>
		<comments>http://davidebenini.it/2010/04/10/events-manager-2-2-security-hole-closed/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 15:26:00 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[events manager eventsmanager wordpress]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=578</guid>
		<description><![CDATA[Security release of Events mMnager]]></description>
			<content:encoded><![CDATA[<p>Hello folks,<br />
I just released Events Manager 2.2. It&#8217;s a minor upgrade, here is the changelog:</p>
<ul>
<li>Added a option to get events through a select            </li>
<li>Closed many bugs causing a notices/warning visible only in debug mode</li>
<li>Closed a critical security hole discovered by Danilo Massa (to be released on May 10th)     </li>
</ul>
<p>The first point is the only proper feature, it allows you to use a select for the events venue. It&#8217;s something that comes in handy for people/organizations whose events take place in the same venues all the times.</p>
<p>The second point is something I should have done AGES ago. I put Worpress in debug mode and thus could see all the stuff that&#8217;s usually spitted directly into the error log. There were many small bugs, caused mainly by the lack of <code>isset</code> here and there. I believe there are still minor notice/warnings, but I got rid of most of them.</p>
<p>Point three is what urged me to release ASAP. <a href="http://www.danilomassa.info/dmportal/">Danilo Massa</a> kindly notified me of a security hole in Events Manager, providing a simple one-liner to fix it. Since the vulnerability is pretty serious I hurried to apply Danilo&#8217;s patch and release 2.2.</p>
<p>This release is quite stable, it&#8217;s employed in a client portal, so you should have no problem with the upgrade.</p>
<p>Enjoy,<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2010/04/10/events-manager-2-2-security-hole-closed/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Events Manager 2.1</title>
		<link>http://davidebenini.it/2010/03/04/events-manager-2-1/</link>
		<comments>http://davidebenini.it/2010/03/04/events-manager-2-1/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 18:54:59 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[haircut]]></category>
		<category><![CDATA[manager]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=548</guid>
		<description><![CDATA[Hello folks,
just a short note to announce the release of Events Manager 2.1.
It&#8217;s probably not as stable as the lack of a or b would suggest, but it is definitely much stabler than the previous version. Also, I got tired of letters.
Here&#8217;s the changelog:

Properly added Marcus Sykes as a contributor  
Added a full calendar [...]]]></description>
			<content:encoded><![CDATA[<p>Hello folks,<br />
just a short note to announce the release of <a href="http://davidebenini.it/wordpress-plugins/events-manager/">Events Manager 2.1</a>.<br />
It&#8217;s probably not as stable as the lack of <code>a</code> or <code>b</code> would suggest, but it is definitely much stabler than the previous version. Also, I got tired of letters.</p>
<p>Here&#8217;s the changelog:</p>
<ul>
<li>Properly added Marcus Sykes as a contributor  </li>
<li>Added a full calendar  </li>
<li>Added an #_EDITEVENT placeholder  </li>
<li>Added Brazialian Portuguese localization and some translatable strings</li>
<li>Added a today scope for events lists</li>
<li>Increased to 3 te default lists limit</li>
<li>Categories are now displayed in the events table                        </li>
<li>Now weeks starts according to WP settings       </li>
<li>Moved the hide page option up for better access  </li>
<li>Attributes column was not created when the plugin was upgraded, fixed</li>
<li>Added comment field to the RSVP form and #_COMMENT placeholder in RSVP email templates </li>
<li>Added customizable title to small calendar      </li>
<li>Removed php short tags                        </li>
<li>Changed RVSP &#8216;no seats available message&#8217; for better English</li>
<li>Bugfix: there was a time bug</li>
<li>Bugfix: event_time not taken into consideration in ordering events, fixed</li>
<li>Bugfix: on calendar for days after 28  on the event calendar view</li>
<li>Bugfix: for events in days with single digit</li>
<li>Bugfix: events link in the calendar now work with permalink</li>
<li>Bugfix: today in next mont was not matched in the calendar </li>
<li>Bugfix: _RESPPHONE was not matched in emails</li>
<li>Bugfix: fixed security vulnerability, which could lead to sql inject attacks      </li>
<li>Bugfix: locations with apostrophe were duplicated</li>
<li>Bugfix: bloginfo(&#8216;wpurl&#8217;) instead of bloginfo(&#8216;url&#8217;)  </li>
<li>Bugfix: now loading textdomain in the new (not deprecated) way</li>
</ul>
<p>Most of the bugfixes, and some of the features, were sponsored by Sara of <a href="http://www.paperlantern.com/">Paperlantern</a>, to whom I am most grateful.</p>
<p>Also, I just got a haircut:</p>
<p><img src="http://davidebenini.it/wp-content/uploads/2010/03/Foto-del-61365666-03-2455260-alle-1702-300x225.jpg" alt="" title="Foto-del-61365666-03-2455260-alle-1702.jpg" width="300" height="225" class="aligncenter size-medium wp-image-547" /></p>
<p>Cheers,<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2010/03/04/events-manager-2-1/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Wordpress: disable moderation for a single comment</title>
		<link>http://davidebenini.it/2009/12/16/wordpress-disable-moderation-for-a-single-comment/</link>
		<comments>http://davidebenini.it/2009/12/16/wordpress-disable-moderation-for-a-single-comment/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 11:47:13 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[moderation]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=531</guid>
		<description><![CDATA[I am working an very complex portal based on Wordpress. The more I code, the more I befriend the functions.php file, where all my small tweaks reside. Last in the list (pun!) a super simple action to automatically approve comments belonging to a specific post (which I use as a guestbook):

function approve_guestbook_comments&#40;$comment_ID&#41; &#123;
	$comment = get_comment&#40;$comment_ID&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>I am working an very complex portal based on Wordpress. The more I code, the more I befriend the <code>functions.php</code> file, where all my small tweaks reside. Last in the list (pun!) a super simple action to automatically approve comments belonging to a specific post (which I use as a guestbook):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> approve_guestbook_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_ID</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$comment</span> <span style="color: #339933;">=</span> get_comment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_post_ID</span> <span style="color: #339933;">==</span> guestbook_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		wp_set_comment_status<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_ID</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'approve'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_post'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'approve_guestbook_comments'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>As you see it&#8217;s a super-simple tweak, but it&#8217;s quite effective.</p>
<p>Enjoy,<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/12/16/wordpress-disable-moderation-for-a-single-comment/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Mass import users into WP</title>
		<link>http://davidebenini.it/2009/11/30/mass-import-users-into-wp/</link>
		<comments>http://davidebenini.it/2009/11/30/mass-import-users-into-wp/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 18:04:09 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress users import]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=522</guid>
		<description><![CDATA[How to import a huge number of users into Wordpress]]></description>
			<content:encoded><![CDATA[<p>I am working on a complex blog/e-commerce system together with my colleagues at @ntw. I had to import some 10.000 users into WP. The task was easier than expected. The basic idea is leveraging on the <code>wp_insert_user($userdata)</code> function, defined in <code>wp-includes/registration.php</code>. If you look at the source, you&#8217;ll see that <code>$userdata</code> is an array containing a number of keys:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">*</span> The <span style="color: #000088;">$userdata</span> <span style="color: #990000;">array</span> can contain the following fields<span style="color: #339933;">:</span>
	<span style="color: #339933;">*</span> <span style="color: #0000ff;">'ID'</span> <span style="color: #339933;">-</span> An integer that will be used <span style="color: #b1b100;">for</span> updating an existing user<span style="color: #339933;">.</span>
	<span style="color: #339933;">*</span> <span style="color: #0000ff;">'user_pass'</span> <span style="color: #339933;">-</span> A string that contains the plain text password <span style="color: #b1b100;">for</span> the user<span style="color: #339933;">.</span>
	<span style="color: #339933;">*</span> <span style="color: #0000ff;">'user_login'</span> <span style="color: #339933;">-</span> A string that contains the user<span style="color: #0000ff;">'s username for logging in.
	* '</span>user_nicename<span style="color: #0000ff;">' - A string that contains a nicer looking name for the user.
	*		The default is the user'</span>s username<span style="color: #339933;">.</span></pre></div></div>

<p>The other keys are <code>user_url</code>,<code>user_email</code>, <code>display_name</code>, <code>nickname</code>, <code>first_name</code>, <code>last_name</code>, <code>description</code>, <code>rich_editing</code>, <code>user_registered</code>, <code>role</code>, <code>jabber</code>, <code>aim</code>, <code>yim</code>; for more detal consult the source itself.</p>
<p>My script goes like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'wp-blog-header.php'</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'wp-includes/registration.php'</span><span style="color: #339933;">;</span>   
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'wp-includes/pluggable.php'</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;memory_limit&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;1024M&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;max_execution_time&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;240&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;h1&gt;Importazione utenti EC&lt;/h1&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$connection</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;user&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Unable to connect to MySQL&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Unable to connect to the database&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM source_users ;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;strong&gt;ID:&lt;/strong&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;login:&lt;/strong&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;password:&lt;/strong&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">password</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;e-mail:&lt;/strong&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email_address</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;name:&lt;/strong&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;surname:&lt;/strong&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">surname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>  
		<span style="color: #666666; font-style: italic;">// Add the ID to trick WP</span>
		<span style="color: #000088;">$add_id</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;INSERT INTO &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">users</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; (id, user_login) VALUES (&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;,'&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$row-&gt;user_name</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' ); &quot;</span><span style="color: #339933;">;</span>
		 <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$add_id</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Add the rest</span>
		<span style="color: #000088;">$userdata</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		 <span style="color: #0000ff;">'ID'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">,</span>  
		 <span style="color: #0000ff;">'user_login'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_name</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'user_pass'</span> <span style="color: #339933;">=&gt;</span> wp_hash_password<span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'user_nicename'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_name</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'user_email'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email_address</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'first_name'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'last_name'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">surname</span><span style="color: #339933;">,</span>
		 <span style="color: #0000ff;">'role'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'subscriber'</span>
		<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                          
		wp_insert_user<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userdata</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connection</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Some highlights:</p>
<ul>
<li>Import all the WP files you need </li>
<li>Change PHP memory and time limits if you have many records</li>
<li>Explicitly encrypt the password with <code>wp_hash_password</code>. I have no idea why this is necessary, the WP code should do this by itself; but trust me, it is.</li>
</ul>
<p>Since we are using the <code>wp_insert_user()</code> function, WP will crate records both in the users and in the usermeta tables.</p>
<p>A last warning. This huge amount of users could conflict with your php settings. To get WP working properly I had to add this line to <code>wp-config.php</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_MEMORY_LIMIT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'64M'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Without it I could not get the users list in the admin session. I also <a href="http://core.trac.wordpress.org/ticket/11151">filed a bug</a>, but this last line should keep you on the safe side.<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/11/30/mass-import-users-into-wp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Events Manager comments disabled</title>
		<link>http://davidebenini.it/2009/08/10/events-manager-comments-disabled/</link>
		<comments>http://davidebenini.it/2009/08/10/events-manager-comments-disabled/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 13:06:56 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=515</guid>
		<description><![CDATA[Events Manager, Wordpress]]></description>
			<content:encoded><![CDATA[<p>Hi folks,<br />
just a quick note for warning that comments on EM are going to be disabled for a while.<br />
Why?<br />
Despite a disclaimer at the beginning of the post and a huge banner people is posting support problems as comments, instead that on the forum. I guess I should increase the banner size of make it flashy with JS.<br />
As soon as I have some time (not that sooinish) I&#8217;ll clean the thread and leave only relevant comments (pre-forum tweak suggestions and release announcements). And re-enable commenting.<br />
For now comments are closed. Use the forum, PLEASE!<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/08/10/events-manager-comments-disabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Say hello to Marcus AKA netweblogic</title>
		<link>http://davidebenini.it/2009/08/06/say-hello-to-marcus-aka-netweblogic/</link>
		<comments>http://davidebenini.it/2009/08/06/say-hello-to-marcus-aka-netweblogic/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 15:21:09 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[em]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=510</guid>
		<description><![CDATA[There's a new co-author for Events Manager]]></description>
			<content:encoded><![CDATA[<p>Great news for all ye Events Manager fans. Let us all say hello to Marcus Skyes that jumped on board, and is now co-authoring Events Manager.</p>
<p>Marcus contacted me a few weeks ago, sending a modded version of Events Manager. As soon as I gave it a try I realised that Marcus had done a wonderful job patching and integrating new features into EM. </p>
<p>Thanks to Marcus&#8217;s work now we have a number of frequently requested features:</p>
<ul>
<li>WP 2.8 support</li>
<li>Events Categories</li>
<li>WYSIWYG editor for events description (and you can add pictures too!)</li>
<li>multi-day events, kinda</li>
</ul>
<p>And much more.<sup>1</sup></p>
<p>Since Marcus is expanding the plugin for some of his gigs, I invited him to co-author Events Manager, and I am glad he accepted. </p>
<p>I just tagged EM 2.0rc2 with Marcus&#8217;s integration, hope you&#8217;ll enjoy it as much as I did.</p>
<p><a href="http://downloads.wordpress.org/plugin/events-manager.2.0rc2.zip">Download EM 2.0rc2<br />
</a></p>
<p>Davide</p>
<h4>Notes</h4>
<ol class="footnotes">
<li id="footnote_0_510" class="footnote">Since these features are not yet fully documented, I suggest you take a look at the change log in the readme for instructions.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/08/06/say-hello-to-marcus-aka-netweblogic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Introducing the Events Manager support forum</title>
		<link>http://davidebenini.it/2009/03/30/introducing-the-events-manager-support-forum/</link>
		<comments>http://davidebenini.it/2009/03/30/introducing-the-events-manager-support-forum/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 13:24:43 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=401</guid>
		<description><![CDATA[The Events Manager Support Forum is open!]]></description>
			<content:encoded><![CDATA[<p>Hey folks,<br />
just a quick note to announce the opening of the official <a href="http://davidebenini.it/events-manager-forum">Events Manager Support Forum</a>. </p>
<div style="text-align:center;"><img src="http://davidebenini.it/wp-content/uploads/2009/03/events-manager-support.png" alt="Events Manager Support.png" border="0" width="380" height="241" /></div>
<p>If you have any question about Events Manager 2.0, after checking out the <a href="http://davidebenini.it/wordpress-plugins/events-manager/">docs</a>, please register on the forum and post your questions there.</p>
<div style="text-align:center;"><img src="http://davidebenini.it/wp-content/uploads/2009/03/events-manager-support-2.png" alt="Events Manager Support 2.png" border="0" width="388" height="122" /></div>
<p>As you see there are 3 areas so far, bugs, how-to and feature requests. Enjoy!<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/03/30/introducing-the-events-manager-support-forum/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Events Manager 2.0 released</title>
		<link>http://davidebenini.it/2009/03/11/events-manager-20-released/</link>
		<comments>http://davidebenini.it/2009/03/11/events-manager-20-released/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 09:28:06 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Events Manager]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=370</guid>
		<description><![CDATA[Welcome Events Manager 2.0, a full featured solutions for Events Management in Wordpress ]]></description>
			<content:encoded><![CDATA[<p>Ladies and gentleman, <a href="http://davidebenini.it/wordpress-plugins/events-manager/">Events Manager 2.0</a> has been finally released. </p>
<p><a href="http://davidebenini.it/wordpress-plugins/events-manager/"><img src="http://davidebenini.it/wp-content/uploads/2009/03/events-manager-nutsmuggling-1.jpg" alt="Events Manager | Nutsmuggling-1.jpg" border="0" width="294" height="46" /></a></p>
<p>Events Manager 2.0 is loaded with new features, like Recurring Events, Location Management and RSVP. There&#8217;s also a new multi-location map. </p>
<div style="text-align:center;"><img src="http://davidebenini.it/wp-content/uploads/2009/03/global-map-test-blog.jpg" alt="Global Map « Test Blog.jpg" border="0" width="464" height="402" /></div>
<p>Events manager has been brought to you by yours truly, thanks to the sponsorship of <a href="http://rzen.net">Brian Richards</a> and <a href="http://www.dennisonwolfe.com/">Tyler Suchmann</a>. A special thanks also to <a href="http://www.fieldii.com/">Ben Dunkle</a> who has created the plugin menu icon.</p>
<p>Go get Events Manager 2.0 Beta, try it out and drop me a comment here or on the <a href="http://davidebenini.it/wordpress-plugins/events-manager/">support page</a>.<br />
Enjoy,<br />
Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/03/11/events-manager-20-released/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Plugins List 1.0 is out</title>
		<link>http://davidebenini.it/2009/03/06/plugins-list-10-is-out/</link>
		<comments>http://davidebenini.it/2009/03/06/plugins-list-10-is-out/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 08:56:55 +0000</pubDate>
		<dc:creator>Davide</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plugins list]]></category>
		<category><![CDATA[wordpress plugins]]></category>

		<guid isPermaLink="false">http://davidebenini.it/?p=338</guid>
		<description><![CDATA[Hey folks,
I finally managed to put my hands on Plugins List and here&#8217;s the long overdue 1.0 version.
I am ashamed to confess that the Shortcodes API introduction had gone unnoticed, so I hadn&#8217;t realised that everything I needed to make the plugin more flexible was there already. Bad me. As soon as I started experimenting [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks,<br />
I finally managed to put my hands on Plugins List and here&#8217;s the long overdue <a href="http://davidebenini.it/wordpress-plugins/plugins-list/">1.0 version</a>.</p>
<p>I am ashamed to confess that the <a href="http://codex.wordpress.org/Shortcode_API">Shortcodes API</a> introduction had gone unnoticed, so I hadn&#8217;t realised that everything I needed to make the plugin more flexible was there already. Bad me. As soon as I started experimenting with shortcodes I realised I had to migrate <em>Plugins List</em> code. And <a href="http://davidebenini.it/wordpress-plugins/plugins-list/">here&#8217;s the result</a>.</p>
<p>What&#8217;s new? Basically now you can specify the amount of data you want displayed. So, let&#8217;s say you just want a simple list with the plugin titles. You just need to do this:</p>
<p>[<code>plugins_list format='&lt;li&gt;#LinkedTitle#&lt;/li&gt;']</code></p>
<p>The placeholders available are </p>
<ul>
<li><code>#Title#</code> </li>
<li><code>#PluginURI#</code> </li>
<li><code>#Author#"</code> </li>
<li><code>#AuthorURI#</code></li>
<li><code>#Version#</code></li>
<li><code>#Description#</code></li>
<li><code>#LinkedTitle#</code></li>
<li><code>#LinkedAuthor#</code> </li>
</ul>
<p>I guess their meaning is self-evident. If you don't specify the format parameter you'll the default format, thesame as <em>Plugins List</em> 0.2.2.</p>
<p>By default, <em>Plugins List</em> only shows your active plugins. If you want to have your inactive plugins displayed as well, add the argument <code>show_inactive='true'</code>, like this:</p>
<p>[<code>plugins_list show_inactive='true']</code></p>
<p>Obviously you can freely combine <code>show_inactive</code> and <code>format</code>.</p>
<p><strong>A note for upgraders</strong>: I have changed the shortcode to conform to the Wordpress standards. Make sure you add an underscore. It was [<code>plugins list]</code>, now it is [<code>plugins_list</code>]. The option to show inactive plugins has also changed, see the previous example.</p>
<p>If you haven't tried <em>plugins List</em> yet, you can download it <a href="http://davidebenini.it/wordpress-plugins/plugins-list/">here</a>.</p>
<p>Enjoy!</p>
<p>Davide</p>
]]></content:encoded>
			<wfw:commentRss>http://davidebenini.it/2009/03/06/plugins-list-10-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
