The default panels configuration for advanced forums has 3 variants.

The forum variant to show a single forum also includes content to show a list of the other forums.

For some reason this forum list does not show on the front end.

Any hints on how to fix this?

Comments

inventlogic’s picture

I had to add the Forum context in Contexts with identifier:Forum and keyword:forum.

This is because in the file forum_list.inc under modules/advanced_forum/plugins/content_types

The following plugin array is declared with the array element 'required context' => new ctools_context_required(t('Forum'), 'forum')

/**
 * Plugins are described by creating a $plugin array which will be used
 * by the system that includes this file.
 */
$plugin = array(
  'single' => TRUE,
  'title' => t('Forum list'),
  'icon' => 'icon_forum.png',
  'description' => t('A list of forums for the forum.'),
  'required context' => new ctools_context_required(t('Forum'), 'forum'),
  'category' => t('Forum'),
  'defaults' => array(),
);

The "required context" element arguments mean that the forums list will only show if there is a context with the Identifier: Forum and keyword:forum.

There is already a default context with this exact setup but the name of the context is "Argument 1"

Whereas the name of the new context I created is "Context 1" which works and lets the forum list display.

Is this the expected behavior or is the "Argument 1" context misnamed?

troky’s picture

Status: Active » Postponed (maintainer needs more info)

Can you provide exact steps to reproduce this error?

troky’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No response. Closing.

ron_s’s picture

Title: Panels variant for single forum does not show forum list » Required context is lost, causes panels variants to render empty
Category: Support request » Bug report
Issue summary: View changes
Status: Closed (cannot reproduce) » Active

I can confirm there is a bug, and can consistently reproduce the error.

Somewhere in the advanced_forum code it is losing the relationship with the required context. I've tried to compare this module to how Ctools adds the node context, or how Workbench uses the node context to create a required context for the workbench_display plugin. I cannot find what the difference is, but there is definitely one that exists.

As mentioned by @inventlogic, adding "Context 1" with a name of "Forum" and ID of "forum" fixes the problem.

How to reproduce:

In our case, we're using the Authcache module to perform authenticated user caching. If advanced_forum is accessed as an admin user without authcache, the panels render correctly. The problem occurs when viewing the page as a user with an cached role. We do not see this type of context issue with any other entity (nodes, blocks, ctools panes, fieldable panels panes, etc.).

Install and configure a basic authcache setup. I'm sure this problem will exist if just using the builtin options. Configure caching for the "forum_statistics" plugin pane so it is cached and refreshes every 5 minutes. Test loading "/forum" with a user who has a role delivering cached pages. When authcache does its callback to render the pane, nothing is displayed.

If I comment out 'required context' => new ctools_context_required(t('Forum'), 'forum') from the plugin, I can get the pane to render static text, but with errors. Not until I add another Context for the variant does it start to display correctly. So it's clear the required context is the heart of the problem.

Wondering if there might be an issue in a function like hook_default_page_manager_handlers? I was comparing this function to how it is used in the Panelizer module, and they actually define the context directly in the $handler object:

    $handler->conf = array(
      'title' => t('Node panelizer'),
      'context' => 'argument_entity_id:node_1',
      'access' => array(),
    );

I tried doing something similar to this in advanced_forum and did not seem to help. Somewhere there is a missing connection and the context is no longer recognized.