• I’ve searched through posts and conversations on the usual forums, but cannot find an answer to the issue of duplicate entries in the BP activity stream after installing sitewide tags.

    I have SWT using the main site as the tags site, so clearly the activity stream is showing both the original post (on a user site) and the ghost of a post that is being created on the tag site (i.e. my main site) at the same time.

    I looked at Burt’s patch on trac, (which is 2 years old now) but when I tried the patch in bp-blog.php I found that a patch was already applied in BP 1.2.8 (albeit in a slightly different form).

    At the moment all I want to do is stop the duplicates being displayed in the activity stream (i.e. hide the tag blog occurance), and would be happy enough to settle for filtering them out in the activity stream. Btw, there is always ‘two’ entries with the 1st entry being the ‘site blog’ and the 2nd being the ‘originating blog’.

    I’ve tried checking if ‘blog_id’ is equal to ‘tag_blog_id’ and then applying this fix to /activity/entry.php, but by the time it reaches the activity stream it seems both blog_id and tag_blog_id fields are the same, so I need a more accurate filter – or maybe the filter needs applied at the bp-blog-php stage.

    Has anyone got a working hack they’d like to share?

Viewing 15 replies - 1 through 15 (of 45 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    There’s a plugin for that: https://wpmututorials.com/plugins/turn-off-sitewide-tags-on-special-blogs/

    Just enable that on your BP home site.

    Thread Starter DoctorDR

    (@doctordr)

    Thanks Ron, I will try it out now.

    Another ‘tiny’ issue that I’m wrestling with is integrating the wootumblog plugin with STW. The use case is as follows;

    The wootumblog plugin – https://www.woothemes.com/support/wootumblog/ – uses a custom taxonomy and is working fine on both my main blog and user blogs – but the taxonomy type (i.e. photo, video, quote) is not making it through the STW filter when displayed on the homepage of our main blog. The posts get through, but the custom type is not recognised and therefore defaults to ‘article’.

    I’m still getting my head around the architecture of custom post types – any suggestions?

    Plugin Author Ron Rennick

    (@wpmuguru)

    See this post: https://wpmututorials.com/plugins/sitewide-tags-update/

    We have quite a few posts with info on SWT. You should be able to find them all by using our search for “sitewide tags’.

    Thread Starter DoctorDR

    (@doctordr)

    Thanks Ron.

    As I’ve been looking through the sitewide-tags.php file I noticed the following line of code which looks like it may be a typo..

    LINE 552: add_filter( ‘sitewide_tags_allowed_post_types’, ‘sitewide_tages_pages_filter’ );

    Shouldn’t the filter be ‘sitewide_tags_pages_filter’ ?

    Plugin Author Ron Rennick

    (@wpmuguru)

    Nice catch.

    That’s what the function is called, so changing just that line would give you an error.

    I updated the dev version and removed the typo in the function name and changed the filter.

    Thread Starter DoctorDR

    (@doctordr)

    Ron, sorry to ask a really simple question but where do I add the filter in order to include the custom taxonomy within the SWT blog? I have worked with WP for years, but this is the first time I’ve used custom taxonomies.

    Here’s the filter to be added:

    add_filter( 'sitewide_tags_custom_taxonomies', array(&$this, 'tumblog') );

    Do I add it in sitewide-tags.php within the sitewide_tags_post function? And I presume I should re-run ‘Populate Posts’?

    I’ve checked to ensure it’s the correct taxonomy using <?php $tumblog_list = get_the_term_list( $post_id, 'tumblog', '' , '|' , '' ); echo $tumblog_list; ?>

    So can see that the custom taxonomy exists in the source blog posts before being aggregated.

    Plugin Author Ron Rennick

    (@wpmuguru)

    sorry to ask a really simple question but where do I add the filter in order to include the custom taxonomy within the SWT blog

    If you’ve written a class then add the filter in the constructor of your class.

    Thread Starter DoctorDR

    (@doctordr)

    Thanks Ron, unfortunately I don’t actually know what you mean when you say

    “If you’ve written a class then add the filter in the constructor of your class.”

    I have not previously worked with constructors and classes.

    If you get a moment to elaborate any further (i.e. put this section of code in this file) then it would be much appreciated, otherwise I’ll ask someone more experienced than me to translate.

    Thread Starter DoctorDR

    (@doctordr)

    Ron, this is the section of code that I am adding to my sub-sites’ functions.php file.

    // Custom Taxonomy Tumblog Filter
    add_action('pre_get_posts', 'woo_taxonomy_tumblog_filter' ); 
    
    function woo_taxonomy_tumblog_filter( $query ) {
    
      global $wp_query;
    
      if ($query->is_home || $query->is_front_page) {
    
      	$query->set('tax_query', array(	'taxonomy' => 'tumblog'	));
    
      	$query->parse_query();
      }
    
      return $query;
    
    }
    add_filter( 'sitewide_tags_custom_taxonomies', 'woo_taxonomy_tumblog_filter' );

    It doesn’t seem to work – i.e. the taxonomy type still doesn’t respond to a simple query on the main site.

    Please let me know if I’m heading in the right direction – I’ve been trading emails with the wootumblog main developer (jeffikus) and once we’ve cracked it will share with the community how to recreate the function.

    Plugin Author Ron Rennick

    (@wpmuguru)

    Please let me know if I’m heading in the right direction

    No, that’s not the right direction. It looks like you are trying to alter the WP query on the main site by adding a filter to the sub site.

    From https://wpmututorials.com/plugins/sitewide-tags-update/

    Custom taxonomies use a similar filter

    add_filter( ‘sitewide_tags_custom_taxonomies’, ‘my_swt_custom_tax_filter’ )

    The filter passes an array formatted like array( ‘post_format’, ‘subject’ ).

    That means what is passed to your filter is an array (not a WP Query object) and you add elements to that array:

    function my_swt_custom_tax_filter( $taxonomies ) {
    $taxonomies[] = 'tumblog';
    return $taxonomies;
    }
    add_filter( 'sitewide_tags_custom_taxonomies', 'my_swt_custom_tax_filter' );

    Your main site has to have a theme that supports the tumblog taxonomy.

    Thread Starter DoctorDR

    (@doctordr)

    Ron, thanks for clarifying that.

    Both my sub site and main site use the same theme – a modified version of BP Default and the tumblog plugin is activated on the main site, whilst I have added its posting functionality within the functions.php in my sub sites.

    So the tumblog functionality works perfectly in both main and sub-sites – the only problem is that the sub-site taxonomies are filtered out by the sitewide tags plugin and therefore when I display a list of posts from across the network, only those from the main site are recognised as tumblog posts.

    So where do I place the above filter? In my main site’s functions.php or sub site? Or perhaps a plugin as I noted on Boone Gorges blog – https://teleogistic.net/2010/08/enabling-popularity-contest-for-wordpress-networkwide-use/comment-page-1/#comment-14150

    Thread Starter DoctorDR

    (@doctordr)

    Okay, I have created a plugin and then network activated it on the main site.

    <?php
    /*
    Plugin Name: SWT Custom Taxonomy
    Plugin URI: https://skiddnet.com
    Description: Addition of new custom taxonomies to the wpmu sitewide tags plugin.
    Version: 1.0
    Author: CitizenSlide
    Author URI: https://skiddnet.com
    License: GPL2
    */
    
    function my_swt_custom_tax_filter( $taxonomies ) {
    $taxonomies[] = 'tumblog';
    return $taxonomies;
    }
    add_filter( 'sitewide_tags_custom_taxonomies', 'my_swt_custom_tax_filter' );
    ?>

    Still no sign of those taxonomies. Thanks for all your help (and patience) thus far, I’ll keep reading and searching for additional clues.

    Plugin Author Ron Rennick

    (@wpmuguru)

    That won’t have any effect on existing posts. It will only apply to new ones.

    Thread Starter DoctorDR

    (@doctordr)

    I’ve tested it on both existing (after re-populating posts into the tag blog) and new posts and I’m still not seeing any effect.

    Need to go live today, so unfortunately may have to unravel the sitewide functionality from the design.

    Thread Starter DoctorDR

    (@doctordr)

    I can appreciate how tedious it can be to try and solve one case, but what would be really useful is some real life examples. Most people just need to see and/or recreate a working scenario before we achieved that ‘Eureka’ moment with our own problems.

    If you find the time in future, perhaps you could illustrate on wpmututorials how to adapt SWT to use custom posts types, custom taxonomies and custom fields. Perhaps then other developers could contribute their own solutions and we’d have a knowledge base for the less experienced developers to use. Just a thought.

Viewing 15 replies - 1 through 15 (of 45 total)
  • The topic ‘Getting BuddyPress and sitewide tags to play nicely’ is closed to new replies.