Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,101 through 3,125 (of 32,522 total)
  • Author
    Search Results
  • #208907

    In reply to: User Statistics

    Chuckie
    Participant

    Notice this code is actually commented out?

    //if (is_user_logged_in()) {

    That must have been done for a reason.

    #208906

    In reply to: User Statistics

    Chuckie
    Participant

    Look at the function build_html():

            // Actually build all of this HTML
            function build_html() {
                
                $this->sort_users();
                $data = $this->stats_builder();
                $HTMLOutput = "";
                
    			//if (is_user_logged_in())  {
    
    				foreach( $data as $key => $html ) {
    				   $HTMLOutput .= "<div class='bbpas-" . $key . "' id='bbpas-" . $key . "'>" . $html . "</div>";
    				}
                //}
    			
                return $HTMLOutput;
            }

    It calls sort_users(); That in turn does a select query to get a list of active users:

            private function sort_users() {            
                
                // Set the active users
                $this->_activeUsers = $this->get_ActiveUsers();
                
                // Work out the longest time possible for a user to be classed as active
                $active_timeframe = strtotime( $this->_sqlTime ) - ( $this->parent->option['user_inactivity_time'] * 60 );

    At no point can I see anywhere that it checks to see if the active user is logged in and not blogged in the forum. It should be doing these tests because it should not be exposing user names.

    You can see it with my site if you use private mode.

    This has to be fixable and I don’t understand why it was never implemented in the first place really. I just don’t know how to do it.

    #208896
    Chuckie
    Participant

    This works:

    https://www.publictalksoftware.co.uk/?bbpnns-login=1&redirect_to=https://www.publictalksoftware.co.uk/support-forums/topic/xxx/#post-4784

    #208894
    Chuckie
    Participant

    Hi

    I added a reply to a topic with some instructions.

    Then, in my main topic I wanted to add a link to the reply so that the user could jump to see it.

    For example:

    https://www.publictalksoftware.co.uk/support-forums/topic/xxx/#4784

    When I click the link it does not jump to that reply. Why?

    #208892

    In reply to: User Statistics

    Chuckie
    Participant

    Yes. I wish I had enough confidence to delve in with this issue myself. It seems it is going to be a simple fix:

    display stats = no
    is user logged in?
      is user forum role not blocked?
        display stats = yes
    
    if display stats = yes
      show stats

    That would be the simplest solution.

    #208804
    vinem
    Participant

    Hi there,

    I’m building a website with Elementor Pro and bbPress.
    I created 2 different Headers: a main one for the Landing page and blog, and another one for the forums.
    I used the shortcode to display the forums index on a page I’ve built with Elementor and the Header works fine. But when it comes to the automatically created single pages (topic, reply, search, etc.), it displays the main Header.

    I contacted Elementor support, not knowing if the issue was on their side or on yours, and they told me I had to contact you, explaining me this :
    “For your information, we usually find this happening when creating custom post types where it is excluded from showing in menus via the custom post type’s “show_in_nav_menus” option; this option is found in the post type’s “register_post_type” function used to add it in WordPress and may be set to “false” in this case […] we highly recommend contacting the bbPress support team to help with changing this option to “true”. The solution we suspect would be similar to using the function code mentioned in this bbPress support post but with the ‘show_in_nav_menus’ variable set to ‘true’ > https://bbpress.org/forums/topic/plugin-snippet-hack-to-include-bbpress-topics-in-wordpress-search/

    So, here I am! Can someone help me, please?

    Thank you!

    #208799

    In reply to: bbPress + Elementor

    kevinmckerracher
    Participant

    Thanks for the quick reply, looks like a code your own day is coming up.

    #208786

    In reply to: Character Count

    jemar707
    Participant

    I tried to post as code….will try again. But this didn’t work.

    function rew_max_length ($reply_content) {
    	if (strlen($reply_content)<500) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be less than 500 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_max_length' );
    #208783

    In reply to: Character Count

    Robin W
    Moderator

    I don’t know how technical you are, this one does the opposite

    function rew_min_length ($reply_content) {
    	if (strlen($reply_content)<61) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be at least 60 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_min_length' );
    Robin W
    Moderator

    I mean it would require someone writing some code

    burhi
    Participant

    Okay thanks.

    Have a code?

    #208778
    Robin W
    Moderator

    the includes/forum/template.php has a function called bbp_get_forum_class which adds classes, but as far as I can see it is never used.

    bbp_list_forums in the same template has

    // Subforum classes
    			$subforum_classes      = array( 'bbp-forum-link' );
    			$subforum_classes      = apply_filters( 'bbp_list_forums_subforum_classes', $subforum_classes, $sub_forum->ID );
    
    			// This could use bbp_get_forum_class() eventually...
    			$subforum_classes_attr = 'class="' . implode( ' ', array_map( 'sanitize_html_class', $subforum_classes ) ) . '"';

    so looks like this is a plan?

    anyway you could use the line listed above

    $subforum_classes = apply_filters( 'bbp_list_forums_subforum_classes', $subforum_classes, $sub_forum->ID );

    to add a call to that function

    sorry that’s then best I can do

    Robin W
    Moderator

    not possible without additional code

    #208754
    Afreko Media
    Participant

    Hi again Robin,

    Trying my luck now as it’s no longer for the bbpress part of the page but I’m facing a similar issue with a post carousel I have.

    carousel

    I tried editing the css code you provided me but with no luck.

    Any suggestion?

    Thank you,
    Kev

    #208748
    Robin W
    Moderator

    basically bbpress has the ability to add columns via a filter

    This should do it

    add_filter("bbp_admin_replies_column_headers", 'rew_IP_column_add');
    add_filter("manage_reply_posts_custom_column", 'rew_IP_column_value', 10, 3);
    
    function rew_IP_column_add($columns)  {
    	$new = array();
      foreach($columns as $key => $title) {
        if ($key=='bbp_reply_forum') // Put the forum ID column before the Replies forum column
          $new['rew_id'] = 'IP Address';
        $new[$key] = $title;
      }
      return $new;
    }
    	
    function rew_IP_column_value($column_name, $id) {
    		if ($column_name == 'rew_id') echo get_post_meta( $id, '_bbp_author_ip', true );
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    #208742

    In reply to: Shortcode

    Matthias
    Participant

    Now I’m trying to hide the pagination of the output

    My startpage has the page ID 35
    I’m trying to use this css to hide the pagination only on the startpage
    .page-id-35, a.page-numbers, .page-numbers.current, .page-numbers.dots, .bbp-pagination-count {display:none!important;}

    The css works fine, but the addition .page-id-35 does not work
    Does anyone see an error?
    Thanks
    Matthias

    #208739

    In reply to: Shortcode

    Matthias
    Participant

    I found this code and can now show five popular entries on my frontpage 🙂
    // Top five of bbpress on startpage
    function rk_top_five_view() {
    bbp_register_view( ‘top-five’, __( ‘5 Most Popular Topics’ ), array(
    ‘meta_key’ => ‘_bbp_reply_count’,
    ‘posts_per_page’ => ‘5’ ,
    ‘ max_num_pages’ => ‘1’,
    ‘orderby’ => ‘meta_value_num’ ),
    false );
    }

    add_action( ‘bbp_register_views’, ‘rk_top_five_view’ );

    Thanks
    Matthias

    #208732
    thomei
    Participant

    @lflier
    Wow, this really solves the issue with Visual Editor content styling. Thank you very much!

    unction bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = array( 
                'content_css' => '/wp-content/themes/mytheme/css/tinymce-editor.css',
            );
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    How to add this to: https://codex.bbpress.org/enable-visual-editor/ ?

    #208679

    Topic: Shortcode

    Matthias
    Participant

    I’m using this shortcode on my site.
    [bbp-single-view id=’popular’]
    Is there a way to show only 5 popular threads instead of 10?
    I just tried the following code with no sucess 🙁
    [bbp-single-view id=’popular’ max='5']

    #208667
    Robin W
    Moderator

    not certain this will work, but put this in the custom css area of your theme

    #bbpress-forums ul li::before {
    content : none !important ;
    }
    #208657
    crzyhrse
    Participant

    Just to add the function @Robin W offers still works… I added span style to the text to tweak it…

    It also works this way for text after on the forum list page:

    add_action ('bbp_template_after_forums_index' , 'follow_up' ) ;
    
    Function follow_up () {
    Echo '<div class="entry-content"><span style="color: #666666;">Here is my followup text.</span></div>' ;
    }
    #208645
    Robin W
    Moderator

    just looked at the new code – try

    remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 40);
    remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 40); 
    #208643
    burhi
    Participant

    Hi,

    remove_filter( 'bbp_get_reply_content', 'bbp_make_clickable', 4);
    remove_filter( 'bbp_get_topic_content', 'bbp_make_clickable', 4); 

    not work bbpress 2.6.4

    is there any new code?

    #208617

    In reply to: HTML in text

    BrokenPixel
    Participant

    I’m never quite sure if I should add to a post that has the same problem, but is obviously unanswered for a long while, or post a new topic. But… our forum also has a very similar issue so it seems sensible to add it here.

    For us, it seems to be specific to text-align (left, right or centre) and for “non-admin” logged in users.

    It displays the html code as is, rather than using it to display the correct text alignment. All other html options in the visual editor we’ve tested so far seem to work – it’s just the text alignment that doesn’t. And only for non-admin users – the html works as it should if an admin user posts.

    <p style=”text-align: right;”>right align</p>

    Hoping for a solution? Am on current versions of bbpress, wordpress and bbp style pack and php version 7.3

    #208589
    Robin W
    Moderator

    so you couldput this in your functions file of your child theme, it takes out then new filter and puts back the old one

    remove_filter( 'bp_notifications_get_notifications_for_user', 'bbp_format_buddypress_notifications', 10, 8 );
    add_filter( 'bp_notifications_get_notifications_for_user', 'rew_format_buddypress_notifications', 10, 5 );
    
    function rew_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    
    	// New reply notifications
    	if ( 'bbp_new_reply' === $action ) {
    		$topic_id    = bbp_get_reply_topic_id( $item_id );
    		$topic_title = bbp_get_topic_title( $topic_id );
    		$topic_link  = wp_nonce_url( add_query_arg( array( 'action' => 'bbp_mark_read', 'topic_id' => $topic_id ), bbp_get_reply_url( $item_id ) ), 'bbp_mark_topic_' . $topic_id );
    		$title_attr  = __( 'Topic Replies', 'bbpress' );
    
    		if ( (int) $total_items > 1 ) {
    			$text   = sprintf( __( 'You have %d new replies', 'bbpress' ), (int) $total_items );
    			$filter = 'bbp_multiple_new_subscription_notification';
    		} else {
    			if ( !empty( $secondary_item_id ) ) {
    				$text = sprintf( __( 'You have %d new reply to %2$s from %3$s', 'bbpress' ), (int) $total_items, $topic_title, bp_core_get_user_displayname( $secondary_item_id ) );
    			} else {
    				$text = sprintf( __( 'You have %d new reply to %s',             'bbpress' ), (int) $total_items, $topic_title );
    			}
    			$filter = 'bbp_single_new_subscription_notification';
    		}
    
    		// WordPress Toolbar
    		if ( 'string' === $format ) {
    			$return = apply_filters( $filter, '<a href="' . esc_url( $topic_link ) . '" title="' . esc_attr( $title_attr ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $topic_link );
    
    		// Deprecated BuddyBar
    		} else {
    			$return = apply_filters( $filter, array(
    				'text' => $text,
    				'link' => $topic_link
    			), $topic_link, (int) $total_items, $text, $topic_title );
    		}
    
    		do_action( 'bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items );
    
    		return $return;
    	}
    }
Viewing 25 results - 3,101 through 3,125 (of 32,522 total)
Skip to toolbar