“Very nice, sorry my ‘help’ wasn’t that useful
“
-> Not at all, without you this integration wouldn’t have been possible!
Very nice, sorry my ‘help’ wasn’t that useful
“I would like to insert the “edit profile” link and some other stuff into my wordpress sidebar.”
-> I think we have solved this question in the other topic
got it, it is $current_user->display_name
so even more elegant; now when an user logs in has his nickname displayed in the sidebar
This $current_user seems to be quite useful.
How can you insert $current_user here to replace Profile?;
. __('Profile') .
for “UserName’s Profile”, is there any call using $current_user?
$current_user->NAME didn’t work
It works!!!!!!
The working whole code is;
function wp_registro( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
$link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
else
$link = '';
} else { if( current_user_can('activate_plugins') ) {
$link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;}
else {global $current_user; $link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php?id=' . $current_user->ID . '">' . __('Profile') . '</a>' . $after;
}
}
echo apply_filters('register', $link);
}
Now when any user logs in, wordpress sidebar displays a link to his profile in bb, but when is the admin the one who logs in he get a link to wp control panel. 
Thanks a lot fel64!
Try this one.
global $user_ID;
get_currentuserinfo();
... bbpress/profile.php?id=' . $user_id . '">' . ...
These two do not display anyting either;
/bbpress/profile.php?id=' . ID . '">'
/bbpress/profile.php?id=' . $user->ID . '">'
Are you sure it is a .htaccess rewrite issue? Is your main site also sluggish? Your .htaccess file contains a *lot* less code than mine. And my site isn’t exactly slow.
I timed http://ochremusic.com/ using my wristwatch. The main page takes 14 seconds to load. 6 seconds for the site to even begin loading. Clicking forums immediately took me 5 seconds for the page to load.
That makes it 6 seconds for the DNS to resolve(?) 8 seconds for the main site and 5 seconds for the forums.
Nop, it doesn’t work; this line
global $user; $link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php?id=' . $user . '">' . __('Profile') . '</a>' . $after;
links to /bbpress/profile.php?id=
it is not catching the user id
I made for my bbPress forum (http://forum.2diabolos.com) a plugin that inserts Adsense or YPN code in the posts.
Lots of configuration parameter (not show to administrators, positionning, number of adsense block ….);
easy to install and configure, with a administration panel (in Themes menu)
That’s a special version I made for Sneaky who had problems finding out what the error was
This is the currently latest version; I was planning to upload properly to the plugins section when there’s no outstanding problems here. This version is the same as the one you downloaded, though, just without the messages.
Try changing the “global $bbdb;” to this:
global $bbdb, $bb_cache;
Unless you’ve sent out any header information with header()
there must be; I can think of no other way to explain it. It does say, output started in that file.
I don’t know about chosen passwords.
Bugs go to http://trac.bbpress.org.
No permanent deletion yet.
No locking forums.
Yes. If is_bozo
is 1, that is true, and the user is considered a spammer. 0 means they are not a bozo/spammer.
Several other whats you have found?
That’s probably because there are some empty lines above or below the <?php
or ?>
– check for them. Thanks for coming back and posting the solution, too.
It really should be, might have made another one of the silly little mistakes I’m so fond of. Try
global $user;
and use $user->ID
instead.
Those two plugins don’t help at all. Basically if you have a lil php code that you have in your bbpress theme to display anything from display names, profile info or the avatar when using upload avatar plugin….when you paste that code on the wordpress side you get an error.
I was able to find this in past discussion. I’m posting the fix here in case anyone else needs it:
https://bbpress.org/forums/topic/700/page/2?replies=64#post-4936
from Trent, but code fixed up a little by Nanome:
“Create a file called whatever you want, but I recommend path-to-url.php
and put the following in it and upload it to /my-plugins/ directory:”
-Trent
Nanome’s fix:
<?php
function fix_bb_path_to_url( $url ) {
$url = str_replace(array(‘//’, ‘\\’, ‘\’), array(‘/’, ‘\’, ‘/’), $url);
return preg_replace( ‘|
([^/])|’, ‘
/$1′, $url );
}
add_filter( ‘bb_path_to_url’, ‘fix_bb_path_to_url’, 1, -1 );
?>

I tried “activate_plugins” and it works great! The only thing left is fixing the id number because it is showing “21”.
is” global $id” ok?
Turns out administrate
isn’t a capability. Woooops. Sorry! Thought bb and WP would be equivalent.
Take your pick of capabilities:
- switch_themes
- edit_themes
- activate_plugins
- edit_plugins
- edit_users
- edit_files
- manage_options
- moderate_comments
- manage_categories
- manage_links
- upload_files
- import
- unfiltered_html
- edit_posts
- edit_others_posts
- edit_published_posts
- publish_posts
- edit_pages
- read
Hi fel64, thanks for the explanation.
I tested and the function works but there are two errors in the code.
First, the id user line displays “21” for every user
global $id; $link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php?id=' . $id . '">' . __('Profile') . '</a>' . $after;
Next, if( current_user_can('administrate')
doesn’t seem to work because it display a link to bbpress profile instead to /wp-admin/
This is the whole function so far;
function wp_registro( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
$link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
else
$link = '';
} else { if( current_user_can('administrate') ) {
$link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;}
else {global $id; $link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php?id=' . $id . '">' . __('Profile') . '</a>' . $after;
}
}
echo apply_filters('register', $link);
}
did I made a mistake in the second “else” ?
Yeah, you could copy the wp_register()
function into your functions.php file, modify it (and its name), and then use the modified function instead.
Actually it should be
global $id;
Sorry. And for the last line, you have the right idea but you have to use the string concatenation (putting together into one) operator: the dot .
This part is gonna be a bit more complicated, but solution at the bottom.
Strings are indicated by using apostrophes ' ... '
or quotation marks " ... "
. If you start a string with one of them, the other one doesn’t affect anything. Variable names inside the quotation marks "
will be replaced with their value, but inside '
they will not. The strings here are made using apostrophes '
, so you can have valid HTML code without problems: '<a href="..."'
works, but "<a href="...""
doesn’t. But that means variable names inside the string won’t get replaced with their value. So you have to concatenate the strings, like this: '<a href="...' . $id . '"> ...';
$link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php?id=' . $id . '">' . __('Profile') . '</a>' . $after;
Should work. Bit tired and therefore also inclined to ramble; sorry about that.
“you could just copy all of wp_register() into your theme (everything from function wp_register() { to the final }”
-> do you mean copying in my theme functions.php file and then calling the fuction in the sidebar?
“WordPress sets $id to be the user ID. It should be available, so just try it. If it’s not, you will need to put global: $id; in the line of code above it, so it knows you mean the global variable $id and not a new one.”
-> I didn’t understand this. Do you mean something like this?
global: $id;
$link = $before . '<a href="' . get_option('siteurl') . '/bbpress/profile.php$id">' . __('Profile') . '</a>' . $after;
Hi folks,
Just trying to iron out the niggles in my forum. I’ve noticed that my forum is very slow compared to the forum here, which seems surprising given my forum’s lack of activity! Could it be related to the permalinks structure or .htaccess? I’ve tried setting the permalinks up in config, with multiview in the .htaccess, and while it works fine in FF (still slow though) it won’t appear in IE (I get a 404). So I’ve disabled permalinks in order for it to work in IE.
Now, some info. My forum is in a subdirectory from my main WordPress install. I had to enable the php5 handler in the site root .htaccess file for all the new bits and bobs in WP 2.2 to work properly. Here’s what my root .htaccess file looks like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.ochremusic.com$ [NC]
RewriteRule ^(.*)$ http://ochremusic.com/$1 [R=301,L]
AddHandler application/x-httpd-php5 .php
Would any of that inherited by the forum subdir cause any problems with the bbPress permalink structure, or cause speed issues? Tried optimising the db, but no difference.
Any help on these issues would be very gratefully received, thanks.
PS. Also, for some reason I get a 404 trying to validate the forum on W3. Clues as to why?
(Sorry!)
En serio que me gustaría poder ayudarte más :_(
Pero al final… decidí cambiar de nuevo y seguir con Vanilla de Lussumo, bbpress está demasiado verde y le faltan funciones que ya uso en Vanilla, es más, ya tengo hacks para muchas cosas y me gusta como me ha quedado.
La integración con la DB de WordPress, las sesiones, etc… va de perlas con Vanilla, así que nada me impedía ya seguir con Vanilla.
Tengo más o menos una integración gráfica, de perfiles y de registro y logeo. Me quedó “casi” perfecto para mí ^^
Me gustaría poder aportando si es posible y sirve cosas aquí, me gusta el proyecto bbpress… pero por ahora.
Así que si te sirve de algo puedes registrarte y chequear mi sitio con esta integración:
http://www.laguardiadejaen.com/web/foro/
Un saludo y suerte.
PD: Puedes contactarme por aquí si necesitas algo, ok?