<?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>edsysad.org &#187; hack</title>
	<atom:link href="http://edsysad.org/tag/hack/feed/" rel="self" type="application/rss+xml" />
	<link>http://edsysad.org</link>
	<description>another ed blogger....</description>
	<lastBuildDate>Sat, 28 Jan 2012 03:22:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Moodle LDAP and Email Hack</title>
		<link>http://edsysad.org/2010/10/01/moodle-ldap-and-email/</link>
		<comments>http://edsysad.org/2010/10/01/moodle-ldap-and-email/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 05:34:04 +0000</pubDate>
		<dc:creator>Andrew Chlup</dc:creator>
				<category><![CDATA[Moodle]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://edsysad.org/?p=237</guid>
		<description><![CDATA[So all of our teachers have their email address in LDAP, but some students did not. This causes all sorts of problems when the student logs in the first time. I realized that it would be easy enough to edit the file that creates new accounts to automatically insert an email address if the new [...]]]></description>
			<content:encoded><![CDATA[<p>So all of our teachers have their email address in LDAP, but some students did not. This causes all sorts of problems when the student logs in the first time.</p>
<p>I realized that it would be easy enough to edit the file that creates new accounts to automatically insert an email address if the new email field is blank.</p>
<p>1. Navigate to &lt;moodle_root&gt;/lib/moodlelib.php</p>
<p>2. Edit the file by adding the logic below:</p>
<pre style="padding-left: 30px;">/**Removed (not) from line below and commented out text to automatically create a valid email address**/
 if (empty($newuser-&gt;email)) {
 /*if (email_is_not_allowed($newuser-&gt;email)) {
 unset($newuser-&gt;email);
 }*/
 //This automatically creates email address based upon your domain.
 $newuser-&gt;email = $username . "@your.domain";
 }</pre>
<p>3. Now when users login and don&#8217;t have email, they are automatically assigned an email. This same trick can be used if your students don&#8217;t have true email accounts.</p>
<p>I can&#8217;t remember which line you begin editing but you can find it by searching for &#8220;if (!empty($newuser-&gt;email)) {&#8220;.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsysad.org/2010/10/01/moodle-ldap-and-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elgg LDAP Problem Solved&#8230;</title>
		<link>http://edsysad.org/2008/03/04/elgg-ldap-problem-solved/</link>
		<comments>http://edsysad.org/2008/03/04/elgg-ldap-problem-solved/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 03:17:22 +0000</pubDate>
		<dc:creator>Andrew Chlup</dc:creator>
				<category><![CDATA[Elgg]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[ldap]]></category>

		<guid isPermaLink="false">http://edsysad.org/2008/03/04/elgg-ldap-problem-solved/</guid>
		<description><![CDATA[As I was experimenting with Elgg and LDAP, I realized that none of the users create via LDAP authentication would so up in browse until somebody added them as a friend. Of course adding somebody who doesn&#8217;t show up in the list is a bit difficult so it was sort of a deal breaker. It [...]]]></description>
			<content:encoded><![CDATA[<p>As I was experimenting with Elgg and LDAP, I realized that none of the users create via LDAP authentication would so up in browse until somebody added them as a friend. Of course adding somebody who doesn&#8217;t show up in the list is a bit difficult so it was sort of a deal breaker.</p>
<p>It turns out that the friends able is used someway in the browse feature and users that register themselves are automatically made friends with a &#8220;0&#8243; user that doesn&#8217;t really exist. So basically, you have to add a little code to the <em>/auth/LDAP/lib.php  </em>and then your LDAP created users will work wonderfully.</p>
<p>Basically, I slightly modified a post that I found on the <a href="http://elgg.org/mod/vanillaforum/vanilla/comments.php?DiscussionID=619" title="Elgg Forums">Elgg forums</a>.</p>
<p>1. Find line 153:</p>
<blockquote><p>$user_id = insert_record(&#8216;users&#8217;,$user);</p></blockquote>
<p>2. Add the following below:</p>
<blockquote><p>    // adds &#8220;virtual&#8221; friend, so that user has at least one connection, and shows up in the browse feature.<br />
$newid = user_info_username(&#8216;ident&#8217;, $username);<br />
$owner = 0;<br />
$f = new StdClass;<br />
$f-&gt;owner = $owner;<br />
$f-&gt;friend = $newid;<br />
$f-&gt;status = &#8216;perm&#8217;;</p>
<p>insert_record(&#8216;friends&#8217;,$f);</p></blockquote>
<p>The additionally code simple grabs the new users &#8220;ident&#8221; from the User table and inserts a friend record with the shadowy &#8220;0&#8243; user.</p>
<p>Now, if I can just figure out how to setup the tag cloud to work correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://edsysad.org/2008/03/04/elgg-ldap-problem-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

