Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 676 through 700 (of 32,453 total)
  • Author
    Search Results
  • enkoes
    Participant

    There it is:
    $bbp_roles['bbp_prime_moderator'] = array(

    I’ve tried the two options below but both return errors:
    if ($user_role == bbp_get_bbp_prime_moderator_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_prime_moderator_role()) unset ($links['edit']) ;

    Robin W
    Moderator

    ok, so what is the role on this line

    $bbp_roles['bbp_tutor'] = array(

    and what is the code you have added in the code above?

    enkoes
    Participant

    Yes. It works beautifully! 🙂

    I just found out something when I thought the issue is solved. The code works well with native bbpress role, but not work with new role created. I have a new role “prime_moderator” created using your plugin, but the code return error when I apply this new role to the codes. Any suggestions?

    Regards.

    Robin W
    Moderator

    sorry, try this

    add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
    add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
    
    function rew_remove_edit ($links) {
    $user_id = bbp_get_current_user_id() ;
    $user_role = bbp_get_user_role( $user_id );
    if ($user_role == bbp_get_keymaster_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_participant_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_spectator_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_blocked_role()) unset ($links['edit']) ;
    return $links ;	
    }
    enkoes
    Participant

    Hi Robin, thanks for your prompt reply.

    The code does not work. Perhaps something missing?

    I only take this
    if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
    When moderator log in, he still can see the “edit” link.

    Regards.

    Robin W
    Moderator
    add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
    add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
    
    function rew_remove_edit ($links) {
    $user_role = bbp_get_user_role( $user_id );
    if ($user_role == bbp_get_keymaster_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_moderator_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_participant_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_spectator_role()) unset ($links['edit']) ;
    if ($user_role == bbp_get_blocked_role()) unset ($links['edit']) ;
    return $links ;	
    }

    and amend as needed

    spectator and blocked not really needed as neither can post, but included for completeness !!

    enkoes
    Participant

    Hi, I’m using the codes below to remove “Edit” link in reply header without any issue:

    add_filter ('bbp_reply_admin_links', 'rew_remove_edit') ;
    add_filter ('bbp_topic_admin_links', 'rew_remove_edit') ;
    
    function rew_remove_edit ($links) {
    	unset ($links['edit']) ;
    return $links ;	
    }

    My question: If I want the codes to work only for Role A & Role B, but NOT for other roles, how would I amend the code above?

    Regards.

    #235873
    Robin W
    Moderator

    I just had a quick look at the yoast code, and this is deliberate.

    a comment in the yoast code says :

    If breadcrumbs are active (which they supposedly are if the users has enabled this settings),
    		 * there's no reason to have bbPress breadcrumbs as well.
    salvagedwisdom
    Participant

    WordPress v. 6.2.2
    BBPress v. 2.6.9
    Site (under construction): https://www.batsandblacklace.com

    I am able to use the forum index shortcode while I’m editing my forums page and everything looks perfect (first screenshot). On the front end however, it looks completely different and is completely unusable (second screenshot). I have driven myself insane trying to figure this out and I’m coming up completely empty. Does anyone know what’s going on here?

    Thanks!

    Screenshot 1
    Screenshot 2

    #235863

    In reply to: How to add search bar?

    Robin W
    Moderator
    function bbptoolkit_show_search_form(){
    	if ( bbp_allow_search()) {
    			?>
    			<div class="bbp-search-form">
    				<?php bbp_get_template_part( 'form', 'search' ); ?>
    			</div>
    			<?php
    		}
    	}
    	
    add_action( 'bbp_template_before_single_forum', 'bbptoolkit_show_search_form' );
    add_action( 'bbp_template_before_single_topic', 'bbptoolkit_show_search_form' );

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #235835

    In reply to: Template

    loftus49
    Participant

    Many thanks (again). I’ll use the shortcode to resolve this, as you suggest.

    Another SOLVED and CLOSED issue.

    #235834

    In reply to: Template

    Robin W
    Moderator

    ok these are instructions from 12 years ago, and are not applicable for the current version of bbpress.

    If you just enable the ‘anyone can register’, then users can register from either the topic/reply forms, or you can use a register page – ie create a page – call it whatever you want and put the shortcode [bbp-register] in it. Then add this page to your menu.

    #235796
    enkoes
    Participant

    Oh ok. Thanks.

    Now I shifted back to [bbp-topic-index] and limit the number of displayed topics in WordPress dashboard setting>forum. And it finally displays page number.

    #235784
    Robin W
    Moderator

    from memory I have not written that one with pagination as the bbpress one does that for pages where you want lots to show, but does just have 15 as the only option

    [bbp-topic-index]

    #235781
    enkoes
    Participant

    Hi,

    It seems that I have problem with pagination display.

    I use shortcode [bsp-display-topic-index show=‘30’] to display the topic list. I have currently 15 topics so far, and display looks fine:

    Viewing 15 topics - 1 through 15 (of 15 total)

    But when I change the shortcode to [bsp-display-topic-index show=‘10’], my total number of topics also being reduced:

    Viewing 10 topics - 1 through 10 (of 10 total)

    And I don’t see any pages number 1,2

    Somewhere gone wrong?

    Regards.

    #235775

    Topic: Closed Topic

    in forum Troubleshooting
    Devcr3
    Participant

    I wrote this code to close the topics (specific forum) after 24h. It’s right?

    // Funzione per chiudere automaticamente i topic dopo 24 ore
    function chiudi_topic_dopo_24_ore($topic_id) {
    // Ottenere la data di creazione del topic
    $topic_date = get_post_field(‘post_date’, $topic_id);

    // Calcolare la data e l’ora attuali
    $current_date = current_time(‘mysql’);

    // Calcolare la differenza in ore tra la data di creazione del topic e l’ora attuale
    $hours_diff = round((strtotime($current_date) – strtotime($topic_date)) / (60 * 60));

    // Se sono passate 24 ore, chiudere il topic
    if ($hours_diff >= 24) {
    bbp_close_topic($topic_id);
    }
    }
    add_action(‘bbp_new_topic’, ‘chiudi_topic_dopo_24_ore’);

    // Funzione per chiudere automaticamente i topic esistenti dopo 24 ore
    function chiudi_topic_esistenti_dopo_24_ore() {
    // Ottenere tutti i topic del forum specifico
    $args = array(
    ‘post_type’ => bbp_get_topic_post_type(),
    ‘post_parent’ => ‘YOUR_FORUM_ID’, // l’ID del forum
    ‘posts_per_page’ => -1,
    );
    $topics = get_posts($args);

    // Chiudere i topic che hanno superato le 24 ore
    foreach ($topics as $topic) {
    $topic_id = $topic->ID;
    chiudi_topic_dopo_24_ore($topic_id);
    }
    }
    add_action(‘init’, ‘chiudi_topic_esistenti_dopo_24_ore’);

    #235734
    zoddshop63
    Participant

    bbpress doesnt send any emails… activation emails, forgot password, subscription, etc..
    the page bbp-register shortcode has register option which sends an email but since no email is sent no user can register.

    #235699
    #235695
    Robin W
    Moderator

    It may well be the address that bbpress is sending from.

    this is typically noreply@ and if this email address does not exist then many email hosts will not permit its transit through the system.

    either

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Subscription Emails

    where you can amend the address and change the wording as well

    or

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    add_filter('bbp_get_do_not_reply_address','my_bbp_no_reply_email');
    function no_reply_email(){
        $email = 'noreply@yourdomain.com'; // any email you want
        return $email;
    }

    and change the address

    #235654
    johngtur
    Participant

    For anyone with the same problem, this appears to be a bug in BBPress. The script that is meant to fire when someone clicks the “subscribe” button (engagements.js) is only enqueued for the forum and topic post-types. When a forum or topic is embedded on any other post-type, the script is not enqueued, and the button doesn’t do anything.

    A quick fix is to add this to your functions.php file, to enqueue the script whenever a forum or topic is embedded via a bbp-single-topic / bbp-single-forum shortcode:

    add_filter( ‘do_shortcode_tag’,’subscription_button_fix’,10,3);
    function subscription_button_fix($output, $tag){

    $arr = array(‘bbp-single-topic’, ‘bbp-single-forum’);
    if(!in_array($tag, $arr)){
    return $output;
    }
    bbp_enqueue_script( ‘bbpress-engagements’, ‘js/engagements.js’, array( ‘jquery’ ), true );
    wp_localize_script( ‘bbpress-engagements’, ‘bbpEngagementJS’, array(
    ‘object_id’ => get_the_ID(),
    ‘bbp_ajaxurl’ => bbp_get_ajax_url(),
    ‘generic_ajax_error’ => esc_html__( ‘Something went wrong. Refresh your browser and try again.’, ‘bbpress’ ),
    ) );

    return $output;
    }

    #235606
    Robin W
    Moderator

    ok, is that from a shortcode, or how are you getting to that page?

    #235576
    apizio
    Participant

    Hello Robin,

    you are right, it is a theme issue. When I switch to a default theme like twentytwenty, the submit button appears.
    Now I edit my style.css file and tryed to get the style for the submit button in it. But I surely make mistakes here.

    .button .bbp_user_edit_submit .button .submit .user-submit .bbp_user_edit_submit {
      background-color: #4CAF50; /* Green */
      border: none;
      color: white;
      padding: 15px 32px;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 16px;
    }

    This does not let the submit button appears 😉
    What else can I do?

    Thank you in advance,
    Antonio

    #235533
    milicagpg
    Participant

    Hello. I created two forums and wants that theirs topics be presented on two different pages. I added the shortcode [bbp-topic-form forum_id=$forum_id] on both page referencing the forum_id which topics I want present on that page. At page1 I don’t have the problem, but on page2 I see the topics from both forums. The form for entering a new topic on page 2 is ok and regularly sorts topics into forum 2, but the display on the page shows posts from both forums.

    Anyone can help? I think I believe that the solution is trivial, but I’ve been stuck with it for several days.
    Version of bbPress is 2.6.9 . The project is still on localhost.

    #235528

    In reply to: Close topic label

    Robin W
    Moderator

    thank you

    put this in the custom css part of the style pack plugin

    #bbpress-forums .status-closed, #bbpress-forums .status-closed a {
    	background-color: transparent;
    }
    #235503

    In reply to: Close topic label

    Robin W
    Moderator

    put this in the style pack custom css or your theme’s custom css

    #bbpress-forums .status-closed, #bbpress-forums .status-closed a {
    	background-color: none !important;
    }
Viewing 25 results - 676 through 700 (of 32,453 total)
Skip to toolbar