Open rvanlaak opened 11 years ago
I think this bug/feature is in extension of the behavior of the short init mode.
short_init: false
So, in case of the short init mode, the Twig extension should be loaded...
When short_init
mode is on, it only load the necessary files for Symfony's login needs. Thus a lot of theme function won't available in short_init
mode.
It is good if you only want to sync WordPress's login state, and use Symfony to do the rest (querying post etc)
Okay, sounds good! Can you point me in the direction where the TwigExtension is loaded? What I want is a config-parameter to enable access the {{ wp. }} global in my own Twig templates.
short_init shouldn't affect the Twig extension, it is always loaded.
https://github.com/kayue/WordpressBundle/blob/master/Resources/config/services.xml#L61-L66
What error do you get? Since the wp
global is only a proxy method / magic method, I think you can use {{ wp.time() }}
to test is this global working or not.
When the situation from the issue is simulated, I get the following error:
An exception has been thrown during the rendering of a template ("Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bloginfo' not found or invalid function name in /home/scribbr/sites/scribbr/vendor/hypebeast/wordpress-bundle/Hypebeast/WordpressBundle/Extensions/WordpressTwigExtension.php line 63") in ScribbrAppBundle:Order:order0.html.twig at line 8.
Did you turn off short_init?
On Thu, Feb 21, 2013 at 11:36 PM, Rvanlaak notifications@github.com wrote:
When the situation from the issue is simulated, I get the following error:
An exception has been thrown during the rendering of a template ("Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'bloginfo' not found or invalid function name in /home/scribbr/sites/scribbr/vendor/hypebeast/wordpress-bundle/Hypebeast/WordpressBundle/Extensions/WordpressTwigExtension.php line 63") in ScribbrAppBundle:Order:order0.html.twig at line 8.
— Reply to this email directly or view it on GitHubhttps://github.com/kayue/WordpressBundle/issues/19#issuecomment-13894875.
Yes I did... with the following settings I get that error:
short_init: false
wordpress_cookie: false
wordpress_form_login: false
So, that is why I'd like to know where / when in the process the Twig extension is loaded, so I can manually initialize it.
I'm trying to activate remember_me functionality for my application, but in extension of this bug/error now the following error appears.
You must configure at least one remember-me aware listener (such as
form-login) for each firewall that has remember-me enabled.
I've been searching for a solution, but it seems like the WordpressBundle isnt interoperable with the remember functionality.
I've also added an StackOverflow question myself
http://stackoverflow.com/questions/15613504/wordpressbundle-and-remember-me
When we disable both of the User features of the bundle in the security.yml this results into that the Twig extension isn't loaded.
Since this Twig extension is a great feature of this bundle, this should be configurable separately.
I'm willing to create a pull request, but then you've got to explain me where the Twig extension service is loaded.