- if (!empty($nb)) {
- $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
- $class = 'hentry notice bookmark';
- if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
- $class .= ' limited-scope';
- }
- $nli->out->elementStart('li', array('class' => $class,
- 'id' => 'notice-' . $id));
- Event::handle('EndOpenNoticeListItemElement', array($nli));
+
+ if (empty($nb)) {
+ $this->log(LOG_INFO, "Notice {$nli->notice->id} has bookmark class but no matching Bookmark record.");
+ return true;
+ }
+
+ $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
+ $class = 'hentry notice bookmark';
+ if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
+ $class .= ' limited-scope';
+ }
+ $nli->out->elementStart('li', array('class' => $class,
+ 'id' => 'notice-' . $id));
+
+ Event::handle('EndOpenNoticeListItemElement', array($nli));
+ return false;
+ }
+
+ /**
+ * Modify the default menu to link to our custom action
+ *
+ * Using event handlers, it's possible to modify the default UI for pages
+ * almost without limit. In this method, we add a menu item to the default
+ * primary menu for the interface to link to our action.
+ *
+ * The Action class provides a rich set of events to hook, as well as output
+ * methods.
+ *
+ * @param Action $action The current action handler. Use this to
+ * do any output.
+ *
+ * @return boolean hook value; true means continue processing, false means stop.
+ *
+ * @see Action
+ */
+ function onEndPersonalGroupNav($action)
+ {
+ $this->user = common_current_user();
+
+ if (!$this->user) {
+ // TRANS: Client error displayed when trying to display bookmarks for a non-existing user.
+ $this->clientError(_('No such user.'));