Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 1,901 through 1,925 (of 32,481 total)
  • Author
    Search Results
  • #218370
    dogwomble
    Participant

    Hi there,
    I’m trying to work out what’s actually going on here.
    Whenever any person (including myself as keymaster) inserts a link, it is stripped from the post when it gets displayed. All othe formatting seems to make it through.
    I have added the following code to the theme’s functions.php to try and enable this functionality:

    add_action( 'bbp_kses_allowed_tags','pyg_kses_allowed_tags',999,1);
    function pyg_kses_allowed_tags($input){
            return array(
    
                            // paragraphs
                    'p' => array(
                            'style'     => array()
                    ),
                    'span' => array(
                            'style'     => array()
                    ),
    
                    // Links
                    'a' => array(
                            'href'     => array(),
                            'title'    => array(),
                            'rel'      => array()
                    ),
    
                    // Quotes
                    'blockquote'   => array(
                            'cite'     => array()
                    ),
    
                    // Code
                    'code'         => array(),
                    'pre'          => array(),
    
                    // Formatting
                    'em'           => array(),
                    'strong'       => array(),
                    'del'          => array(
                            'datetime' => true,
                    ),
    
                    // Lists
                    'ul'           => array(),
                    'ol'           => array(
                            'start'    => true,
                    ),
                    'li'           => array(),
    
                    // Images
                    'img'          => array(
                            'src'      => true,
    
                            'border'   => true,
                            'alt'      => true,
                            'height'   => true,
                            'width'    => true,
                    )
    
            );
    }

    I have tried to find other documentation to try and work out why this is occurring and have drawn a blank. Anybody have any other suggestions?

    #218361
    purityboy83
    Participant

    Hi

    I use wordpress + bbpress

    For example, i need to write a query statement(mysql) on a topic.
    ex)
    selectid,numberfrom tab

    When an grave accent is entered, the [code] tag is automatically inserted.

    ref img : https://ibb.co/9bhG177

    I want it to be typed exactly as you type it.
    So I want to disable the function for the code tag.

    I need your help and support

    Best Regards,
    Hyunho

    #218353
    Robin W
    Moderator

    put this in your custom css to remove the background

    .bbp-author-link {
    	background: none !important;
    }
    #218339
    Robin W
    Moderator

    @newest the issue relates to how gutenberg does an update – it uses AJAX rather than refresh the post, so the initial settings are not seen, and the post considers the update as a new publish.

    I’ll need to work on some code to fix

    #218307
    Robin W
    Moderator

    great, and yes please post the completed functioning code once you have got it working !!

    #218306
    athep
    Participant

    I set $forum_id = bbp_get_forum_id() ;

    and change these two

    if (!empty ($prev_id) && wp_get_post_parent_id($prev_id) == $forum_id) {

    and

    if (!empty ($next_id) && wp_get_post_parent_id($next_id) == $forum_id) {

    Notice the equal sign, that solved the problem!

    Thank you so much Robin!

    EDIT:

    The last topic links in every forum somehow get left behind, only the last ones.. I’ll tinker around and post my findings

    #218304
    Robin W
    Moderator

    hmmm…not sure about the ‘leak in’ bit, how are lines being displayed if $prev etc. is blank?

    you could add a check

    so set

    $forum_id = bbp_get_forum_id() ;

    above the while statement and then check at the appropriate point

    if (wp_get_post_parent_id($prev_id)  != $forum_id) {
    etc.
    }
    #218303
    athep
    Participant

    Thank you Robin,

    I tried this, I was inserting this in single-topic.php so I was not sure which one would work.

    $topic_id = bbp_get_topic_id() ; works well, the only issue is that once it nears the end, the other forums start leaking in, if prev or next is empty they leak in

    Otherwise it’s working as expected, also I fixed if ($cur == $topic_id) { to if ($cur_id == $topic_id) {

    #218302
    Robin W
    Moderator

    just had a quick look

    this should get you close, totally untested !!

    <?php $args = array( 'post_type' => 'topic', 'post_parent' => bbp_get_forum_id() ); 
    $loop = new WP_Query( $args );
    //get the current topic id or maybe depending in where you are putting this - bbp_get_reply_topic_id or bbp_get_reply_id()
    $topic_id = bbp_get_topic_id() ;
    while ( $loop->have_posts() ) : $loop->the_post(); 
    	$cur_id = get_the_ID();
    	if ($cur == $topic_id)  {
    		$prev = get_previous_post() ;
    		$prev_id = $prev->ID ;
    		$next = get_next_post();
    		$next_id = $next->ID ;
    	break ;
    	}
    endwhile;
    //so you now have $cur_id, $prev_id and $next_id
    //so create 3 lines
    if (!empty ($prev_id)) {
    	$permalink = get_permalink($prev_id) ;
    	$title = get_the_title ($prev_id) ;
    	echo '<a href="'.$permalink.'">'.$title.'</a>' ;
    }
    if (!empty ($cur_id)) {
    	$permalink = get_permalink($cur_id) ;
    	$title = get_the_title ($cur_id) ;
    	echo '<a href="'.$permalink.'">'.$title.'</a>' ;
    }
    if (!empty ($next_id)) {
    	$permalink = get_permalink($next_id) ;
    	$title = get_the_title ($next_id) ;
    	echo '<a href="'.$permalink.'">'.$title.'</a>' ;
    }
    ?>
    #218296
    Robin W
    Moderator

    solution is

    .single-forum .post-navigation .nav-links {
                   display: none !important;
    }
    
    .single-topic .post-navigation .nav-links {
    	display: none;
    }
    
    #218295
    pepdoca
    Participant

    Update Feb 11, 2021.
    Having looked at this more thoroughly it looks like what has happened is that most of my replies have been treated as separate topics by the importer. Having had a deeper look between the replies that were imported properly and those that ended up in separate topics, it is likely related to the fact that all of my replies had been submitted by a form. These replies were then manually moved into the appropriate thread, however because of this, there is no value in the replyto column of the posts table. I believe that the converter relies on this relationship to combine replies in the same topic as opposed to relying on the tid column.
    I am working my way through the converter code to see if I can identify the function that establishes this relationship with hopes of updating it to work. Alternatively I may have to manually update the post table in MyBB prior to import to establish this relationship.

    #218278
    athep
    Participant

    I made the list

    
    <?php $args = array( 'post_type' => 'topic', 'post_parent' => bbp_get_forum_id() ); $loop = new WP_Query( $args ); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
     <a href="<?php echo get_the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endwhile;?>
    

    This gives me all the topics under the current topic’s forum (I’m on single-topic.php)

    Is there a way I could limit the list to 5 links (that’s easy, post_per_page = 5) but on top of that only show the adjacent posts?

    
    Topic 3 link
    Topic 4 link
    Topic 5 link <----- I'm here
    Topic 6 link
    Topic 7 link
    

    In the above example, it’s showing me 2 previous adjacent posts and to next adjacent posts

    What happens is if I set post_per_page to 5 then this happens

    
    Topic 1 link
    Topic 2 link
    Topic 3 link 
    Topic 4 link
    Topic 5 link <----- I'm here
    

    The current link is always last, I realized this is more of a wordpress question but I’d like to try my luck here since I already opened a thread

    #218277
    Robin W
    Moderator

    there are filters for topics and replies

    bbpress 2.6.6\includes\topics\functions.php lines 389 and 705

    $redirect_url = apply_filters( 'bbp_new_topic_redirect_to', $redirect_url, $redirect_to, $topic_id );
    $topic_url = apply_filters( 'bbp_edit_topic_redirect_to', $topic_url, $view_all, $redirect_to );

    bbpress 2.6.6\includes\replies\functions.php lines 473 and 768

    $reply_url = apply_filters( 'bbp_new_reply_redirect_to', $reply_url, $redirect_to, $reply_id );
    $reply_url = apply_filters( 'bbp_edit_reply_redirect_to', $reply_url, $redirect_to );

    which Weglot can apply query args to

    #218268
    Robin W
    Moderator

    ok, hard to help without a link – a bit like trying to fix a car by email ๐Ÿ™‚

    try

    #bbpress .post-navigation {
    display : none !important ;
    }

    add this to your theme’s custom css

    #218266
    ikspem
    Participant

    Hi Robin,

    Forum is logged-in users only ๐Ÿ™

    Theme is Astra.

    Maybe the code is helpful?

    Code from the Forum-Next-Link:

    <nav class=”navigation post-navigation” role=”navigation” aria-label=”Messages”>
    <h2 class=”screen-reader-text”>Navigation</h2>
    <div class=”nav-links”><div class=”nav-next”>Next Forum<span class=”ast-right-arrow”>→</span></div></div>
    </nav> </main><!– #main –>

    Code from the Topic-Next-Link:

    <nav class=”navigation post-navigation” role=”navigation” aria-label=”Messages”>
    <h2 class=”screen-reader-text”>Navigation</h2>
    <div class=”nav-links”><div class=”nav-next”>” rel=”next”>Next Subject <span class=”ast-right-arrow”>→</span></div></div>
    </nav> </main><!– #main –>

    #218249
    flamuren
    Participant

    Oh my! Many thanks uksentinel! That worked for taking away the search bar above the forum and keeping the sidebar.

    Offtopic/sidenote: for every thing I do on my page I feel really proud of my self. Never knew I could even get a site up and running. Now I am doing code (however with extremely good guides from you guys ofc!) and I feel amazing ๐Ÿ™‚ Thank you for helping out!

    #218235
    pepdoca
    Participant

    WP Version 5.6.1 – BBpress Version 2.6.6 – Site is currently private and in development.
    I am trying to import a relatively small, private MyBB forum (200 Forums, 290 threads, 9000 posts, 50 users) however I keep running into an issue where the converter somehow gets a total count of 5703 threads which makes several duplicates of every thread. If it was a smaller circumstance I would just manually delete the duplicates however which such a huge number of duplicates I was hoping some skilled eyes might see or understand what has happened.
    I have a bit of a background in coding so have been trying to troubleshoot through the code to understand when it is reading the thread table why it would end up with exponentially more thread rows than actually exist. In review the thread table I have confirmed that there are only 290 rows so I am not sure what the converter code is doing to create this circumstance.
    I have read through the converter and converter class files, but can’t seem to pin point where in the Step Seven, Topic conversion that this error is being produced.

    If anyone can provide any assistance with experience with this, or pointing me in the direction of the files of code that I should be trying to troubleshoot to ensure I am in the right direction, that would be greatly appreciated!

    #218233
    Robin W
    Moderator

    this turns comments on in bbpress

    add_filter ('bbp_force_comment_status' , 'rew_set_comments_on') ;
    
    function rew_set_comments_on () {
    	return true ;
    }

    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

    #218228
    Longbow
    Participant

    I’m digging through php and can’t locate where the word “On” gets inserted.

    bbpress/includes/replies/template/php

    lines 660-680

    
    	function bbp_get_reply_post_date( $reply_id = 0, $humanize = false, $gmt = false ) {
    		$reply_id = bbp_get_reply_id( $reply_id );
    
    		// 4 days, 4 hours ago
    		if ( ! empty( $humanize ) ) {
    			$gmt_s  = ! empty( $gmt ) ? 'G' : 'U';
    			$date   = get_post_time( $gmt_s, $gmt, $reply_id );
    			$time   = false; // For filter below
    			$result = bbp_get_time_since( $date );
    
    		// August 4, 2012 at 2:37 pm
    		} else {
    			$date   = get_post_time( get_option( 'date_format' ), $gmt, $reply_id, true );
    			$time   = get_post_time( get_option( 'time_format' ), $gmt, $reply_id, true );
    			$result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time );
    		}
    
    		// Filter & return
    		return apply_filters( 'bbp_get_reply_post_date', $result, $reply_id, $humanize, $gmt, $date, $time );
    	}
    
    #218204
    athep
    Participant

    comment_status is closed in these pages, wish I knew of a way to enable them.

    I got this from stackoverflow

    
    function set_post_comment_status( $post_id, $status = 'open' ){
        global $wpdb;
        $wpdb->update( $wpdb->prefix . 'posts', [ 'comment_status' => $status ], [ 'ID' => $post_id ] );
    }
    

    and tried passing the topic id, it didn’t work

    #218190

    In reply to: Random Topic Link

    purityboy83
    Participant

    Someone may need it, so I’ll update it.

    function hhj_bbp_random_topic() {
    global $post;
    $args = array('post_type' => 'topic','orderby' => 'rand','post_status'=>'publish','posts_per_page' => '10');
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :  setup_postdata($post); ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
    <?php
    endforeach;
    wp_reset_postdata();
    }
    add_shortcode('hhj_bbp_random_topic', 'hhj_bbp_random_topic');

    ref.
    https://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts

    #218188
    Chuckie
    Participant

    Hi. This is not a CSS bit of code. it is for your functions PHP file.

    #218187
    cranney
    Participant

    @ajtruckle
    I am having the same issue with participants not able to add images without moderation.
    How can I add the remove moderation code to my theme’s additional css?
    This line brings up an error
    add_filter( ‘bbp_bypass_check_for_moderation’, ‘__return_true’ );

    #218186
    Robin W
    Moderator

    ok, still not sure why you want the ability for someone to comment on a forum page, or more strangely in a topic page??

    but try setting up a page with the the same permalink as your forums root, and then put the shortcode

    [bbp-forum-index]

    in it

    then set that page to have comments

    it might work, it might not !

    #218178
    Robin W
    Moderator

    bbp style pack has buttons for subscribe

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>buttons

    you can crack the code in includes/functions around line 336 if you want to look at code

Viewing 25 results - 1,901 through 1,925 (of 32,481 total)
Skip to toolbar