My Blog

contains PHP and other web related content. (Sometimes there are some off topic things - don't freak out!)

Posts Tagged ‘elgg’

Elgg Plugin: Friend AutoComplete Box Replaces Select Box

Sunday, May 31st, 2009

One of the most irritating things to me about the Elgg messaging plugin is the requirement to choose my friends from the select box. This SHOULD be generated using the input/pulldown view in Elgg. Unfortunately, they are doing it by hand. However, I’ve patched my plugin to do it using the proper view. Then, I wanted to have an Auto Complete type box to choose a friend. With JQuery I was able to do this. Check out the specs and download below:

What This Plugin Solves:

This plugin extends the input/pulldown view in Elgg to create an Autocomplete box instead (theoretically, this could be used for any pulldown, not just friends).

How do I use it?

Imagine you have a view in Elgg that uses the following code:

1
2
$friends = amazing_function_formats_this($_SESSION['user']->getFriends());
echo elgg_view('input/pulldown', array('name'=>'friends', 'options_values'=>$friends);

This generates a pull down that will have the option text the friend name, and the option value – the friend GUID.

To use this plugin, enable it – and then modify the elgg_view statement like so:

1
2
$friends = amazing_function_formats_this($_SESSION['user']->getFriends());
echo elgg_view('input/pulldown', array('class'=>'OHT_ElggFriendsAutocomplete', 'name'=>'friends', 'options_values'=>$friends);

What Happens?

The plugin automatically hides the select box and displays the autocomplete input field using all of the select box options as values to suggest. Then, when a proper option is selected, the hidden select box value gets updated to the value correlated to the text that was typed. Pretty simple and unobtrusive!

Do I Have to Do Anything Different?

Just add the class to the pulldown – and you should be good to go.

Ok Let Me Download It!

OK here: Elgg Friends AutoComplete

Elgg Plugin: Generate Groups

Monday, May 4th, 2009

The Elgg Generate Users Plugin made me wonder why there was no group functionality… So…

Enter the Elgg Group Generation Plugin

This plugin has the following functionality:

  • Creates Groups
  • Adds Group Images
  • Joins existing members to groups
  • Fills in some group descriptions

More about this after the file download:
Elgg Generate Groups

Creates Groups

Since I didn’t see any easy way to create a massive amount of groups, this plugin does it. Specify how many groups to create and that’s all.

Adds Group Images

Normally, you can specify a group image or leave it blank. If you choose to have group images added to your automatically created groups, 2 out of 3 groups will have one of the random avatars as their group image.

Join Existing Members To Group

After a successful group creation, the plugin will join a random amount of unique members of that site to each group.

Fill in some group information

Other group information like short description and description are automatically filled in – along with group name. These are random bits of information. For any other hook that is associated with the group, there is an option to enable or disable it for the group generation – just like normal creation. There is another feature called mixed/random which chooses one of the previous two choices randomly for each group.

Elgg Development Tools – Elgg Plugin

Friday, April 24th, 2009

After working some with the open source Community building application Elgg, I found some settings to be irritating. I had to keep hacking my plugins to get these settings activated the way I wanted. Also, I really wanted to put useful settings in the same location.

Enter The Elgg Development Tools Plugin

This plugin has the following functionality:

  • Integrates FirePHP
  • Quick option to turn off view caching
  • Changes Error Reporting/Display
  • Copies other useful dev settings to one place

More about this after the file download:
Elgg Dev Tools

Integrates FirePHP

The package includes the latest distribution of FirePHP. When you enable FirePHP in the admin control panel under the Dev tools option, you can now use the FirePHP functionality in your plugins. Sometimes coders remember to turn off the functionality later, but forget to remove all of the FirePHP calls. A mock FB class is created to handle this – it basically accepts any method call and logs an error in the error log that you still have that line in there.

Turn off View Caching

Normally, you have to either run the update.php script or enable/disable your plugin. During development, this got super irritating. Instead, enable this option. It will make the site run a bit slower, but you won’t have to keep enabling/disabling the plugin when you add new views.

Display Errors

By default, Elgg hides the errors in the .htaccess file. This will turn them back on without editing the elgg installation.

Other Useful Dev Settings

I always forgot where simple cache options were. I copied the setting to the plugin as well. It basically does the same thing as under site admin. I find it useful to have all of these settings in one place.

Any feedback is greatly appreciated.

  • twitter loader

Follow me on twitter: @aaronsaray

The views on this website are my own and do not reflect the opinions of my employer or clients.
Creative Commons License Home | Open Source | Book | Music | Art | Bio | Resume | Contact
My Baby