Thread Starter
Beee
(@beee)
I have custom passwords set and user moderation, so I was expecting to see the message: “Your registration was successful but you must now confirm your email address before you can log in. Please check your email and click on the link provided.”.
Thread Starter
Beee
(@beee)
I don’t know what is_active does exactly but if I remove the if statement it does show the message as expected.
Make sure that your theme is properly utilizing The Loop.
Thread Starter
Beee
(@beee)
I am using a Twig based template. There is not a real loop anymore but all pages (with forms) are rendered with the shortcode, not a template or so.
Can I achieve it in another way ?
Thread Starter
Beee
(@beee)
with a custom field or so ?
Thread Starter
Beee
(@beee)
Can you give some insight here ? I’d like to fix this.
Sorry for the delay. When WP forums changed, they changed the way new forum posts appear. Evidently, new posts within an old topic don’t go to the front page. I’ve since subscribed to all new posts in this forum, though.
As far as the plugin is coded, your theme must properly utilize The Loop in order for the is_active flag to be set.
Thread Starter
Beee
(@beee)
Thanks for the reply, now I understand why it took so long….
I understand what you say but that is just not possible when you use Timber, which is a plugin that exists in the WP repository.
Twig is a templating language (by the people of Symfony) which is interpreted by Timber. This doesn’t have the traditional loop anymore, because logic and design are separated.
I have made a workaround by commenting out these lines (which makes it work), but it’s not ideal since it’s hacking into core and I don’t know what any other consequences might be.
The Loop has to be utilized somewhere, otherwise, how does it iterate through the posts?
Thread Starter
Beee
(@beee)
This page explains the base concept of it.
https://timber.github.io/docs/reference/timber-post/
It pulls all post data into $context[‘post’].
It can then be accessed in twig by echoing post.content
Maybe use the_post action to set the TML’s instance active flag?
Thread Starter
Beee
(@beee)
I’m not quite sure what you mean ?
The Timber plugin calls the_post action when it loads a post. Perhaps, you can use that, and on TML pages, set the main TML instance to active. Something like:
function tml_custom_instance_setter( $post, $wp_query ) {
if ( Theme_My_Login::is_tml_page( '', $post ) && $wp_query->is_main_query() ) {
Theme_My_Login::get_object()->get_instance()->set_active();
}
}
add_action( 'the_post', 'tml_custom_instance_setter', 10, 2 );