Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 801 through 825 (of 32,295 total)
  • Author
    Search Results
  • #232413
    Robin W
    Moderator

    from this article

    https://www.tiny.cloud/docs/plugins/opensource/paste/

    try this, otherwise I don’t have a further solution

    //clean html when copy and paste into forum
    function bbp_tinymce_paste_plain_text( $plugins = array() ) {
        $plugins[] = 'paste';
    $paste_word_valid_elements[] = 'b,strong';
        return $plugins;
    
    }
    add_filter( ‘bbp_get_tiny_mce_plugins’, ‘bbp_tinymce_paste_plain_text’ );
    #232412
    rinh
    Participant

    Hi!
    When our users copy emails into the forum all the HTML table code shows up in the published post (it’s fine in the editor itself though). I found this filter which I suppose cleans out all HTML when copying

    //clean html when copy and paste into forum
    function bbp_tinymce_paste_plain_text( $plugins = array() ) {
        $plugins[] = 'paste';
        return $plugins;
    
    }
    add_filter( ‘bbp_get_tiny_mce_plugins’, ‘bbp_tinymce_paste_plain_text’ );

    I’m wondering if there’s a filter that would still allow bold to remain, but remove everything else?
    Thank you in advance!

    #232411
    jonearthur123
    Participant

    You can use the Yoast plugin to display breadcrumb!

    wp-dashboard –> Yoast –> search appearance –> breadcrumbs and then aticate it.

    later on you will have to add a code to header.php

    #232381
    Robin W
    Moderator

    @codejp3 thanks for all your efforts on this, much appreciated.

    I have now incorportated your code into my plugin.

    Great work 🙂

    #232357
    Tom Ingalls
    Participant

    I’m been exploring different view shortcodes but I can’t make it seems to work.

    I wanted to display both latest topics and most popular topics at the same time in the home page.

    I use [bbp-display-topic-index show=’5′ forum =’10,11,12′] or [bbp-single-view id=’popular’] and [bbp-single-view] but only one view is showing up.

    #232346

    In reply to: Forum Page Title

    Robin W
    Moderator

    took me a few minutes to work it out !!

    Try

    .post-type-archive-forum p {
    	display: none ;
    }
    veteranhdesigns
    Participant

    Thanks for the response I have read through the Codex. I knew i wasn’t being very clear lol.

    I created a Board Admin Role in Memberpress and assigned the roles needed for wordpress permissions i wanted the role to have.

    The problem is, I can clone Keymaster, which is a bbPress Role, but it doesn’t show up in Forum Roles dropdown, I can give forum permissions, but by giving edit user she can edit site admin, if i restrict edit user, she can’t manage users.

    I am looking for a way to restrict access to upper-level site admin, while having certain admin, yet needs Full admin rights in Forum, but not the ability to accidentally delete or change higher admin roles and create or manage lower level bbPress forum roles.

    Basically, I Need a MODERATOR Role with adjusted Admin Privileges and forum roles that can still perform role functions based on their level rather than just on or off, weighted capabilities with if statements that disables edit links or delete links unless the weighted role is below the administrator that is performing the tasks.

    This needs to be something that each role has the same ability to adjust for each role, like you would have in tech support with tech support roles but 3 tiers of tech support levels vs customer service vs billing department. Customer Service and billing have access to user profile to view, however billing can only see user address and phone number and payment information, customer service can only see name, phone, email, previous tickets, plan type and tier 3 tech support can see everything that customer service can see plus ipaddress, database, files where tier 2 can see tier 3 level plus has the ability to backup or reboot, where tier 1 can see and do everything… except travel agency type stuff with boards.

    Robin W
    Moderator

    bbpress has roles of keymaster, moderator, participant, spectator and blocked – see

    bbPress User Roles and Capabilities

    The rest of the above is either roles that you have created or come with memberpress, or roles that don’t exist but that you want – it’s not quite clear which 🙂 – please come back with further info.

    so is a ‘secondary keymaster’ a concept you want, or something that you have created or exists in memberpress???

    If you want to create a new memberpress role then the capabilities in the link above might help.

    #232299

    In reply to: Remove Separator

    Robin W
    Moderator

    it’s a lot of code to learn.

    There are hundreds of filters and actions.

    most of it is detective work.

    I have bbpress in a folder on my laptop/

    I use

    https://notepad-plus-plus.org/

    as my main tool, it understands all the file types and displays them in a very readable way.

    It has a ‘search on files’, so in your case I looked for ‘subscribe’ as this was the word that had the | before it.

    that got me to the subscribe link function, which has the ' | ' in it, which got me to the filter

    When you came back with it changing when you click, I then searched for ' | ' and found it in the core function.

    For the ‘before_xx_parse_args’ and other filter stuff see

    Step by step guide to setting up a bbPress forum – part 5

    #232294
    mehdinjm
    Participant

    Hello. I want to add a special feature to my site using the ajax load more plugin. I want to load topic replies with ajax by scrolling. I don’t want the visitor to have to go to pages 2, 3 and… to see all the replies. This plugin gives me a shortcode like this:

    
     [ajax_load_more loading_style="infinite fading-blocks" container_type="ul" post_type="reply"] 

    And I have to embed this short code in the function file of the template.

    <?php echo do_shortcode('[ajax_load_more loading_style="infinite fading-blocks" container_type="ul" post_type="reply"]'); ?>

    But this code does not work properly anywhere. Can you guide me? By the way, I am an amateur.

    #232290

    In reply to: Remove Separator

    Robin W
    Moderator

    ah, found the function that the ajax call is doing.

    this code works on my test site

    function remove_sep ($args) {
    $args['before'] = '&nbsp;&nbsp;' ;
    return $args ;
    }
    
    add_filter ('bbp_before_get_topic_subscribe_link_parse_args', 'remove_sep') ;
    
    remove_action( 'bbp_ajax_subscription', array( 'BBP_Default', 'ajax_subscription' ) );
    
    add_action ( 'bbp_ajax_subscription', 'new_ajax_subscription');
    
    function new_ajax_subscription() {
    
    		// Bail if subscriptions are not active
    		if ( ! bbp_is_subscriptions_active() ) {
    			bbp_ajax_response( false, esc_html__( 'Subscriptions are no longer active.', 'bbpress' ), 300 );
    		}
    
    		// Bail if user is not logged in
    		if ( ! is_user_logged_in() ) {
    			bbp_ajax_response( false, esc_html__( 'Please login to subscribe.', 'bbpress' ), 301 );
    		}
    
    		// Get user and topic data
    		$user_id = bbp_get_current_user_id();
    		$id      = ! empty( $_POST['id']   ) ? intval( $_POST['id'] )         : 0;
    		$type    = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'post';
    
    		// Bail if user cannot add favorites for this user
    		if ( ! current_user_can( 'edit_user', $user_id ) ) {
    			bbp_ajax_response( false, esc_html__( 'You do not have permission to do this.', 'bbpress' ), 302 );
    		}
    
    		// Get the object
    		if ( 'post' === $type ) {
    			$object = get_post( $id );
    		}
    
    		// Bail if topic cannot be found
    		if ( empty( $object ) ) {
    			bbp_ajax_response( false, esc_html__( 'Subscription failed.', 'bbpress' ), 303 );
    		}
    
    		// Bail if user did not take this action
    		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'toggle-subscription_' . $object->ID ) ) {
    			bbp_ajax_response( false, esc_html__( 'Are you sure you meant to do that?', 'bbpress' ), 304 );
    		}
    
    		// Take action
    		$status = bbp_is_user_subscribed( $user_id, $object->ID )
    			? bbp_remove_user_subscription( $user_id, $object->ID )
    			:    bbp_add_user_subscription( $user_id, $object->ID );
    
    		// Bail if action failed
    		if ( empty( $status ) ) {
    			bbp_ajax_response( false, esc_html__( 'The request was unsuccessful. Please try again.', 'bbpress' ), 305 );
    		}
    
    		// Put subscription attributes in convenient array
    		$attrs = array(
    			'object_id'   => $object->ID,
    			'object_type' => $type,
    			'user_id'     => $user_id
    		);
    
    		// Add separator to topic if favorites is active
    		if ( ( 'post' === $type ) && ( bbp_get_topic_post_type() === get_post_type( $object ) ) && bbp_is_favorites_active() ) {
    			$attrs['before'] = '&nbsp;&nbsp;';
    		}
    
    		// Action succeeded
    		bbp_ajax_response( true, bbp_get_user_subscribe_link( $attrs, $user_id, false ), 200 );
    }
    Nowarah
    Participant

    Hello, I use bbpress login form shortcode and when I press the login button without filing any data, it keeps redirect me to the normal wp form with errors msgs, is there a way to keep the errors msg in the same form without redirect?

    #232283
    Nowarah
    Participant

    hello, I need to change the css class”bbp-template-notice” of the returned html in the function bbp_template_notices() exist in includes/common/template.php but i dont see any filter in it , how this can be done?

    the function:

    function bbp_template_notices() {
    
    	// Bail if no notices or errors
    	if ( ! bbp_has_errors() ) {
    		return;
    	}
    
    	// Define local variable(s)
    	$errors = $messages = array();
    
    	// Get bbPress
    	$bbp = bbpress();
    
    	// Loop through notices
    	foreach ( $bbp->errors->get_error_codes() as $code ) {
    
    		// Get notice severity
    		$severity = $bbp->errors->get_error_data( $code );
    
    		// Loop through notices and separate errors from messages
    		foreach ( $bbp->errors->get_error_messages( $code ) as $error ) {
    			if ( 'message' === $severity ) {
    				$messages[] = $error;
    			} else {
    				$errors[]   = $error;
    			}
    		}
    	}
    
    	// Display errors first...
    	if ( ! empty( $errors ) ) : ?>
    
    		<div class="bbp-template-notice error" role="alert" tabindex="-1">
    			<ul>
    				<li><?php echo implode( "</li>\n<li>", $errors ); ?></li>
    			</ul>
    		</div>
    
    	<?php endif;
    
    	// ...and messages last
    	if ( ! empty( $messages ) ) : ?>
    
    		<div class="bbp-template-notice">
    			<ul>
    				<li><?php echo implode( "</li>\n<li>", $messages ); ?></li>
    			</ul>
    		</div>
    
    	<?php endif;
    }
    #232281
    Robin W
    Moderator
    add_filter ('bbp_get_topic_class', 'rew_author_current' , 100 , 3) ;
    add_filter ('bbp_get_reply_class', 'rew_author_current' , 100 , 3) ;
    
    function rew_author_current ($post_classes, $topic_id, $classes) {
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$current_id = get_current_user_id() ;
    	if ($author_id == $current_id) {
    		$post_classes[] = 'rew-current-user' ;
    		$post_classes = array_merge( (array) $post_classes);
    	}
    return $post_classes ;
    }

    will give you ‘rew-current-user’ as a style to add css

    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

    #232280

    In reply to: Remove Separator

    Robin W
    Moderator
    function remove_sep ($args) {
    $args['before'] = '&nbsp;' ;
    return $args ;
    }
    
    add_filter ('bbp_before_get_topic_subscribe_link_parse_args', 'remove_sep') ;

    &nbsp; is the code for space, so if you want 2 spaces put

    $args['before'] = '&nbsp;&nbsp;' ;

    #232279

    In reply to: Remove Separator

    Gomle
    Participant

    Very, very old topic – but still relevant today. This topic is searchable in google, so I’m not creating another one 😉

    The above code does unfortunately not work anymore.

    Do you have an updated code for removing the pipepline between favorite | subscribe ?

    And if you don’t – how do you actually find what to use. I’m trying to learn, but I don’t know what to look for..

    #232276
    Robin W
    Moderator

    ok, let’s just redo the whole thing

    function custom_callback( $args=array()) {
    
            // Parse arguments against default values
            $r = bbp_parse_args( $args, array(
                'select_id'    => 'bbp_topic_status',
                'select_class' => 'my-class',
                'tab'          => false,
                'topic_id'     => 0,
                'selected'     => false
            ), 'topic_open_close_select' );
    
            // Filter & return
            return apply_filters( 'custom_callback', ob_get_clean(), $r, $args );
        }
    	
    
    add_filter( 'bbp_get_form_topic_status_dropdown', 'custom_callback');
    #232274
    Robin W
    Moderator

    the ‘,2’ might be the issue, as you only then use 1, but try this

    function custom_callback($args) {
        
            $args['select_class'] = 'my-class' ;
                
           return  $args;
    
    }
    add_filter( 'bbp_get_form_topic_status_dropdown', 'custom_callback');
    #232273
    Nowarah
    Participant

    I need to add a class to the dropdown topic select_class.
    the original function is:

    function bbp_get_form_topic_status_dropdown( $args = array() ) {
    
            // Parse arguments against default values
            $r = bbp_parse_args( $args, array(
                'select_id'    => 'bbp_topic_status',
                'select_class' => 'bbp_dropdown',
                'tab'          => false,
                'topic_id'     => 0,
                'selected'     => false
            ), 'topic_open_close_select' );
    
            // Filter & return
            return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r, $args );
        }

    I tired to use this but didnt work

    function custom_callback($args = array() ) {
        
            $r = bbp_parse_args( $args, array(
                
                'select_class' => 'my-class',
                
            ) );
            
            return  $r;
    
    }
    add_filter( 'bbp_get_form_topic_status_dropdown', 'custom_callback', 12, 2);
    #232269
    Robin W
    Moderator

    ok, my code does not change any roles, the user will still get the participant role.

    The plugin makes them a member of a group, and as the forum is also a member of that group, they can them see the forum. The forum’s topic permissions then let them see only their topic

    #232263
    youishih
    Participant

    Hello, I use the code above with Snippets plugin, but it doesn’t work now. 🙁

    Here is my recored video: https://www.loom.com/share/774ad802d9884113b22982c502519b17

    Do you know how to fix it?

    #232262
    youishih
    Participant

    This is my first time to create a plugin by myself. I use this tutorial to create the plugin. Then, copy the code mentioned above, and it works perfectly. Thank you!

    #232257
    codejp3
    Participant

    @robin-w or another mod – can you please delete:
    https://bbpress.org/forums/topic/template-in-block-themes/#post-232249 (#post-232249)
    https://bbpress.org/forums/topic/template-in-block-themes/#post-232250 (#post-232250)
    https://bbpress.org/forums/topic/template-in-block-themes/#post-232256 (#post-232256)
    They had issues and take up a lot of wasted space.

    Seriously done this time! No more changes/revisions! It is what it is!

    Posting a much cleaner revision of the code above.

    • This one will work with either the BBPress Style Pack plugin template (looks great!) or the default BBPress template (looks horrible!).
    • It will optionally include the required ‘template-canvas.php’ only if it’s missing.
    • It will also only affect BBPress pages, not the rest of the site.
    • It will also only affect FSE Block themes.
    • If using default BBPress templates, it includes checks for if on forum root index page and loads extras/archive-forum.php (to prevent double-listing of the forum index), and loads extras/page-front-forums.php for “the rest of bbpress” (to prevent “nothing found” errors)
    
    // function to include the wp-includes/template-canvas.php file if needed
    function fse_bbpress_template( $template ) {
    	
    	if ( is_bbpress() ) {
    	
    		$template = ABSPATH . WPINC . '/template-canvas.php';
    		
    	}
    	
    	return $template;
    	
    }
    
    // function to include the bbpress forum template file if needed
    function fse_bbp_theme_compat( $template ) {
    
    	if ( is_bbpress() ) {
    
    		// BBPress Style Pack Plugin Forums Index Template
    		if ( defined( 'BSP_PLUGIN_DIR' ) ) {
    
    			$template = BSP_PLUGIN_DIR . '/templates/bbpress.php';
    
    		} else {
    
    			// Default BBPress
    			// if current page is bbpress forum root page, load archive-forum to prevent double-listing of index
    			if ( isset( get_queried_object()->name ) ) {
    				if ( get_queried_object()->name == 'forum' ) {
    
    					$template = WP_CONTENT_DIR . '/plugins/bbpress/templates/default/extras/archive-forum.php';
    
    				}
    
    			// else, load page-front-forums or the rest of bbpress is broken with empty pages
    			} else {
    
    				$template = WP_CONTENT_DIR . '/plugins/bbpress/templates/default/extras/page-front-forums.php';
    
    			}
    			
    		}
    		
    	}
    	
    	return $template;
    
    }
    
    // main function for handling which theme file needs to be included
    if ( ! function_exists( 'fse_bbpress_support' ) ) {
    	function fse_bbpress_support() {
    		
    		// get current theme dir
    		$theme_dir = get_template_directory();
    
    		/* 
    		* Detect if FSE theme or traditional.
    		* FSE Block themes require a theme.json file.
    		* Use that to check instead of theme name or parent theme name.
    		* Perhaps a better method is available, but this works for now
    		*/ 		
    		if ( file_exists( $theme_dir . '/theme.json' ) ) {
    
    			// include wp-includes/template-canvas.php only if needed
    			if ( !basename( get_page_template() ) == 'template-canvas.php' ) {
    
    				add_filter( 'template_include', 'fse_bbpress_template' );
    
    			}
    
    			// include either the BSP template, or default BBPress template
    			add_filter ( 'bbp_template_include_theme_compat', 'fse_bbp_theme_compat' );
    
    		}
    	
    	}
    }
    add_action( 'after_setup_theme', 'fse_bbpress_support' );
    

    One issue with EVERY default BBPress template is that the header/footer/sidebar are trying to be pulled from template files that don’t exist in block themes. They’re being included, but don’t look right. I’m not sure of the best solution for that, other than to use the BBPress Style Pack Plugin which takes care of that and looks great.

    #232235
    Robin W
    Moderator

    ‘Associated Courses and Groups’ has nothing to do with bbpress.

    I’d suspect it is either something in learndash, or something you have called a page in WP where the shiortcode is held, or a name you have given to something.

Viewing 25 results - 801 through 825 (of 32,295 total)
Skip to toolbar