Viewing 10 replies - 16 through 25 (of 25 total)
  • @chancharles: I could not get gTags to work with your changes. I’m running BuddyPress 1.8.1 and gtags 2.0.3

    Could you please provide your plugin modified source code?

    I wish this plugin is in github somewhere so that we can at least put the fixes in there.

    Plugin is provided with no license, but I’m sure that its author will be interested about fixes. As soon as we can get it to work fully, I will try to contacto him.

    diff bp-group-tags.php bp-group-tags_php.original
    23,26c23,24
    <   $bp->options['gtags'] = (object)Array(
    <     'id' => 'gtags',
    <     'slug' => 'tag'
    <   );
    ---
    > 	$bp->gtags->id = 'gtags';
    > 	$bp->gtags->slug = 'tag';
    34,36c32
    <   bp_core_new_subnav_item(array( 'name' => '&nbsp;', 'slug' => $bp->options['gtags']->slug,
    <                           'parent_slug' => BP_GROUPS_SLUG, 'parent_url' => $bp->root_domain .'/'. BP_GROUPS_SLUG .
    <                           '/', 'screen_function' => 'gtags_display_hook', 'position' => -1 ) );
    ---
    > 	bp_core_new_subnav_item( array( 'name' => '&nbsp;', 'slug' => $bp->gtags->slug, 'parent_slug' => BP_GROUPS_SLUG, 'parent_url' => $bp->root_domain .'/'. BP_GROUPS_SLUG . '/', 'screen_function' => 'gtags_display_hook', 'position' => -1 ) );
    47,49d42
    < function gtags_return_blank() {
    <     return '';
    < }
    52d44
    <   add_filter('bp_current_action', 'gtags_return_blank');
    54d45
    <   remove_filter('bp_current_action', 'gtags_return_blank');
    179c170
    < 		"SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = %s", 'gtags_group_tags' ) );
    ---
    > 		"SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = 'gtags_group_tags' " ) );

    Paulo, if you want more than the diff, let me know.

    Hi @chancharles

    Thanks for the effort. However, it is really tough working from your diff without making mistakes. Could you perhaps post your full altered code, perhaps in 2 blocks, i.e.

    replace lines 23 to 45 with

    XXX

    and replace line 170

    "SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = %s", 'gtags_group_tags' ) );

    with

    "SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = 'gtags_group_tags' " ) );

    That should make it much clearer.

    o.m.g. that was painful – but it works.

    Thanks to @chancharles and @pauloasilva

    To fix this plugin you would need to edit the file:
    ../wp-content/plugins/buddypress-group-tags/bp-group-tags.php

    Replace from line 21 which should read:

    function bp_gtags_setup_globals() {

    up to and including lines 44, 45 which should read:

    bp_core_load_template( apply_filters( ‘bp_core_template_plugin’, ‘groups/index’ ) );
    }

    with this:

    function bp_gtags_setup_globals() {
    	global $bp;
    		$bp->options['gtags'] = (object)Array(
    		'id' => 'gtags',
    		'slug' => 'tag'
    		);
    }
    add_action( 'bp_setup_globals', 'bp_gtags_setup_globals' );
    
    // in order for tags to show as /groups/tag/mytag I am using this function. however it is not optimal because it's not really a sub menu item
    function bp_gtags_setup_nav() {
    	global $bp;
    	bp_core_new_subnav_item( array( 'name' => ' ', 'slug' => $bp->options['gtags']->slug, 'parent_slug' => BP_GROUPS_SLUG, 'parent_url' => $bp->root_domain .'/'. BP_GROUPS_SLUG . '/', 'screen_function' => 'gtags_display_hook', 'position' => -1 ) );
    }
    add_action( 'bp_setup_nav', 'bp_gtags_setup_nav', 1000 );
    
    // a hack to remove the group tags menu item before the admin bar is displayed. it works because the admin bar is called last
    function gtags_remove_tags_from_admin_bar() {
    	global $bp;
    	unset ( $bp->bp_options_nav['groups']['98564'] );
    }
    function gtags_return_blank() {
        return '';
    }
    add_action( 'bp_adminbar_menus', 'gtags_remove_tags_from_admin_bar', 3 );
    
    function gtags_display_hook() {
      add_filter('bp_current_action', 'gtags_return_blank');
      bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/index' ) );
      remove_filter('bp_current_action', 'gtags_return_blank');
    }

    Then also replace line somewhere around 170 to 180 which reads:

    “SELECT meta_value FROM ” . $bp->groups->table_name_groupmeta . ” WHERE meta_key = ‘gtags_group_tags’ ” ) );

    with

    "SELECT meta_value FROM " . $bp->groups->table_name_groupmeta . " WHERE meta_key = %s", 'gtags_group_tags' ) );

    Glad it works @profusion.

    I notice I should have diff’ed the original against the new rather than the other way around. ??

    Cheers.

    Plugin Author Dwenaus

    (@dwenaus)

    thank you chancharles for your effort. I’ve included your changes in the latest version of the plugin 2.1 sorry for the long delay.

    Hi. I made some changes here too, to get the slug working when translated.

    Line 27-28:

    $bp->gtags->slug = 'tagg';
    	$bp->gtags->groups_slug = isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG;

    And, make sure we use these later on, e.g. on line 94-96:

    if ( isset( $_POST[$bp->gtags->slug] ) && $_POST[$bp->gtags->slug] )
    		$tag = urldecode( $_POST[$bp->gtags->slug] ); // this is what ajax sends if we are in group directory
    	else if ( $bp->current_action == $bp->gtags->slug )

    …and on line 227:

    $link = $bp->root_domain . '/' . $bp->gtags->groups_slug . '/' . $bp->gtags->slug . '/' . urlencode( $tag ) ;

    …and on line 437:

    $link = $bp->root_domain . '/' . $bp->gtags->groups_slug . '/' . $bp->gtags->slug . '/' . urlencode( $item );

    Hope it works for you too, and that I didn’t miss any edits I made.

    Hi there,

    Even though this problem says “resolved” I am stil having the same issue even with the suggestions you guys said before and the update the plugin author has just provided.

    Does anybody have any guidance as to how I can fix this problem.

    Here is a link to my site which displays this issue:
    https://ksnvienna.com/project-badass/groups-2/

    Thanks!

    bdietderich: Did you edit with my code too? Seems like you have the default group slug in the URL (“groups”) but a custom one on your page (“groups-2”). Either you activate the feature on your “groups” page or you fix the slug issue using my code. That worked for me anyway.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Cloud Tag URL's not working’ is closed to new replies.