summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormoshe weitzman2004-10-19 02:27:01 (GMT)
committer moshe weitzman2004-10-19 02:27:01 (GMT)
commitbc9ea81da13764da7b5f675e5d3a43e3dc1c0e22 (patch)
treea1006fcbca585088a02d78df1d4c75c0856fb768
parent5e6adf89ed5efb20f4beaae9c8e583be752c1ad9 (diff)
new buddylist_select() for use outside this module
-rw-r--r--buddylist.module13
1 files changed, 13 insertions, 0 deletions
diff --git a/buddylist.module b/buddylist.module
index 609b89e..7be76b7 100644
--- a/buddylist.module
+++ b/buddylist.module
@@ -32,6 +32,19 @@ function buddylist_get_buddies($uid = NULL) {
return $buddies[$uid];
}
+// a simple single select box suitable for use in a block or in theme, or in other module, for example
+function buddylist_select() {
+ global $user;
+
+ if ($buddies = buddylist_get_buddies()) {
+ foreach ($buddies as $buddy) {
+ $options[$buddy->uid] = $buddy->name;
+ }
+ $output = form_select('', 'buddy', $edit['buddy'] ? $edit['buddy'] : '', $options);
+ return $output;
+ }
+}
+
/**
* Implementation of hook_settings
*/