diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 12:18:17 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-03 12:18:17 +0000 |
commit | 0ca854b4387127605836fb20904e9c1aa3d59321 (patch) | |
tree | 8b59fd1be971113d6747e1dcc164783041bb9fef /engine/lib | |
parent | 4ff61fa6a8c012053659b1723b7dea9d38cd654e (diff) | |
download | elgg-0ca854b4387127605836fb20904e9c1aa3d59321.tar.gz elgg-0ca854b4387127605836fb20904e9c1aa3d59321.tar.bz2 |
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
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/views.php | 17 |
1 files changed, 10 insertions, 7 deletions
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)) { |