summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-11-20 15:35:28 -0500
committerEvan Prodromou <evan@prodromou.name>2008-11-20 15:35:28 -0500
commit168693b103c17f0e98f2e02854d7290f59f0cfb5 (patch)
tree7fb93218b0496045a3adb3b14f8dbb734c69941b /lib
parenta8b7d0a7b5c5f22d11eafd0cd5d8adf1f1fd399f (diff)
common_(un)subscribe_form
darcs-hash:20081120203528-84dde-2b8d14a491ea4d44bebfdd4e4a3041dde3b375c1.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/profilelist.php10
-rw-r--r--lib/util.php16
2 files changed, 20 insertions, 6 deletions
diff --git a/lib/profilelist.php b/lib/profilelist.php
index ebc974d6b..b8f52fd8f 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -95,6 +95,16 @@ class ProfileList {
common_raw($this->highlight($this->profile->bio));
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');
}
diff --git a/lib/util.php b/lib/util.php
index 950a74733..efce283a9 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -1896,11 +1896,13 @@ function common_nudge_form($profile) {
common_element_end('form');
}
-function common_subscribe_form() {
- common_element_start('form', array('id' => 'subscribe', 'method' => 'post', 'class' => 'subscribe',
+function common_subscribe_form($profile) {
+ common_element_start('form', array('id' => 'subscribe-' . $profile->nickname,
+ 'method' => 'post',
+ 'class' => 'subscribe',
'action' => common_local_url('subscribe')));
common_hidden('token', common_session_token());
- common_element('input', array('id' => 'subscribeto',
+ common_element('input', array('id' => 'subscribeto-' . $profile->nickname,
'name' => 'subscribeto',
'type' => 'hidden',
'value' => $profile->nickname));
@@ -1910,11 +1912,13 @@ function common_subscribe_form() {
common_element_end('form');
}
-function common_unsubscribe_form() {
- common_element_start('form', array('id' => 'unsubscribe', 'method' => 'post', 'class' => 'unsubscribe',
+function common_unsubscribe_form($profile) {
+ common_element_start('form', array('id' => 'unsubscribe-' . $profile->nickname,
+ 'method' => 'post',
+ 'class' => 'unsubscribe',
'action' => common_local_url('unsubscribe')));
common_hidden('token', common_session_token());
- common_element('input', array('id' => 'unsubscribeto',
+ common_element('input', array('id' => 'unsubscribeto-' . $profile->nickname,
'name' => 'unsubscribeto',
'type' => 'hidden',
'value' => $profile->nickname));