From 0ca854b4387127605836fb20904e9c1aa3d59321 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 3 Feb 2011 12:18:17 +0000 Subject: Fixes #2124 only setting $vars[user], $vars[url], and $vars[config] in elgg_view() if not already set git-svn-id: http://code.elgg.org/elgg/trunk@8002 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/views.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/views.php b/engine/lib/views.php index a0c052f70..0a9669d2f 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -380,15 +380,18 @@ function elgg_view($view, $vars = array(), $bypass = false, $debug = false, $vie $vars = array(); } - $vars['user'] = get_loggedin_user(); - - $vars['config'] = array(); - - if (!empty($CONFIG)) { + // @warning - plugin authors: do not expect user, config, and url to be + // set by elgg_view() in the future. Instead, use get_loggedin_user(), + // elgg_get_config(), and elgg_get_site_url() in your views. + if (!isset($vars['user'])) { + $vars['user'] = get_loggedin_user(); + } + if (!isset($vars['config'])) { $vars['config'] = $CONFIG; } - - $vars['url'] = elgg_get_site_url(); + if (!isset($vars['url'])) { + $vars['url'] = elgg_get_site_url(); + } // If it's been requested, pass off to a template handler instead if ($bypass == false && isset($CONFIG->template_handler) && !empty($CONFIG->template_handler)) { -- cgit v1.2.3