Wiki posts its editorial content to Header, body and footer. Not a css problem rather a add_content

Using wiki plugin with Salutation theme for Buddypress gives a rather nasty problem. Salutation is using Content hooks to inject static blocks of content into its header and footer. This results in Wiki posting the Edit area into Header and Footer and not just in Body.

This is how the main developer of the theme explains the problem:

It seems the problem is not the plugin adding JavaScript from a shortcode, rather dynamically injecting content by appending to the WP “the_content” filter. This is a big problem for modern themes that make use of custom post types to populate a single page with multiple sources of content. This is what Salutation doing with Static Blocks.

When a plugin injects it’s content this way, it’s preferable for the plugin to include an option to deactivate that feature for custom post types, however even when this is done it typically does not test against the current instance of “the_content” rather the current page. Eventually plugin developers with catch up with this style of design creation as I believe it’s going to be increasingly popular due to the flexability and control it provides over your content and layout.

I am working on adding a feature to the theme which gives you control to enable/disable any filter on “the_content” for any post type installed. It’s only a concept at this point. I have done a little research and simple testing to ensure it is possible. I’m not sure how long it will be before this is available.

If you can find out what the filter name used by the plugin I can give you some custom code to prevent it from showing in the unwanted areas. For example, search the plugin code for something like this add_filter('the_content', 'some_plugin_function_name');. We need the value of some_plugin_function_name to write the exception. It may also appear as a filter on the_post, for example: add_filter('the_content', 'some_plugin_function_name');.

Now I have looked at the functions of the wiki but I have to say that my php knowledge is slightly restricted :slight_smile:

This is what I have found but not sure at all what to make out of it:

This is the list for example of all the actions, filters and hooks, that the plugin Wiki is adding and using:

* Plugin register actions, filters and hooks.
     */
    function Wiki() {
  global $wpdb;

  // Activation deactivation hooks
  register_activation_hook(__FILE__, array(&$this, 'install'));
  register_deactivation_hook(__FILE__, array(&$this, 'uninstall'));

        // Actions
  add_action('init', array(&$this, 'init'), 0);
  add_action('init', array(&$this, 'post_action'));
  add_action('wp_head', array(&$this, 'output_css'));
  add_action('wp_head', array(&$this, 'output_js'), 0);

  add_action('admin_print_styles-settings_page_wiki', array(&$this, 'admin_styles'));
      add_action('admin_print_scripts-settings_page_wiki', array(&$this, 'admin_scripts'));

  add_action('add_meta_boxes_incsub_wiki', array(&$this, 'meta_boxes') );
  add_action('wp_insert_post', array(&$this, 'save_wiki_meta'), 10, 2 );

      add_action('admin_menu', array(&$this, 'admin_menu'));

  add_action('widgets_init', array(&$this, 'widgets_init'));
  add_action('pre_post_update', array(&$this, 'send_notifications'), 50, 1);
  add_action('template_redirect', array(&$this, 'load_templates') );

  add_filter('post_type_link', array(&$this, 'post_type_link'), 10, 3);
  add_filter('name_save_pre', array(&$this, 'name_save'));
  // add_filter('the_content', array(&$this, 'the_content'));
  add_filter('role_has_cap', array(&$this, 'role_has_cap'), 10, 3);
  add_filter('user_has_cap', array(&$this, 'user_has_cap'), 10, 3);

  add_filter('get_edit_post_link', array(&$this, 'get_edit_post_link'));
  add_filter('comments_open', array(&$this, 'comments_open'), 10, 1);

  add_filter('rewrite_rules_array', array(&$this, 'add_rewrite_rules'));
  add_action('option_rewrite_rules', array(&$this, 'check_rewrite_rules'));

  add_filter('user_can_richedit', array(&$this, 'user_can_richedit'));

Now one of the members at the support forum that is using Salutation came across a fix for same type of problem for another plugin also posting content into header and footer and not only in the body. He write this on the theme support forums:

I did manage to figure out how to fix plugins that place themselves in the member-header page like the “Profile progression”. Basically most plugins that add content to the member header area look for this hook which is missing from the member-header.php file which is located at members/single/:

<?php do_action( 'bp_before_member_header_meta' ) ?>

Once adding that line the plugins show up in the header.

I also use a plugin called Mapology that adds a google map showing all your members on the map and it wasn’t showing the map. Adding <?php do_action( 'bp_before_directory_members_content' ); ?>
to to the template-bp-members.php file fix it.

So I am wondering what other hooks we are missing that are causing issues…

Sooo, my question is, would this "Fix" work for the wiki plugin as well, and how would that line of code look like? or is there any other way of fixing this?

PS! My site is closed for public eyes still for the rest of this month and I need this last plugin to be fixed so I can finally open up the site :slight_smile: