common_(un)subscribe_form
darcs-hash:20081120203528-84dde-2b8d14a491ea4d44bebfdd4e4a3041dde3b375c1.gz
This commit is contained in:
parent
a8b7d0a7b5
commit
168693b103
|
@ -95,6 +95,16 @@ class ProfileList {
|
||||||
common_raw($this->highlight($this->profile->bio));
|
common_raw($this->highlight($this->profile->bio));
|
||||||
common_element_end('p');
|
common_element_end('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = common_current_user();
|
||||||
|
if ($user) {
|
||||||
|
if ($user->isSubscribed($this->profile)) {
|
||||||
|
common_unsubscribe_form($profile);
|
||||||
|
} else {
|
||||||
|
common_subscribe_form($profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
common_element_end('li');
|
common_element_end('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
lib/util.php
16
lib/util.php
|
@ -1896,11 +1896,13 @@ function common_nudge_form($profile) {
|
||||||
common_element_end('form');
|
common_element_end('form');
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_subscribe_form() {
|
function common_subscribe_form($profile) {
|
||||||
common_element_start('form', array('id' => 'subscribe', 'method' => 'post', 'class' => 'subscribe',
|
common_element_start('form', array('id' => 'subscribe-' . $profile->nickname,
|
||||||
|
'method' => 'post',
|
||||||
|
'class' => 'subscribe',
|
||||||
'action' => common_local_url('subscribe')));
|
'action' => common_local_url('subscribe')));
|
||||||
common_hidden('token', common_session_token());
|
common_hidden('token', common_session_token());
|
||||||
common_element('input', array('id' => 'subscribeto',
|
common_element('input', array('id' => 'subscribeto-' . $profile->nickname,
|
||||||
'name' => 'subscribeto',
|
'name' => 'subscribeto',
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'value' => $profile->nickname));
|
'value' => $profile->nickname));
|
||||||
|
@ -1910,11 +1912,13 @@ function common_subscribe_form() {
|
||||||
common_element_end('form');
|
common_element_end('form');
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_unsubscribe_form() {
|
function common_unsubscribe_form($profile) {
|
||||||
common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post', 'class' => 'unsubscribe',
|
common_element_start('form', array('id' => 'unsubscribe-' . $profile->nickname,
|
||||||
|
'method' => 'post',
|
||||||
|
'class' => 'unsubscribe',
|
||||||
'action' => common_local_url('unsubscribe')));
|
'action' => common_local_url('unsubscribe')));
|
||||||
common_hidden('token', common_session_token());
|
common_hidden('token', common_session_token());
|
||||||
common_element('input', array('id' => 'unsubscribeto',
|
common_element('input', array('id' => 'unsubscribeto-' . $profile->nickname,
|
||||||
'name' => 'unsubscribeto',
|
'name' => 'unsubscribeto',
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'value' => $profile->nickname));
|
'value' => $profile->nickname));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user