Notifications
Clear all

[Closed] Subscriptions template blank with sage roots 9

7 Posts
3 Users
0 Reactions
703 Views
sc89me
Posts: 26
Topic starter
(@sc89me)
Eminent Member
Joined: 5 years ago

Ok we have found out what causes this. 

In file plugins/wpforo/modules/subscriptions/Subscriptions.php, there is method add_templates which looks like:

	public function add_templates( $templates ) {
		$templates['subscriptions'] = [
			'type'                  => 'callback',
			'key'                   => 'subscriptions',
			'menu_shortcode'        => 'wpforo-profile-subscriptions',
			'ico'                   => '<i class="fas fa-rss"></i>',
			'title'                 => 'Subscriptions',
			'is_default'            => 1,
			'can'                   => 'vprs',
			'add_in_member_menu'    => 1,
			'add_in_member_buttons' => 1,
			'callback_for_page'     => function(){
				require_once wpftpl( 'profile-subscriptions.php' );
			},
		];

		return $templates;
	}

If we change the require_once on line 13 above and line 65 in the actual file, to require it works.

I’m not sure if this is a bug in the wpforo code or not. From what we can tell the templates are being processed more than once, which I think is due to some of the template overrides we might have in place.

When we flush the output buffer at the correct point we are seeing the original wpforo template in the buffer as well as our override, so something odd is going on with the way the overrides are handled.

Most of the template definitions, which are set in plugins/wpforo/Templates.php use require instead of require_once. It only appears to be the subscriptions and follows modules that use require_once.

@Robert could you comment on if the require_once is necessary for some reason we are not aware of or if these can be changed to require? 

Robert
Posts: 10589
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @sc89me,

This is something wired, we've never faced with some issue. In any case we've changed the required_once to required. Please provide some details about your hosting, WordPress theme and plugins for further debugging.

Page 2 / 2