summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-11-01 15:13:11 -0500
committerEvan Prodromou <evan@status.net>2009-11-01 15:13:11 -0500
commitf72857d73e40cbf8034b1f1ff763dc75a4025d79 (patch)
tree06cd9227a5db0d3179f1d021b4c9853402117123
parent7701bc2e564306590694a2d9ba71ffad85d219f2 (diff)
show profile flag form when showing profile list or profile page
-rw-r--r--plugins/UserFlag/UserFlagPlugin.php51
1 files changed, 41 insertions, 10 deletions
diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php
index ccb1fae47..003c066af 100644
--- a/plugins/UserFlag/UserFlagPlugin.php
+++ b/plugins/UserFlag/UserFlagPlugin.php
@@ -98,24 +98,55 @@ class UserFlagPlugin extends Plugin
return true;
}
- function onAutoload($cls)
+ function onAutoload($cls)
{
switch ($cls)
{
- case 'FlagnoticeAction':
- case 'FlagprofileAction':
- case 'AdminnoticeflagAction':
- case 'AdminprofileflagAction':
+ case 'FlagnoticeAction':
+ case 'FlagprofileAction':
+ case 'AdminnoticeflagAction':
+ case 'AdminprofileflagAction':
require_once(INSTALLDIR.'/plugins/UserFlag/' . strtolower(mb_substr($cls, 0, -6)) . '.php');
return false;
- case 'User_flag_notice':
- case 'Notice_flag':
- case 'User_flag_profile':
- case 'Profile_flag':
+ case 'FlagProfileForm':
+ require_once(INSTALLDIR.'/plugins/UserFlag/' . strtolower($cls . '.php'));
+ return false;
+ case 'User_flag_notice':
+ case 'Notice_flag':
+ case 'User_flag_profile':
+ case 'Profile_flag':
require_once(INSTALLDIR.'/plugins/UserFlag/'.$cls.'.php');
return false;
- default:
+ default:
return true;
}
}
+
+ function onEndProfilePageActionsElements(&$action, $profile)
+ {
+ $user = common_current_user();
+
+ if (!empty($user)) {
+
+ $form = new FlagProfileForm($action, $profile);
+
+ $form->show();
+ }
+
+ return true;
+ }
+
+ function onEndProfileListItemActionElements($item)
+ {
+ $user = common_current_user();
+
+ if (!empty($user)) {
+
+ $form = new FlagProfileForm($item->action, $item->profile);
+
+ $form->show();
+ }
+
+ return true;
+ }
}