Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 11,426 through 11,450 (of 32,521 total)
  • Author
    Search Results
  • #148761
    Robin W
    Moderator

    bbpress has a separate set of capabilities, so you can set permissions for the wordpress part of your site totally separately to the capabilities for bbpress.

    see

    https://codex.bbpress.org/bbpress-user-roles-and-capabilities/

    and if needbe

    Custom Capabilities

    Robin W
    Moderator

    long answer I’m afraid and in two parts

    part 1 – setting the user permission to allow delete topic and delete reply

    delete is easy, making it only trash is in part 2 !

    Basically you’ll need to change a couple of capabilities of the participant role

    see

    https://codex.bbpress.org/bbpress-user-roles-and-capabilities/

    you see the abilities delete topics and delete replies (as distinct from delete others topics and delete others replies)

    Whilst you could amend the participant role, I haven’t documented that, so easiest is just for you to create a new role and give it the participant capabilities plus the ‘delete topics’ and ‘delete replies’. This article explains how

    Custom Capabilities

    add this code to your functions file – see

    Functions files and child themes – explained !

    part 2 – changing the function, so that delete is only shown for keymasters

    This code will only allow a keymaster to permanently delete a topic

    add the following to your functions file

    add_filter ('bbp_get_topic_trash_link', 'topic_dont_delete');
    add_filter ('bbp_get_reply_trash_link', 'reply_dont_delete');
    
    function topic_dont_delete( $args = '') {
    
    		// Parse arguments against default values
    		$r = bbp_parse_args( $args, array(
    			'id'           => 0,
    			'link_before'  => '',
    			'link_after'   => '',
    			'sep'          => ' | ',
    			'trash_text'   => esc_html__( 'Trash',   'bbpress' ),
    			'restore_text' => esc_html__( 'Restore', 'bbpress' ),
    			'delete_text'  => esc_html__( 'Delete',  'bbpress' )
    		), 'get_topic_trash_link' );
    
    		$actions = array();
    		$topic   = bbp_get_topic( bbp_get_topic_id( (int) $r['id'] ) );
    
    		if ( empty( $topic ) || !current_user_can( 'delete_topic', $topic->ID ) ) {
    			return;
    		}
    
    		if ( bbp_is_topic_trash( $topic->ID ) ) {
    			$actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'untrash', 'topic_id' => $topic->ID ) ), 'untrash-' . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-restore-link">' . $r['restore_text'] . '</a>';
    		} elseif ( EMPTY_TRASH_DAYS ) {
    			$actions['trash']   = '<a title="' . esc_attr__( 'Move this item to the Trash',      'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'trash',   'topic_id' => $topic->ID ) ), 'trash-'   . $topic->post_type . '_' . $topic->ID ) ) . '" class="bbp-topic-trash-link">'   . $r['trash_text']   . '</a>';
    		}
    		
    		if ( bbp_is_topic_trash( $topic->ID ) || !EMPTY_TRASH_DAYS ) {
    		if ( bbp_is_user_keymaster()) {
    		$actions['delete']  = '<a title="' . esc_attr__( 'Delete this item permanently',     'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_topic_trash', 'sub_action' => 'delete',  'topic_id' => $topic->ID ) ), 'delete-'  . $topic->post_type . '_' . $topic->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>';
    		}
    		}
    
    				// Process the admin links
    		$retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after'];
    
    		return $retval ;
    	}
    	
    	function reply_dont_delete( $args = '' ) {
    
    		// Parse arguments against default values
    		$r = bbp_parse_args( $args, array(
    			'id'           => 0,
    			'link_before'  => '',
    			'link_after'   => '',
    			'sep'          => ' | ',
    			'trash_text'   => esc_html__( 'Trash',   'bbpress' ),
    			'restore_text' => esc_html__( 'Restore', 'bbpress' ),
    			'delete_text'  => esc_html__( 'Delete',  'bbpress' )
    		), 'get_reply_trash_link' );
    
    		$actions = array();
    		$reply   = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) );
    
    		if ( empty( $reply ) || !current_user_can( 'delete_reply', $reply->ID ) ) {
    			return;
    		}
    
    		if ( bbp_is_reply_trash( $reply->ID ) ) {
    			$actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'untrash', 'reply_id' => $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-restore-link">' . $r['restore_text'] . '</a>';
    		} elseif ( EMPTY_TRASH_DAYS ) {
    			$actions['trash']   = '<a title="' . esc_attr__( 'Move this item to the Trash',      'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'trash',   'reply_id' => $reply->ID ) ), 'trash-'   . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-trash-link">'   . $r['trash_text']   . '</a>';
    		}
    
    		if ( bbp_is_reply_trash( $reply->ID ) || !EMPTY_TRASH_DAYS ) {
    		if ( bbp_is_user_keymaster()) {
    		$actions['delete']  = '<a title="' . esc_attr__( 'Delete this item permanently',     'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'delete',  'reply_id' => $reply->ID ) ), 'delete-'  . $reply->post_type . '_' . $reply->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-reply-delete-link">' . $r['delete_text'] . '</a>';
    		}
    		}
    
    		// Process the admin links
    		$retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after'];
    
    		return $retval ;
    	}
    

    I haven’t fully tested this code as my test site is in some disarray whilst I test something else, so you’ll need to check that it works

    #148736
    Robin W
    Moderator

    presume you removing the titles from

    wp-content/bbpress/templates/default/bbpress/loop-forums

    and renaming as per

    https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum-part-3/ section 3

    then

    wp-content/bbpress/templates/default/bbpress/loop-single-forum

    has the content that you’ll want to take out

    #148735
    sagive
    Participant

    i need to create a new top of user and want to give it “read=>true” capability only…

    example

    $cpar_capabilities = array(
        'read'	=> true
    )
    add_role('course_participant', 'Course Participant', $cpar_capabilities);

    would this mean he / she cant publish on the forums and if so how can i add the right capabilities so those user can participate in the forums but have read only permission
    or any type of other permissions on my site?

    #148727
    Stephen Edgar
    Keymaster

    Make a copy of your full width template, maybe page.php and rename it bbpress.php 🙂

    #148725
    Stephen Edgar
    Keymaster

    Yes, it should NOT go there, you should add it to your child themes functions.php file.

    Remove it from where you added it.

    See https://codex.wordpress.org/Child_Themes on creating a child theme.

    And this is where you add that code https://codex.wordpress.org/Child_Themes#Using_functions.php

    #148721
    Stephen Edgar
    Keymaster

    Thanks @lyhiz, indeed that plugin does add some a spoiler BBCode, thanks.

    #148719
    thecatholicwoman
    Participant

    Also I wanted to keep the update from no.2 but the new code changed the font color on the titles of the forums back to black but it did change the font. I am not sure if I was supposed ot change something.

    #148716
    Robin W
    Moderator

    hmmm.. ok but we’re starting to need lots of extra code

    ok so add

    #bbpress-forums a {
    color: #111111 !important ;
    }

    This will change the font throughout, and you can play with the colour.

    If you want the topic and date to be different, we’re getting into some real css styling, which is beyond the purpose of the bbpress support forum, and perhaps you need to start to look at how to use firebug so you can see what you need to change eg

    then you can style any forums part by preceding it with

    #bbpress-forums as I’ve done above.

    #148712
    Rescue Themes
    Participant

    Really old thread but sharing my solution in case it’s helpful for anyone else. I used:

    <?php single_post_title(); ?>

    Instead of:

    bbp_get_forum_title

    #148711
    Leonyipa
    Participant

    @netweb I tried but I cannot remove it, can you tell me which piece of code do I need to remove? Thanks 🙂

    #148708
    lyhiz
    Participant
    #148702
    Leonyipa
    Participant

    after putting the new code, it now says:

    Fatal error: Cannot redeclare ntwb_custom_topic_form_notice() (previously declared in /home/gleam/public_html/wp-content/plugins/bbpress/includes/core/functions.php:633) in /home/gleam/public_html/wp-content/plugins/bbpress/includes/core/functions.php on line 627

    I actually placed the code in bbpress/includes/core/functions.php
    is it wrong?

    #148695
    thecatholicwoman
    Participant

    I am not sure if this helps but when I select bbpress forum index template from the side menu for page templates it does not allow me to put in the side bar and runs full width but the text and coloring matches my theme. When I do it with the page builder in the divi theme and I use the [bbp-forum-index] short code in a text box element and then add a sidebar element on the side, I get the side bar but the forum does not match the theme because I have to use the default template. So it is almost like it is not pulling from the coding in the style.css at all so it may make sense that my altering that file does not change it.

    #148693
    Stephen Edgar
    Keymaster

    That’s weird, did you add it twice?
    Fatal error: Cannot redeclare ntwb_bbp_theme_before_topic_form_notices() (previously declared..

    It could be my hastily quick copy and paste job, here is the same thing with an alternate function name, make sure you remove the previos function. 😉

    
    function ntwb_custom_topic_form_notice() {
    	?>
    	<div class="bbp-template-notice">
    		<p>Something here...</p>
    		<p>Something else...</p>
    	</div>
    	<?php
    
    }
    add_action( 'bbp_theme_before_topic_form_notices', 'ntwb_custom_topic_form_notice' );
    
    #148690
    Stephen Edgar
    Keymaster

    Do it the same way you would for WordPress and use the bbPress custom post types, forum, topic, and reply.

    #148689
    Stephen Edgar
    Keymaster

    I don’t see anything wrong in either the code you added above or in your post you linked to.

    I see that long lines of solid text do not ‘wrap’ but this isn’t really a WordPress/bbPress issue, if you need to support code/content like that you should look at adding a plugin that will format this type of text for you.

    Maybe Crayon Syntax Highlighter….

    #148685
    noirdesign
    Participant

    hej,

    When someone enters example XML in an anser like:
    <Binary>0E02800001000000000000000B0004C003010000000000000000000000082D0000000000000000004EFF140000000000FFFFFFFF0600000058000000000000000000061208000010000000003C0000000000000000000000803A011480FAFFFF0000000000000000B09B741280FAFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Binary>

    There are no more line breaks and the sidebar seems to go over the content area.

    or within the code tag:

    <Binary>0E02800001000000000000000B0004C003010000000000000000000000082D0000000000000000004EFF140000000000FFFFFFFF0600000058000000000000000000061208000010000000003C0000000000000000000000803A011480FAFFFF0000000000000000B09B741280FAFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Binary>
    

    it alters somehow the html structure of the page.
    Can I somehow fix that?

    You can see the falty Topic and answer here:
    http://www.apw-wiegand.de/support-forum/topic/apw-und-windows-7/

    I’m using bbPress Version 2.5.4 on WordPress 3.9.1

    Thanks in advance,
    Eric

    #148670
    Leonyipa
    Participant

    Is there any Spoiler BBCode plugins available for BBPress?

    #148669
    Robin W
    Moderator

    for no. 1, add this code to your functions file

    //display last topic title in freshness for forums
    function display_title ($anchor, $forum_id, $time_since, $link_url, $title, $active_id ) {
    $anchor = '<ul><li><a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $title) . '</a></li></ul><a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>';
    return $anchor ;
    }
    add_filter ('bbp_get_forum_freshness_link', 'display_title', 10, 6 );

    Having coded it, I like the way it displays, and will be adding to the forums on one of the sites I support – one of the reasons I support this forum is that I learn and get ideas from others 🙂

    #148668
    Robin W
    Moderator
    #148667
    Robin W
    Moderator

    for no. 2

    add

    #bbpress-forums div.bbp-forum-title h3, #bbpress-forums div.bbp-topic-title h3, #bbpress-forums div.bbp-reply-title h3, #bbpress-forums a.bbp-forum-title, #bbpress-forums a.bbp-topic-permalink {
      color: #666 !important;
      font-size: 16px !important;
    }
    
    

    to your style.css

    #148665
    Leonyipa
    Participant

    where should I add the code to?

    #148664
    Stephen Edgar
    Keymaster

    This is one way…

    
    function ntwb_bbp_theme_before_topic_form_notices() {
    	?>
    	<div class="bbp-template-notice">
    		<p>Something here...</p>
    		<p>Something else...</p>
    	</div>
    	<?php
    
    }
    add_action( 'bbp_theme_before_topic_form_notices', 'ntwb_bbp_theme_before_topic_form_notices' );
    

    And another is to modify the form-topic.php template.

    #148663
    Stephen Edgar
    Keymaster

    Quickest way in your child theme remove the nickname form the form-user-edit.php template.

    https://codex.bbpress.org/theme-compatibility/

    Functions files and child themes – explained !

Viewing 25 results - 11,426 through 11,450 (of 32,521 total)
Skip to toolbar