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

    (@wpmuguru)

    You can add the following to your wp-config.php

    // for the blog author link plugin
    define( 'BP_MEMBERS_SLUG', 'people' );

    In my case the problem is that we use the Buddypres Multilingual plugin for WPML. So that slug changes from language to language.
    Is it something easy to solve? Can you give me a hint?
    Thanks a lot!!!!

    Plugin Author Ron Rennick

    (@wpmuguru)

    @euskaldunak – The plugin consists of less than 20 lines of code:

    https://plugins.trac.www.ads-software.com/browser/bp-blog-author-link/trunk/ra-bp-author-link.php?rev=538026

    Line #45 does the author slug replacement.

    I landed on this thread looking for a solution for my author links redirecting to the main blog whereas I have BuddyPress set up on a subsite of a network.

    I used the suggestion above and changed it to ‘subdirectory/members’ and it works.

    Is this the best way to do that?

    Well, I tried but didn’t get. I’m not a developper, sorry. I may need little more time. ??

    The main issue is that using buddypress multilanguage, this url changes depending on the language displayed.

    While in English it is: https://proiektuenazoka.org/members/tomas/profile/

    In Basque the right slug is: https://proiektuenazoka.org/eu/partaideak/tomas/profila/

    And in Spanish the right slug is: https://proiektuenazoka.org/es/participantes/tomas/perfil/

    Some other plugins manage that, so it is something that can be done. But just a newbie, no idea where to start touching it.

    Anyway, don’t matter. Sincercly, thank you very much! ??

    Hugs.

    Plugin Author Ron Rennick

    (@wpmuguru)

    @mrsminkie – yes.

    For the folks using the multilingual plugins. I haven’t worked with either plugin so I can’t provide a detailed suggestion. However, the authors of the BP multilingual plugin might be able to provide details on how my plugin could be modified to generate the correct URL

    Hi Ron – thanks for writing back.

    The solution has worked, I just wanted to check if you knew of any reason why I couldn’t use it for this purpose, but it seems fine.

    Many thanks!

    Yes, thanks for the answer. I also asked to BP Multilingual suport. Hope to have soon an answer. I will write it here.
    Regards!

    Thread Starter ericgolftourney

    (@ericgolftourneygmailcom)

    Rons initial comment resolved my issue.

    Here you have the solution I found. Regards!

    function ra_add_author_filter() {
    	add_filter( 'author_link', 'ra_bp_filter_author' );
    }	
    
    add_action( 'wp_head', 'ra_add_author_filter' );
    function ra_bp_filter_author( $content ) {
    	if( defined( 'BP_MEMBERS_SLUG' ) ) {
    		if( is_multisite() ) {
    			$member_url = network_home_url( BP_MEMBERS_SLUG );
    			if( !is_subdomain_install() && is_main_site() )
    				$extra = '/blog';
    			else
    				$extra = '';
    
    			$blog_url = get_option( 'siteurl' ) . $extra . '/author';
    			return str_replace( $blog_url, $member_url, $content );
    		}
        // load the buddypress
    global $bp;
    
    // get the custom slug
    $slug = $bp->pages->members->slug;
    
    		return preg_replace( '/author\/?(.*)?/', $slug . '/$1', $content );
    	}
    	return $content ;
    }
    ?>
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Different link on my site than /members’ is closed to new replies.