untested but this should do it
add_filter ('bbp_current_user_can_publish_topics' , 'rew_disallow_anon') ;
function rew_disallow_anon ($retval) {
if ( ! is_user_logged_in() ) $retval=false ;
return $retval ;
}
How to allow unauthorized users to post replies in threads only, but disallow new topics?
There is a check-box in the forums tab – “Allow unauthorized users to create replies in topics.”
But when I turn on, anonymous can create both: replies and new topics also ((
How to split this permission? maybe code in functions.php…
Thanks 🙏
if it didn’t work in style pack there are 3 reasons
code error so does not work
wrong element targeted
something else is overwriting
1st looks ok
second could be the issue
so let’s try 3rd to check, so add this
#bbpress-forums #bbp-user-wrapper h2.entry-title {display: none !important;}
Hola!
Someone knows the full code for bbpress – remove the site field in anonymous form?
I’ve tried something like this (for the whole WP) but it doesn’t work
function remove_url_from_comments($fields) {
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields', 'remove_url_from_comments');
Thank!
HI
I got a code that i would like to hide thee username. For e.g when someone click on the profile member from the post in forum, it will bring to the profile page
#bbpress-forums #bbp-user-wrapper h2.entry-title {display: none;}
I have got the bbstyle pack and i entered the code above in the css customization but its not working. Is there a place I can insert the code above?
thanks
ok, put this is in the custom css part of the bbp style pack plugin
blockquote {
font-size: 12px !important;
}
just put this in your theme’s custom css area
blockquote {
font-size: 12px;
}
and change the size to whatever you want
Is there a plugin (or another way) to find out about the subscriptons in bbPress? The shortcode [bbp-stats] doesn´t help and statistic plugins seem to be closed. Any idea where to look in the database?
hmm, can’t say why it isn’t working – it is code that I put together from a number of sources.
If I can find time, I’ll look through the code, but no promises
Thanks Robin,
I just added the “title” line because it came out with an error.
Otherwise it works very well.
$title = bbp_get_forum_last_reply_title( $topic_id );
I think this function can be useful to other people.
Have a good day.
Hi,
The code with 404 error is this <a href="<?php bbp_user_topics_created_url($tessera_user_ID); ?>"><?php esc_html_e( 'Topics Started', 'tessera' ); ?></a>
The only function that works is <a href="<?php bbp_user_profile_url($tessera_user_ID); ?>"><?php esc_html_e( 'Profile', 'tessera' ); ?></a>
Do i have create any pages for the topics as for the forum;
Hi there,
Is it possible to use the forum title rather than the forum id when using shortcode to display the forum? In my website I am using a plugin which has virtual pages and I would like the user to search for the title of the forum they want and then it to be displayed – by means of shortcode.
Just in case, I would like to add that duplicate naming of the fourms would not be an issue in my website (it is not possible for the user to create a fourm with the same name).
Also, is there a way in which I am able to query the forum index? If so, am I able to check if a forum with this name (used in the query) already exists? If it doesn’t I would like the user to be able to start it, is this also possible?
WordPress version 5.6.2
bbPress version 2.6.6
Thanks in advance!
hmmm…
try using
Code Snippets
The code works fine in my functions file
so can you give us the code surrounding this use please
might have been too complicated, maybe just try
add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
function rew_freshness_display_reply ($topic_id = 0) {
$topic_id = bbp_get_topic_id( $topic_id );
$link_url = bbp_get_topic_last_reply_url( $topic_id );
$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
echo '<p class="platopost">'.$anchor.'</p>';
}
It shows nonce_failure error when I add the above code in my theme function.php file.
try
function rew_change_text( $translated_text, $text, $domain ) {
if ( $text == '<strong>Error</strong>: Your reply cannot be created at this time.') {
$translated_text = '<strong>Error</strong>: New moderation message';
}
return $translated_text;
}
add_filter( 'gettext', 'rew_change_text', 20, 3 );
Hi
If add a link to “topic and reply”, the embed function does not work.
ref img
https://ibb.co/qxXG125
site.com is an example for screenshots.
I entered the actual URL
error error embed
Oops! That embed can’t be found
ref img
https://ibb.co/grXr9dV
It was a site that has been without problems for months.
I just discovered it by accident.
The same is happening at the internal test site.
I installed the “Health Check & Troubleshooting” plug-in from the test site
and activated the Troubleshooting mode.
and only 2 plugin activate
– bbPress
– bbPress Permalinks with ID
The problem still occurs.
It’s a well-used feature, site, but suddenly a problem arises and I’m confused.
I must need to help
wordpress 5.5.3
PHP-7.4
Thanks
Best Regards,
Hyunho
Try
add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
function rew_freshness_display_reply ($forum_id = 0) {
// Verify forum and get last active meta
$forum_id = bbp_get_forum_id( $forum_id );
$active_id = bbp_get_forum_last_active_id( $forum_id );
$link_url = $title = '';
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_reply_id( $forum_id );
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_topic_id( $forum_id );
if ( bbp_is_topic( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
//$forum_id = bbp_get_topic_forum_id($active_id);
$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
$title = bbp_get_forum_last_topic_title( $forum_id );
} elseif ( bbp_is_reply( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
//$forum_id = bbp_get_reply_forum_id($active_id);
$link_url = bbp_get_forum_last_reply_url( $forum_id );
$title = bbp_get_forum_last_reply_title( $forum_id );
}
$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
echo '<p class="platopost">'.$anchor.'</p>';
}
Hello Robin,
I tried to adapt the code you provided me for the same function but from forums and not topics. I tried a lot of possibilities inside but each time it brings me back to the last forum and not to the last post of each topic.
I searched through the documentation and archives but couldn’t find anything.
So the code used is below, it fits the image well but not the last post of the subject in which it is:
add_action( 'bbp_theme_after_topic_freshness_author', 'rew_freshness_display_reply');
function rew_freshness_display_reply ($forum_id = 0) {
// Verify forum and get last active meta
$forum_id = bbp_get_forum_id( $forum_id );
$active_id = bbp_get_forum_last_active_id( $forum_id );
$link_url = $title = '';
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_reply_id( $forum_id );
if ( empty( $active_id ) )
$active_id = bbp_get_forum_last_topic_id( $forum_id );
if ( bbp_is_topic( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
$forum_id = bbp_get_topic_forum_id($active_id);
$link_url = bbp_get_forum_last_topic_permalink( $forum_id );
$title = bbp_get_forum_last_topic_title( $forum_id );
} elseif ( bbp_is_reply( $active_id ) ) {
//then reset forum_id to the forum of the active topic in case it is a sub forum
$forum_id = bbp_get_reply_forum_id($active_id);
$link_url = bbp_get_forum_last_reply_url( $forum_id );
$title = bbp_get_forum_last_reply_title( $forum_id );
}
$anchor = '<a class="rew_freshness_display_image" href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '"><img class="plato" style="width: 29px; height: 20px;" src="https://webershoot.com/mesimages/transplato.png">' . '</a>';
echo '<p class="platopost">'.$anchor.'</p>';
}
Regards.
what is your existing code?
It worked if I set capabilities when creating custom role.
function add_wp_custom_roles() {
add_role(
"bbp_member",
"Member",
[
"read"=>true,
"spectate"=>true,
"participate"=>true,
"read_private_forums"=>true,
"publish_replies"=>true,
"edit_replies"=>true,
]);
}
add_action("init", "add_wp_custom_roles");
you seems to have an inline style which is overwriting any other styling eg
style="height: auto !important;">
and <p style="height: auto !important;"
from this code.
<div class="bbp-reply-content" style="height: auto !important;">
-ad-client="ca-pub-8895339382096709" data-adsbygoogle-status="done"><ins<p><strong>1. The Profession of Faith—The Shahada</strong></p>
<p> </p>
<p style="height: auto !important;">The Profession of Faith, the shahada, is the most fundamental expression of Islamic<br>
It may be related to where you are importing the text from
the one above should work – I changed
$forum_id = '12345'
to
$forum_id == '12345'