Book Image

Elgg 1.8 Social Networking

By : Cash Costello
Book Image

Elgg 1.8 Social Networking

By: Cash Costello

Overview of this book

As an updated version of the first ever Elgg book, this is an excellent resource for those interested in Elgg development due to its attention to detail, clearly written style and knowledgeable author. - Dave Tosh, Elgg co-founder. In his book, Cash Costello makes full use of his skills in development and communication to tackle the complex subject of Elgg social networking. This easy-to-read guide gives end users, new developers, and old pros alike a solid base to start their venture into social media with Elgg. I highly recommend it as a useful and enjoyable read. - Brett Profitt, Elgg Lead Developer The web is becoming increasingly social as millions of people use it to blog, share, post, 'friend', 'unfriend' (which was made the Oxford word of the year in 2009), comment, and chat. Elgg ñ your award-winning open source social networking engine ñ is tailor-made to create any social networking or social media website you can imagine. If you want to create a social networking website from scratch using Elgg, then this book is exactly what you need.Elgg 1.8 Social Networking covers everything you need to know about building a social networking site with Elgg. It begins with instructions for installing Elgg, continues with a guided tour of its capabilities, and finishes with practical advice on deploying Elgg on a production server. And in between, it is packed with information on configuring and customizing Elgg through plugins and themes.This book is a learn-by-doing guide to creating your own social networking site. It includes three sample case studies on how Elgg could be used as an e-learning tool, an intranet application for organizations, and a niche social networking site. Step by step it takes you through the installation, configuration, and customization of Elgg. Valuable advice is sprinkled throughout the book to enable you to build your site like an expert. For developers, this book provides a multitude of options. First, there is a tutorial-based section that systematically teaches you how to build plugins. Soon you will have ten plugins for use on your site in addition to all the knowledge you have gained. Second, if you prefer a quick overview, this book has an appendix that describes Elgg using the terminology and design patterns common in web development. Third, if you are interested in creating a theme, it also includes a design tutorial and a catalog of Elgg's view templates. The book then goes on to describe what is involved in running a production website. It has sections on selecting a hosting provider, configuring and tuning the server, backing up the site, and dealing with spammers.
Table of Contents (21 chapters)
Elgg 1.8 Social Networking
About the Author
About the Author of 1st edition
About the Reviewers

Events and hooks

Elgg's events and plugin hooks are an important part of the platform's extensibility. Plugins register functions that are called when an event occurs or a hook is triggered. Through these callback functions, plugins change or extend the functionality of Elgg's engine.

There is overlap between the functionality of events and plugin hooks. Broadly, they can be described as follows:

  • Elgg events notify the registered callback function that something has happened

  • Plugin hooks give callback functions the opportunity to change something that the core has done

The callback functions are called handlers, but do not confuse them with page handlers.

Elgg events

Event handlers are registered with the function elgg_register_event_handler():

elgg_register_event_handler('pagesetup', 'system', 'blog_page_setup');

Multiple handlers can be registered for an event. Each event is identified by two words ('pagesetup' and 'system' in this example). The handler is passed a single object involved in the event. If a blog post has been saved, then it is the blog object. If a comment has been posted, then it is the annotation object. Returning false prevents any other event handlers from running and may stop the core from carrying out its current task.

Plugin hooks

Plugin hook handlers are registered with the function elgg_register_plugin_hook_handler():

elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'twitter_api_public_pages');

Plugin hook handlers are passed a return value and other data associated with the hook. The handler function can return the original return value, a modified version, or something completely different.

Event handlers and plugin hooks do not all operate in the same manner. It is best to check the code and comments where the event or hook is triggered before attempting to use one. Possible events and hooks are found by searching the code for elgg_trigger_event() and elgg_trigger_plugin_hook().

Code location

Functions: /engine/lib/elgglib.php