Getting the hang of writing s9y plugins
Continuing on with the custom s9y hack to allow multiple users, I've noticed that I can create plugins that display different content, depending on the currently displayed user, by looking at the global variable s9y generates: $uInfo[0]['authorid']. This holds the authorid of the user whose page you have open, rather than the currently logged-in user. Using this, I can create all sorts of user preferences (Wish List links, a picture, etc.) and have the author's preference displayed by my own custom serendipity_plugin.
That makes things a hell of a lot easier than trying to hack things like that into s9y's main codebase, while still getting all of the access I need to my own global variables and database connection. The plugin I just wrote takes up all of 40 lines, with only 14 lines to the method that checks for that ID, loads the user's preference, and displays the formatted link.

0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home