Hey Gang,
You know the links that are avail in the user menu (top right) when logged in? (Activity, Profile, Notifications, etc). All of those links are dynamically created based on the logged in userID.
I wanted to create a few of those shortcuts in a custom link in our main site navigation menu, but I’m unsure what type of code to use to dynamically insert the UserID of the logged in user.
So for example, how can I create a custom link that will populate the users’ ID:
http://www.theworshipcommunity.com/members/%5B**USERID-OF-MEMBER**/forums/subscriptions/
As you can see if you go to:
http://www.theworshipcommunity.com/dicuss/
Under “Discussion Forums” i have some sub-links that show the RSS feed options. It’s under there I wanted to have a custom link for “My Subscriptions & Unread Topics” with that dynamic URL above.
Thanks,
Fred
Plus i basically just got this code from here
Resizing Avatars
did you copy it correctly I just tested it out and pasted it right from my functions.php file
Im going to paste it again just in case it was me that forgot something.
function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
$author_avatar = '';
if ($size == 14) {
$size = 24;
}
$topic_id = bbp_get_topic_id( $topic_id );
if ( !empty( $topic_id ) ) {
if ( !bbp_is_topic_anonymous( $topic_id ) ) {
$author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
} else {
$author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
}
}
return $author_avatar;
}
/* Add priority (default=10) and number of arguments */
add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
For some reason when I added the function code to my functions.php it gave me a 500 Internal Server Error.
use this PHP function to resize the small avatars
function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
$author_avatar = '';
if ($size == 14) {
$size = 24;
}
$topic_id = bbp_get_topic_id( $topic_id );
if ( !empty( $topic_id ) ) {
if ( !bbp_is_topic_anonymous( $topic_id ) ) {
$author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
} else {
$author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
}
}
return $author_avatar;
}
/* Add priority (default=10) and number of arguments */
add_filter('bbp_get_topic_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
add_filter('bbp_get_reply_author_avatar', 'my_bbp_change_avatar_size', 20, 3);
The CSS you would have to use now is
#bbpress-forums .bbp-author-avatar .avatar-24 {
width: 24px !important;
height: 24px !important;
padding: 0 !important;
border: none !important;
}
and you can remove the first function i gave you to test with
Well the file you are suppose to copy and create a bbpress.php file from is index.php
And although putting the forum index shortcode in a page is “easier” in a sense , you will still come up with issues just like you are going through. This is why I have been editing the Codex for the last few days to hopefully fix these issues that users might come across.
As for that weird wp tweaks issue you have , I do not know how to fix that. if you are only using that plugin just for a bbPress specific sidebar there are better plugins than that one.
And it is not hard to manually create a bbPress specific sidebar too.
Thanks so much – although I am wondering if it is going to solve my problem (but please do!)
it might help a little, there is a bunch of post meta that you would have to remove for it to look correct.
You can also contact me later today through email, if you need help during the process.
Contact
Alright the second code worked. Thank you so much for helping. Do you by chance have any suggestions on how to un-blur my avatar picture? Thank you again.
Yes, possible.
You can insert the massage via hook do_action( 'bbp_theme_before_reply_form' );. To make limitation, you can use post ID get_the_ID() detection.
I hope it helps.
#bbpress-forums .bbp-author-avatar .avatar-14 {
width: 24px;
height: 24px;
padding: 0;
border: none;
}
if that does not work try this
#bbpress-forums .bbp-author-avatar .avatar-14 {
width: 24px !important;
height: 24px !important;
padding: 0 !important;
border: none !important;
}
try this CSS code and hopefully this fixes your issue.
it looks too small at 14px so i bumped it up to 24px , you can change that back to 14 if you want.
#bbpress-forums img .avatar-14 {
height: 24px;
width: 24px;
padding: 0;
border: none;
}
Here are the results from placing the code in my functions.php file:
You will see that I now have an avatar picture showing up next to the topic title, still no change to the other small avatars.
I have a very similar problem and I must admit I have posted it as a seperate topic, but you guys seem so close to the problem (and solving it) that I trust it’s ok to post here as well.
I am using the Listify Theme and there does not fundamentally seem to be a default template that will work with bbpress. No matter what template I choose and copy as the plugin-bbpress.php template for example – it won’t work. Here’s an example of the page not working – http://tattsamistake.com/forums/
So….I built a custom page and put the shortcode in it – and the page works. BUT when I click thru to a forum, I get my navigation path which links to the forums page that doesnt work – ie the path shown is … Tattoo Removal Australia › Forums › Tattoo Removal
and if i click on ‘forums’ it goes to the non-working page – http://tattsamistake.com/forums/
BUT if i go and change the slug from ‘forums’ to ‘Tattoo-forum’ (the customised page that does work) it goes and applies a non-working template to that page, so in effect killing the page.
I guess to solve it I need the following…
1. A way to tell it where the forum short-code is without over-writing the page template
2. This may sound very silly but is there such a think as a generic bbpress.php template that I can use and upload to my site? Sure it won’t look like my site, but it would be a starting block.
3. Can I just get rid of ‘forums’ in that path, or at a pinch just get rid of that path from displaying completely?
Any help much appreciated!
I am using the Listify theme at http://tattsamistake.com
For some reason none of the page themes will work with bbpress (if I am wrong would love to know!)
So I followed the instructions on building a new page and adding the forums short-code to it. Even then it isn’t ideal but it will just about do – you can see it at http://tattsamistake.com/tattoo-forum/
If I click on any forum I then get presented with a directory ‘path’ to go back one page ie – Tattoo Removal Australia › Forums › Caring for Tattoos
The problem is – if I click on ‘Forums’ I go to the ‘default’ forums page that doesn’t work, rather than the new forums page that I built (that mostly works)
If I go to settings and change the name ‘forums’ to the same name as my custom-made forums page, it then overwrites my page template choice with the template that doesn’t work for forums – so it breaks the page
So in short – how can I get that ‘path’ Tattoo Removal Australia › Forums › Caring for Tattoos
to point to my working forums page, rather than a non-working forums page?
Hope this makes sense!
How do your users register through your site?? Do they use the normal WordPress login forms, or do you use the bbPress shortcodes , or something different??
Also do you have multi-site??
this is still a issue for me, because i have to update the role of new users everytime from the database when new user register to my site.
I found the the table inside database where it user role was coming, we need to change wp_capabilities value inside wp_usermeta table. This was the final solution to my issue.
Keymaster value : a:3:{s:13:"administrator";b:1;s:13:"bbp_keymaster";b:1;s:9:"translate";b:1;}
Participant value: a:2:{s:10:"subscriber";b:1;s:15:"bbp_participant";b:1;}
however, the value differs from site to site.
Thats custom code to this site.
Nice to see that other people would like to see this as part of the standard set-up as @roberts-1 says… I am running the same versions using Momizat’s ‘Goodnews’ theme
I’ve just tried @undergroundnetwork ‘s code and it works great for me as an admin… but for some reason, the other users with lower levels of access, don’t get the same result – they only get WordPress results, none from bbPress.
Any ideas why? I’d really like to just have one search that does it all instead of one for forums and another for blogs etc.
Cheers
@hunniemaid
you place the code in your child themes functions.php or you can use a plugin like this
https://wordpress.org/plugins/functionality/
with that plugin you go to plugins> edit functions then place the code i gave you.
Where should I place this code? single-post-reply.php? Sorry, new to bbPress. Thank you for the response.
Thanks for that. Unfortunately when I make those changes i end up with a blank, white screen instead of a forum! If I use the form-search.php alone and don’t add the code to functions.php, about half the page renders but the sidebar etc are missing.
Is there anyone who could do a little custom work to get this figured out for me? I’m happy to pay, of course.
@van24
yeah i tested it and it seems to work good.
and yes the PHP code snippets you can add to a child themes functions.php file.
WAIT: I think I found it here:
http://www.theworshipcommunity.com/members/admin/forums/subscriptions/
There you go!
Also, if you’re good w/ design/style, etc — can you tell me why my right sidebar gets pushed down to the bottom of the page on certain forum pages?
i tired it last night but i couldn’t find what was causing the problem easily through CSS, i would have to dig in your code more.
#bbpress-forums .bbp-body .reply {
background: #f5f5f5;
}
@juggledad
@robkk: Just to clarify something, the OR function_exists(‘is_bbpress’) was added (with some other code, to get around a bug that bbpress doesn’t seem to want to acknowledge or fix. see https://bbpress.trac.wordpress.org/ticket/2723
Thanks for pointing that out, i did not know about that bug.
Okay with this bug in bbPress you cannot use the WP conditional is_single() to affect all of the bbPress pages, since for some reason there is a bug for single user pages.Thanks for creating the trac ticket, I tested out and see that yes it does not work on user pages. Over the next few days/week i will check it out and see I can come up with a fix.
But this bug is easily avoidable by creating a bbpress.php for your theme and just using the_content() instead of bfa_post_bodycopy() and removing OR function_exists('is_bbpress') from the bfa_post_bodycopy() function. The bbpress.php file also helps remove other post meta that might not be useful for bbPress forums instead of using CSS to hide them.
The OR function_exists('is_bbpress') you can keep in bfa_get_options.php though as i do not see any problems with that.
If there is something you can find on your end to fix the issue with your theme and bbPress then please drop an answer on this topic, because i haven’t looked and learned your theme 100% yet. Removing the function exists and creating a bbpress.php is the quickest solution to the problem that I could find.
@kitfreeman
This excerpt issue that you are seeing affects all of these areas
category pages
tag pages
author pages
archive pages
search result pages
and the home page
which is where all the excerpt theme settings modify.