Well it’s been a little while since I’ve blogged anything about Elgg, hasn’t it?
So, here’s a quick plugin that enables you to switch on a simple per-user link tracking for selected divs within your site.
I wrote this as I needed to quickly track links within certain sections of a site (rather than everywhere, where something like Piwik would have been more appropriate).
Hopefully it’s useful to you!
» Visit the project on Github...
A few months ago I wrote a bit about extending your Known plugins to support console functionality. I’ve recently pushed a patch which will make this functionality even more useful.
Previously, you could only have one console command available to your regular Known plugin, this was of course limiting. Now, you can have multiple!
Create a directory
Console within your plugin’s home directory. Then fill it with one or more classes, which extend
\Idno\Common\ConsolePlugin, one for each command you want to export. The format of this is exactly the same as those for any other console plugin.
The Known framework has the ability to execute commands from the console, which is kind of cool and enables, among other things, stuff like these console development tools.
You can see what commands are currently available by going to the console, navigate to your Known directory, and execute
The commands available can be added to in two ways…
Create a pure console plugin
If you look in
ConsolePlugins you’ll see a plugin called
Example, which probably tells you all you need to know.. but in summary:
- Create a subdirectory for your plugin in
ConsolePlugins (or at least copy/symlink it there later)
- Create a
Main.php file, containing a class called
Main which extends the class
- Implement the abstract methods:
getCommand() the command name you are providing
getDescription() the description of the command
getParameters() a method returning an array of the command’s parameters
execute() your actual code
And you’re done!
Add a console plugin to a regular Known plugin
If you’re using the most recent build of Known from github, you can also add a console command to an existing traditional Known plugin (i.e. those sitting in
IdnoPlugins/*). To do this, create a class called
ConsoleMain that extends
\Idno\Common\ConsolePlugin and save it in a file called
ConsoleMain.php sitting along side your regular