Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Template {{user.name}} Broken

edited April 2012 in Miscellaneous

This isn't working (I even tried fresh installs to make sure).

Only seems to apply to {{user.property}} elements. It works for the included members block however. It is correctly parsing in the php into the template in cache.

<?php echo Template::sanitize ($GLOBALS['user']->name, 'UTF-8'); ?>

Any ideas where to look?


Upon further investigation... my $GLOBALS['user'] does not exist.

Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( [PHPSESSID] =>     f074bcahjlsicg88ttssmqh6s4 [elefant_update_checked] => 1 ) [_FILES] => Array ( ) [_SERVER] => Array ( [REDIRECT_STATUS] => 200 [HTTP_HOST] => ecmspg.com [HTTP_CONNECTION] => keep-alive [HTTP_CACHE_CONTROL] => max-age=0 [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_REFERER] => http://ecmspg.com/about [HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8 [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.3 [HTTP_COOKIE] => PHPSESSID=f074bcahjlsicg88ttssmqh6s4; elefant_update_checked=1 [PATH] => /usr/local/bin:/usr/bin:/bin [SERVER_SIGNATURE] =>
Apache/2.2.20 (Ubuntu) Server at ecmspg.com Port 80
[SERVER_SOFTWARE] => Apache/2.2.20 (Ubuntu) [SERVER_NAME] => ecmspg.com [SERVER_ADDR] => 127.0.0.1 [SERVER_PORT] => 80 [REMOTE_ADDR] => 127.0.0.1 [DOCUMENT_ROOT] => /var/www/ecmspg.com [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /var/www/ecmspg.com/index.php [REMOTE_PORT] => 39526 [REDIRECT_URL] => /about [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /about [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME] => 1335672410 ) [_REQUEST] => Array ( ) [i18n] => I18n Object ( [language] => en [locale] => [directory] => lang [lang_hash] => Array ( [en] => Array ( [Home] => Home ) ) [hash_order] => Array ( [0] => en ) [charset] => UTF-8 [fullname] => English [fallbacks] => Array ( ) [languages] => Array ( [en] => Array ( [name] => English [code] => en [locale] => [charset] => UTF-8 [fallback] => [default] => 1 ) [fr] => Array ( [name] => Français [code] => fr [locale] => [charset] => UTF-8 [fallback] => [default] => ) [ja] => Array ( [name] => 日本語 [code] => ja [locale] => [charset] => UTF-8 [fallback] => [default] => ) [nl] => Array ( [name] => Nederlands [code] => nl [charset] => UTF-8 [fallback] => [default] => ) [zh] => Array ( [name] => 简体中文 [code] => zh [locale] => [charset] => UTF-8 [fallback] => [default] => ) ) [cookieName] => lang [url_includes_lang] => [new_request_uri] => [prefix] => [negotiation] => http [error] => [default] => en ) [page] => Page Object ( [head] => [tail] => [title] => about [_menu_title] => about [_window_title] => about [body] => [layout] => bootstrapped [scripts] => Array ( ) [is_being_rendered] => 1 [preview] => [id] => about [description] => [keywords] => [locked] => ) [controller] => Controller Object ( [params] => Array ( [0] => about ) [internal] => [data] => Array ( ) [cli] => [put_data] => [app] => admin [uri] => admin/page [chunked] => [cache] => ) [tpl] => Template Object ( [charset] => UTF-8 [cache_folder] => cache [controller] => Controller Object ( [params] => Array ( [0] => about ) [internal] => [data] => Array ( ) [cli] => [put_data] => [app] => admin [uri] => admin/page [chunked] => [cache] => ) ) [memcache] => Cache Object ( [dir] => cache/datastore ) [handler] => apps/admin/handlers/page.php [_SESSION] => Array ( [session_id] => ed2849abb97f3ce8154a8866fcce1b45 [csrf_token] => 71f94906d67a3e0ad0f684b8ca29cba1 [csrf_expires] => 1335677541 ) )

Temporarily solved with: {{ User::val ('name') }}

Comments

  • Ah yes, there is no more global $user object so {{ User::val('name') }} is the correct way to fetch a value for a user. The real object is stored in User::$user now to keep the global namespace cleaner.

    I better do a search of the docs and change any old references too.

  • Ok. The demo was still able to reference it, and several of the themes (bootstrap I know for sure) still use it as well.

  • Ah yes, I hadn't updated the themes with that change. Thanks for pointing that out :) The demo site could use an update as well soon, just haven't gotten to it yet.

Sign In or Register to comment.