From 82ed2fe0bea0c12f19b261e0e1cf8ad9cb2ba668 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 4 Dec 2010 02:16:05 +0000 Subject: check if there are any messages before grabbing them in elgg_view_page() git-svn-id: http://code.elgg.org/elgg/trunk@7523 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/views.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/engine/lib/views.php b/engine/lib/views.php index 3385e230c..09653e11d 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1308,15 +1308,17 @@ function autoregister_views($view_base, $folder, $base_location_path, $viewtype) * @since 1.8 */ function elgg_view_page($title, $body, $page_shell = 'default', $vars = array()) { - // get messages - try for errors first - $sysmessages = system_messages(NULL, "errors"); - if (count($sysmessages["errors"]) == 0) { - // no errors so grab rest of messages - $sysmessages = system_messages(null, ""); - } else { - // we have errors - clear out remaining messages - system_messages(null, ""); + if (count_messages()) { + // get messages - try for errors first + $sysmessages = system_messages(NULL, "errors"); + if (count($sysmessages["errors"]) == 0) { + // no errors so grab rest of messages + $sysmessages = system_messages(null, ""); + } else { + // we have errors - clear out remaining messages + system_messages(null, ""); + } } $vars['title'] = $title; -- cgit v1.2.3