aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-27 17:00:23 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-27 17:00:23 +0000
commitd33b1210925eb4077b582e0c17875103c09772c2 (patch)
tree3af0f44a1f4434f18162c8a3d478613fa60ef291
parentc3fc445ccbc590ec930fe56e5756b88bddb13259 (diff)
downloadelgg-d33b1210925eb4077b582e0c17875103c09772c2.tar.gz
elgg-d33b1210925eb4077b582e0c17875103c09772c2.tar.bz2
Removing WSOD errors in groups
git-svn-id: https://code.elgg.org/elgg/trunk@2317 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/groups/actions/leave.php14
-rw-r--r--mod/groups/start.php3
-rw-r--r--mod/groups/views/default/forum/topicposts.php18
-rw-r--r--mod/groups/views/default/forum/topics.php3
-rw-r--r--mod/groups/views/default/object/groupforumtopic.php6
5 files changed, 29 insertions, 15 deletions
diff --git a/mod/groups/actions/leave.php b/mod/groups/actions/leave.php
index e28b1bb97..33ba398ba 100644
--- a/mod/groups/actions/leave.php
+++ b/mod/groups/actions/leave.php
@@ -25,11 +25,15 @@
$group = get_entity($group_guid);
if (($user instanceof ElggUser) && ($group instanceof ElggGroup))
- {
- if ($group->leave($user))
- system_message(elgg_echo("groups:left"));
- else
- register_error(elgg_echo("groups:cantleave"));
+ {
+ if ($group->getOwner() != $_SESSION['guid']) {
+ if ($group->leave($user))
+ system_message(elgg_echo("groups:left"));
+ else
+ register_error(elgg_echo("groups:cantleave"));
+ } else {
+ register_error(elgg_echo("groups:cantleave"));
+ }
}
else
register_error(elgg_echo("groups:cantleave"));
diff --git a/mod/groups/start.php b/mod/groups/start.php
index 53415dc60..7bd6aca24 100644
--- a/mod/groups/start.php
+++ b/mod/groups/start.php
@@ -127,7 +127,8 @@
add_submenu_item(elgg_echo('groups:invite'),$CONFIG->wwwroot . "mod/groups/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
}
if ($page_owner->isMember($_SESSION['user'])) {
- add_submenu_item(elgg_echo('groups:leave'), $CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID(), '1groupsactions');
+ if ($page_owner->getOwner() != $_SESSION['guid'])
+ add_submenu_item(elgg_echo('groups:leave'), $CONFIG->wwwroot . "action/groups/leave?group_guid=" . $page_owner->getGUID(), '1groupsactions');
} else {
if ($page_owner->isPublicMembership())
{
diff --git a/mod/groups/views/default/forum/topicposts.php b/mod/groups/views/default/forum/topicposts.php
index 89c943019..73ba1ee90 100644
--- a/mod/groups/views/default/forum/topicposts.php
+++ b/mod/groups/views/default/forum/topicposts.php
@@ -21,13 +21,17 @@
<td>
<?php
//get infomation about the owner of the comment
- $post_owner = get_user($vars['entity']->owner_guid);
-
- //display the user icon
- echo "<div class=\"post_icon\">" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'small')) . "</div>";
-
- //display the user name
- echo "<p><b>" . $post_owner->name . "</b><br />";
+ if ($post_owner = get_user($vars['entity']->owner_guid)) {
+
+ //display the user icon
+ echo "<div class=\"post_icon\">" . elgg_view("profile/icon",array('entity' => $post_owner, 'size' => 'small')) . "</div>";
+
+ //display the user name
+ echo "<p><b>" . $post_owner->name . "</b><br />";
+
+ } else {
+ echo "<p>";
+ }
//display the date of the comment
echo "<small>" . friendly_time($vars['entity']->time_created) . "</small></p>";
diff --git a/mod/groups/views/default/forum/topics.php b/mod/groups/views/default/forum/topics.php
index b574aea7c..18a8e4d0a 100644
--- a/mod/groups/views/default/forum/topics.php
+++ b/mod/groups/views/default/forum/topics.php
@@ -98,7 +98,8 @@
<p>
<?php
//display the last user to post
- echo get_user($last_user)->name;
+ if ($u = get_user($last_user))
+ echo $u->name;
?>
</p>
</td>
diff --git a/mod/groups/views/default/object/groupforumtopic.php b/mod/groups/views/default/object/groupforumtopic.php
index c841f3f82..23afe00e0 100644
--- a/mod/groups/views/default/object/groupforumtopic.php
+++ b/mod/groups/views/default/object/groupforumtopic.php
@@ -23,7 +23,11 @@
$last_user = $last->owner_guid;
}
- $info = "<p class=\"latest_discussion_info\">" . elgg_echo('created') . " " . $forum_created . ", " . elgg_echo('with') . " " . $counter . " " . elgg_echo('posts') . "<br /><span class=\"timestamp\">last updated " . friendly_time($last_time) . "<br />by <a href=\"" . get_user($last_user)->getURL() . "\">" . get_user($last_user)->username . "</a></span></p>";
+ $info = "<p class=\"latest_discussion_info\">" . elgg_echo('created') . " " . $forum_created . ", " . elgg_echo('with') . " " . $counter . " " . elgg_echo('posts') . "<br /><span class=\"timestamp\">last updated " . friendly_time($last_time);
+ if ($u = get_user($last_user)) {
+ $info .= "<br />by <a href=\"" . $u->getURL() . "\">" . $u->username . "</a></span>";
+ }
+ $info .= '</p>';
//get the group avatar
$icon = elgg_view("profile/icon",array('entity' => $group, 'size' => 'small'));
//get the group and topic title