so can you give us the code so far please
you need to learn how to look at classes in ‘developer’ in your browser, and then you can do all this yourself.
an example of the relevant image code is
<div class="tc-avatar" style="float:left;border-radius: 25px;"><a class="tc-profile-link" href="http://gos.rewweb.co.uk/users/admin/"><img alt="" src="https://secure.gravatar.com/avatar/dd803ad797ee5ca256d4be78c98fb305?s=96&d=mm&r=g" srcset="https://secure.gravatar.com/avatar/dd803ad797ee5ca256d4be78c98fb305?s=192&d=mm&r=g 2x" class="avatar avatar-96 photo" width="96" height="96"></a></div>
and the text
<div class="tc-content" style="padding-left:50px ; top: 50%;transform: translateY(-50%);position: relative;"><a class="tc-profile-link" href="http://xxx.com/users/admin/">admin</a>303</div>
I got an error why using your shortcode
Thanks. Only mistake there is that you forgot to insert your corrected edit
terms into the if
statement. 🙂
Thanks alot.
bbpress uses
edit_topics
and edit_replies
so doesn’t use the capabilities above
but suspect your code needs an if statement, so I’d do
// check frontend user privileges
if ( is_user_logged_in() && ( (current_user_can('edit_posts') || current_user_can('edit_pages') ) ) $canEdit = true ;
I have this code:
// check frontend user privileges
$canEdit = is_user_logged_in() && (current_user_can('edit_posts') || current_user_can('edit_pages'));
But I am not sure it is right. Front end users who are logged in can’t create or edit posts on my site but they can create an edit forum topics and replies.
What is the correct syntax?
this
Function reference
suggests
pll_register_string($name, $string, $group, $multiline);
‘$name’ => (required) name provided for sorting convenience (ex: ‘myplugin’)
‘$string’ => (required) the string to translate
‘$group’ => (optional) the group in which the string is registered, defaults to ‘polylang’
‘$multiline’ => (optional) if set to true, the translation text field will be multiline, defaults to false
so maybe
pll_register_string( 'slug_users', '_bbp_user_slug', 'polylang' );
I tried changing the hook and nothing happened. This is my code now:
/* Translate Users profile slug with Polylang */
add_action( 'plugins_loaded','bbp_polylang_integration' );
function bbp_polylang_integration() {
if ( function_exists( 'pll_register_string' ) ) {
pll_register_string( 'slug_users', '_bbp_user_slug', 'URL slugs' );
}
}
About this:
so is the context right – maybe ‘Polylang’ which seems to be the default?
I don’t really understand what you mean.
but if you really want this box gone then,
find
wp-content/plugins/bbpress/templates/default/bbpress/form-topic.php
transfer this to your pc and edit to remove
<?php do_action( 'bbp_theme_before_topic_form_subscriptions' ); ?>
<p>
<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe" <?php bbp_form_topic_subscribed(); ?> />
<?php if ( bbp_is_topic_edit() && ( bbp_get_topic_author_id() !== bbp_get_current_user_id() ) ) : ?>
<label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
<?php else : ?>
<label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
<?php endif; ?>
</p>
<?php do_action( 'bbp_theme_after_topic_form_subscriptions' ); ?>
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpress
where %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/form-topic.php
bbPress will now use this template instead of the original
then repeat for form-reply.php removing
<?php do_action( 'bbp_theme_before_reply_form_subscription' ); ?>
<p>
<input name="bbp_topic_subscription" id="bbp_topic_subscription" type="checkbox" value="bbp_subscribe"<?php bbp_form_topic_subscribed(); ?> />
<?php if ( bbp_is_reply_edit() && ( bbp_get_reply_author_id() !== bbp_get_current_user_id() ) ) : ?>
<label for="bbp_topic_subscription"><?php esc_html_e( 'Notify the author of follow-up replies via email', 'bbpress' ); ?></label>
<?php else : ?>
<label for="bbp_topic_subscription"><?php esc_html_e( 'Notify me of follow-up replies via email', 'bbpress' ); ?></label>
<?php endif; ?>
</p>
<?php do_action( 'bbp_theme_after_reply_form_subscription' ); ?>
You create those pages. Each page has a short code it in. You then tell Theme My Login the links to each of those pages.
add this to your theme’s custom css settings
.bbp_topic_subscription {
display : none !important ;
}
'_bbp_user_slug' => 'users', // User profile slug
is definately the slug
so is the context right – maybe ‘polylang’ which seesm to be the default?
and possibly change it’s hook to ‘plugins_loaded’ to make sure bbpress and polylang have both loaded before firing
but i’m guessing 🙂
Hi,
Is there are function\code that I can add to my theme in order to disable all email notifications from the forums (users AND admin)?
Thank you!
Hi, I have WP WordPress 5.4 with bbPress 2.8.3.1 and Polylang Pro 2.7 installed.
All the forums, topics, replies, everything are correctly translated, except the user profile.
I even attempted to manually register the slug but didn’t work.
The code I used to try to register the slug was:
/* Translate Users profile slug with Polylang */
add_action( 'after_setup_theme','bbp_polylang_integration' );
function bbp_polylang_integration() {
if ( function_exists( 'pll_register_string' ) ) {
pll_register_string( 'slug_users', '_bbp_user_slug', 'URL slugs' );
}
}
I tried with _bbp_user_slug
and with users
as well.
Hello,
The site to troubleshoot: planetanim.fr/forums
It is a mistake that I have had for a very long time.
And I apologize first if it has already been reassembled and treated. And then I apologize if my English is bad.
Once a post is published, when you modify it, the visual editor displays code instead of formatted text.
I tried to install plugins, to correct the functions.php file but to date I can’t do anything.
Thank you if that brings up an idea and share it with me.
I figured as much, I put in the above code in the CSS and it worked perfectly! I spent hours trying to edit my child theme this past weekend with no success, and you fixed it in 2 seconds. Thanks so much!
For anybody else that might use this in the future, in the above code, this worked for me after removing the “‘” between the “.” and “forum-archive”. So:
.forum-archive .site-content-header {
display : none !important;
}
Thanks again for all the help Robin!
@randrcomputers sinvce my code only runs on new topics – would be worth running a test with it enabled and disabled, and see if it makes a difference – if it does then come back.
found and fixed.
I’ve put the fix in my style pack plugin version 4.5.0
bbp style pack
once activated go to
dashboard>settings>bbp style pack>bug fixes
or put this in your child theme’s function file – or use
Code Snippets
add_filter ('bbp_get_topic_merge_link', 'rew_get_topic_merge_link' , 10 , 3) ;
add_filter ('bbp_is_topic_merge' , 'rew_is_topic_merge' ) ;
function rew_get_topic_merge_link( $args = array() ) {
// Parse arguments against default values
$r = bbp_parse_args( $args, array(
'id' => 0,
'link_before' => '',
'link_after' => '',
'merge_text' => esc_html__( 'Merge', 'bbpress' ),
), 'get_topic_merge_link' );
// Get topic
$topic = bbp_get_topic( $r['id'] );
// Bail if no topic or current user cannot moderate
if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {
return;
}
$uri = add_query_arg( array( 'action' => 'bbp-merge-topic' ), bbp_get_topic_edit_url( $topic->ID ) );
$retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after'];
// Filter & return
return apply_filters( 'rew_get_topic_merge_link', $retval, $r, $args );
}
function rew_is_topic_merge() {
// Assume false
$retval = false;
// Check topic edit and GET params
if ( bbp_is_topic_edit() && ! empty( $_GET['action'] ) && ( 'bbp-merge-topic' === $_GET['action'] ) ) {
return true;
}
// Filter & return
return (bool) apply_filters( 'rew_is_topic_merge', $retval );
}
that code only runs when a new topic is posted, and should not be resource heavy.
Is it in your functions file or code snippets or elsewhere?
so in
dashboard>setting>forums I presume you have
Allow users to mark topics as favourites
set ?
I am known to make mistakes! Maybe I did something wrong.
The bad news is that my super-dooper moderator (who I admit I did ask to test things to death before we open the site to the masses) has now discovered he gets that same error messages when trying to merge topics.
The fix in BBstylepack is still activated so it seems that isn’t a fix for everything.
I’m not sure if I should be asking for more help from you as the impression I get is that another plugin is causing a conflict. And looking at your snippet code it looks to me as if that is for splitting topics only. But I thought I should make you aware.
Meanwhile I will start disabling plugins and see what gives.
John
Best regards,
John
you set up a page called say register_page and put this code into the content
[bbp-register]
Hi,
I’d love to display the latest forum topic to my logged in user using a ‘hello bar’ / horizontal bar at the top of my site (I’d build it in Elementor).
I’ve tried with the [bbp-display-topic-index show=’5′] shortcode but it displays it vertically.
I’m not well versed in php but I can copy and adapt.
Would anyone be able to advise how I can do this?
Thanks!
add_action ('bbp_theme_before_topic_form_notices' ,'rew_show_notice' ) ;
function rew_show_notice () {
if (!is_user_logged_in()) {
echo '<div class="rew-notice">Only registered users are allowed to upload attachments'</div>' ;
}
}