function showSubscribeForm() { $this->out->elementStart('li'); if (Event::handle('StartSubscribePeopletagForm', array($this->out, $this->peopletag))) { if ($this->current) { if ($this->peopletag->hasSubscriber($this->current->id)) { $form = new UnsubscribePeopletagForm($this->out, $this->peopletag); $form->show(); } else { $form = new SubscribePeopletagForm($this->out, $this->peopletag); $form->show(); } } Event::handle('EndSubscribePeopletagForm', array($this->out, $this->peopletag)); } $this->out->elementEnd('li'); }
/** * Handle the request * * On POST, add the current user to the group * * @param array $args unused * * @return void */ function handle($args) { parent::handle($args); $cur = common_current_user(); try { Profile_tag_subscription::add($this->peopletag, $cur); } catch (Exception $e) { // TRANS: Server error displayed subscribing to a list fails. // TRANS: %1$s is a user nickname, %2$s is a list, %3$s is the error message (no period). $this->serverError(sprintf(_('Could not subscribe user %1$s to list %2$s: %3$s'), $cur->nickname, $this->peopletag->tag), $e->getMessage()); } if ($this->boolean('ajax')) { $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); // TRANS: Title of form to subscribe to a list. // TRANS: %1%s is a user nickname, %2$s is a list, %3$s is a tagger nickname. $this->element('title', null, sprintf(_('%1$s subscribed to list %2$s by %3$s'), $cur->nickname, $this->peopletag->tag, $this->tagger->nickname)); $this->elementEnd('head'); $this->elementStart('body'); $lf = new UnsubscribePeopletagForm($this, $this->peopletag); $lf->show(); $this->elementEnd('body'); $this->endHTML(); } else { common_redirect(common_local_url('peopletagsubscribers', array('tagger' => $this->tagger->nickname, 'tag' => $this->peopletag->tag)), 303); } }