'type' => 'hidden',
'value' => $id));
+ foreach ($this->args as $k => $v) {
+ if (substr($k, 0, 9) == 'returnto-') {
+ common_hidden($k, $v);
+ }
+ }
+
common_submit('no', _('No'));
common_submit('yes', _('Yes'));
$block->query('COMMIT');
- common_redirect(common_local_url('subscribers',
- array('nickname' => $cur->nickname)));
+ # Now, gotta figure where we go back to
+
+ foreach ($this->args as $k => $v) {
+ if ($k == 'returnto-action') {
+ $action = $v;
+ } else if (substr($k, 0, 9) == 'returnto-') {
+ $args[$k] = substr($k, 9);
+ }
+ }
+
+ if ($action) {
+ common_redirect(common_local_url($action, $args));
+ } else {
+ common_redirect(common_local_url('subscriptions',
+ array('nickname' => $cur->nickname)));
+ }
}
}
common_profile_new_message_nudge($cur, $user, $profile);
if ($cur) {
- common_element_start('li', array('id' => 'profile_block'));
- common_block_form($profile);
+ $blocked = $cur->hasBlocked($profile);
+ common_element_start('li', array('id' => ($blocked) ? 'profile_unblock' : 'profile_block'));
+ if ($blocked) {
+# common_unblock_form($profile, array('action' => 'showstream',
+# 'nickname' => $profile->nickname));
+ } else {
+ common_block_form($profile, array('action' => 'showstream',
+ 'nickname' => $profile->nickname));
+ }
common_element_end('li');
}
return ($from == $to);
}
-function common_block_form($profile) {
+function common_block_form($profile, $args=NULL) {
common_element_start('form', array('id' => 'block-' . $profile->id,
'method' => 'post',
'class' => 'block',
'class' => 'submit',
'name' => 'block',
'value' => _('Block')));
+ if ($args) {
+ foreach ($args as $k => $v) {
+ common_hidden('returnto-' . $k, $v);
+ }
+ }
common_element_end('form');
return;
}