<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress support forums Topic: How to shorten a profile link?</title>
<link>http://bbpress.org/forums/</link>
<description>bbPress support forums Topic: How to shorten a profile link?</description>
<language>en</language>
<pubDate>Sun, 20 Jul 2008 05:14:50 +0000</pubDate>

<item>
<title>mrhoratio on "How to shorten a profile link?"</title>
<link>http://bbpress.org/forums/topic/how-to-shorten-a-profile-link#post-16184</link>
<pubDate>Mon, 12 May 2008 22:48:12 +0000</pubDate>
<dc:creator>mrhoratio</dc:creator>
<guid isPermaLink="false">16184@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;By the way, I made this hack cleaner by implementing it as a filter inside a plugin. &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function my_get_user_profile_link_filter( $link , $user_id = 0 ) {
    //check for rewrite
	$rewrite = bb_get_option( &#38;#39;mod_rewrite&#38;#39; );
	if ( $rewrite ) {
		//what kind of rewrite there is? slug use &#38;quot;forum_slug&#38;quot; column, else the column is &#38;quot;forum_id&#38;quot;
		$column = ($rewrite === &#38;#39;slugs&#38;#39;)?(&#38;#39;forum_slug&#38;#39;):(&#38;#39;forum_id&#38;#39;);
		$link = str_replace(&#38;#39;forums/profile/&#38;#39;, &#38;#39;people/&#38;#39;, $link);
	}
    return $link; // Very important line!
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;This was based on code suggested in another thread:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://bbpress.org/forums/topic/nicer-slug-url-rewrite-plugin-done&#34; rel=&#34;nofollow&#34;&#62;http://bbpress.org/forums/topic/nicer-slug-url-rewrite-plugin-done&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>mrhoratio on "How to shorten a profile link?"</title>
<link>http://bbpress.org/forums/topic/how-to-shorten-a-profile-link#post-16125</link>
<pubDate>Sun, 11 May 2008 00:10:04 +0000</pubDate>
<dc:creator>mrhoratio</dc:creator>
<guid isPermaLink="false">16125@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Okay, I think I got it working.&#60;/p&#62;
&#60;p&#62;I was able to fix the redirection issue by modifying the get_user_profile_link() function in the template-functions.php. I added the following line towards the end of the function, right before the last line of code in the function:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$r = str_replace(&#38;#39;forums/profile/&#38;#39; . $user-&#38;gt;$column , &#38;quot;profile/&#38;quot; . $user-&#38;gt;$column, $r);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;This is the full code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function get_user_profile_link( $id = 0, $page = 1 ) {
	$user = bb_get_user( bb_get_user_id( $id ) );
	$rewrite = bb_get_option( &#38;#39;mod_rewrite&#38;#39; );
	if ( $rewrite ) {
		if ( $rewrite === &#38;#39;slugs&#38;#39; ) {
			$column = &#38;#39;user_nicename&#38;#39;;
		} else {
			$column = &#38;#39;ID&#38;#39;;
		}
		$r = bb_get_option(&#38;#39;uri&#38;#39;) . &#38;quot;profile/&#38;quot; . $user-&#38;gt;$column . ( 1 &#38;lt; $page ? &#38;quot;/page/$page&#38;quot; : &#38;#39;&#38;#39; );
	} else {
		$r = bb_get_option(&#38;#39;uri&#38;#39;) . &#38;quot;profile.php?id=$user-&#38;gt;ID&#38;quot; . ( 1 &#38;lt; $page ? &#38;quot;&#38;#38;page=$page&#38;quot; : &#38;#39;&#38;#39; );
	}

	$r = str_replace(&#38;#39;forums/profile/&#38;#39; . $user-&#38;gt;$column , &#38;quot;profile/&#38;quot; . $user-&#38;gt;$column, $r);

	return apply_filters( &#38;#39;get_user_profile_link&#38;#39;, $r, $user-&#38;gt;ID );
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I noticed that if you did not install bbPress with Wordpress cookie integration, then this hack will cause bbPress to always think you are logged out. I think it has something with it not being able to retrieve the cookie because of the path change. &#60;/p&#62;
&#60;p&#62;However, if you have Wordpress cookie integration enabled, then everything seems to work. Not exactly sure why. But I think it must be something to with the path that's being set in the cookie.
&#60;/p&#62;</description>
</item>
<item>
<title>mrhoratio on "How to shorten a profile link?"</title>
<link>http://bbpress.org/forums/topic/how-to-shorten-a-profile-link#post-16062</link>
<pubDate>Thu, 08 May 2008 18:19:28 +0000</pubDate>
<dc:creator>mrhoratio</dc:creator>
<guid isPermaLink="false">16062@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I've tried mod_rewrite, but running into problems with the wp_redirect functions in bbPress redirecting the page after the URL has been rewritten, so that the URL changes back to the longer form.&#60;/p&#62;
&#60;p&#62;For example, this mod_rewrite rule:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;RewriteRule ^profile/username forums/profile/username [L]&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;will rewrite:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://www.example.com/profile/username&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/profile/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;to:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://www.example.com/forums/profile/username&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/forums/profile/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Except, that after its been rewritten, bbPress forces a redirection, causing the URL in the browser window to change to the longer form.
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "How to shorten a profile link?"</title>
<link>http://bbpress.org/forums/topic/how-to-shorten-a-profile-link#post-16055</link>
<pubDate>Thu, 08 May 2008 18:11:57 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">16055@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;mod_rewrite will let you do that if you figure out the correct rule&#60;/p&#62;
&#60;p&#62;however you won't be able to get it shorter than profile/username because just /username could be another page.
&#60;/p&#62;</description>
</item>
<item>
<title>mrhoratio on "How to shorten a profile link?"</title>
<link>http://bbpress.org/forums/topic/how-to-shorten-a-profile-link#post-16054</link>
<pubDate>Thu, 08 May 2008 18:04:28 +0000</pubDate>
<dc:creator>mrhoratio</dc:creator>
<guid isPermaLink="false">16054@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Is it possible to shorten a profile link such as:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://www.example.com/forums/profile/username&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/forums/profile/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;to:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://www.example.com/profile/username&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/profile/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;or to:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://www.example.com/username&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;or to:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://my.example.com/username&#34; rel=&#34;nofollow&#34;&#62;http://my.example.com/username&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;or to:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;a href=&#34;http://username.example.com&#34; rel=&#34;nofollow&#34;&#62;http://username.example.com&#60;/a&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Thanks in advance.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
