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’t show up in the list is a bit difficult so it was sort of a deal breaker.
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 “0″ user that doesn’t really exist. So basically, you have to add a little code to the /auth/LDAP/lib.php and then your LDAP created users will work wonderfully.
Basically, I slightly modified a post that I found on the Elgg forums.
1. Find line 153:
$user_id = insert_record(‘users’,$user);
2. Add the following below:
// adds “virtual” friend, so that user has at least one connection, and shows up in the browse feature.
$newid = user_info_username(‘ident’, $username);
$owner = 0;
$f = new StdClass;
$f->owner = $owner;
$f->friend = $newid;
$f->status = ‘perm’;
insert_record(‘friends’,$f);
The additionally code simple grabs the new users “ident” from the User table and inserts a friend record with the shadowy “0″ user.
Now, if I can just figure out how to setup the tag cloud to work correctly.