From eb9715992cee6d06e520cf8826b7fb0d70db5871 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 16 Jul 2008 11:25:11 -0400 Subject: utility function for getting a profile URI I added a utility function for getting a profile URI. At some point we need to push commonalities between Remote_profile and User into the Profile class; single-table inheritance. We do a lot of switching around for no good reason on users and profiles. darcs-hash:20080716152511-84dde-6f73d947d11083e7235756fde635e145f02e2483.gz --- lib/util.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 1b672561f..997f32430 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1292,4 +1292,20 @@ function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) { return common_default_avatar($size); } } - \ No newline at end of file + +function common_profile_uri($profile) { + if (!$profile) { + return NULL; + } + $user = User::staticGet($profile->id); + if ($user) { + return $user->uri; + } + + $remote = Remote_profile::staticGet($profile->id); + if ($remote) { + return $remote->uri; + } + # XXX: this is a very bad profile! + return NULL; +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf