Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 5,251 through 5,275 (of 32,505 total)
  • Author
    Search Results
  • #183650
    Chad R. Schulz
    Participant

    @yo35: It can be done. But, you’ll need to either mod the plugin or insert a custom function inside your child theme (while deactivating the plugin to avoid conflicts).

    the original plugin code is:

    function pw_bbp_shortcodes( $content, $reply_id ) {
    	
    	$reply_author = bbp_get_reply_author_id( $reply_id );
    
    	if( user_can( $reply_author, pw_bbp_parse_capability() ) )
    		return do_shortcode( $content );
    
    	return $content;
    }
    add_filter('bbp_get_reply_content', 'pw_bbp_shortcodes', 10, 2);
    add_filter('bbp_get_topic_content', 'pw_bbp_shortcodes', 10, 2);
    
    function pw_bbp_parse_capability() {
    	return apply_filters( 'pw_bbp_parse_shortcodes_cap', 'publish_forums' );
    }

    What needs to change is the section returning the do_shortcode( $content ) as follows:

    	if( user_can( $reply_author, pw_bbp_parse_capability() ) ) {
    		$content = shortcode_unautop( $content );
    		return do_shortcode( $content );
    	}

    This will remove the autop filter that adds <p></p> to the shortcode text.

    Good luck.

    #183647
    softgenic
    Participant

    Hi Guys,

    I am trying to show last 3 recent topics in this form: http://prntscr.com/f00irx . Can anyone please tell me what should be the wp query or PHP code to get title, topic url, author avatar image & time so I can easily get the information and then show it in the layout I created in the above screenshot for showing last 3 recent topics?

    Thanks

    #183642
    yo35
    Participant

    @Robin W: thanks for your answers. The “bbPress – Do Short Codes” plugin do the job.

    However, there is still a problem: bbPress seems to have a kind of postprocessing that adds several <p></p> tags within the post content, including the sections that result from shortcode processing. Is it possible to disable this behavior?

    #183632
    sally
    Participant

    Hello,

    i would like to hide topic / reply IDs, what appear on the right starting with # .., like its here in the bbpress forums…

    Is there a way, to hide the Ids only public, and only show them as admin?

    Is there a code snippet to accomplish this?

    Thx
    Regards
    Sally

    #183624

    Topic: TTFB problem

    in forum Troubleshooting
    newz12
    Participant

    We have issue with the time to first byte (TTFB) using the plugin BBPress. On the single topic page we get TTFB about 5-7 sec. After researching this issue we have found that the problem is in the file “content-single-topic.php” and the bottleneck is the function “bbp_has_replies()”.

    After researching this function we have found that the problem is in the code:

    wp-content/plugins/bbpress/includes/replies/template.php:184
    $bbp->reply_query = new WP_Query( $r );

    this row takes about 5-6 sec, so performing the query which retrieves the list of replies takes about 5-6 sec. Also we have dumped the query which is performed:

    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts FORCE INDEX (PRIMARY, post_parent) INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND (wp_posts.ID = 515125 OR wp_posts.post_parent = 515125) AND ( ( wp_postmeta.meta_key = ‘_bbp_forum_id’ AND CAST(wp_postmeta.meta_value AS SIGNED) NOT IN (‘515120′,’515123’) ) ) AND wp_posts.post_type IN (‘topic’, ‘reply’) AND ((wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘pending’ AND wp_posts.post_author = 0) OR wp_posts.post_status = ‘closed’ OR wp_posts.post_status = ‘hidden’) OR (wp_posts.post_author = 0 AND (wp_posts.post_status = ‘private’))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC LIMIT 56150, 25;

    You can check a test here:
    https://tools.pingdom.com/#!/NXIxm/https://www.bombingscience.com/forums/topic/tags-tags-tags/page/602/

    We are using Version 2.5.12

    Could you please check this issue and provide us solution in order to speed up this query?

    #183623
    dominikb
    Participant

    now i added this to functions.php:

    
    //code to add forum-roles
    
    function add_new_roles( $bbp_roles )
    {
        /* Add a role called tutor */
        $bbp_roles['bbp_mentor'] = array(
            'name' => 'Mentor',
            'capabilities' => custom_capabilities( 'bbp_mentor' )
            );
    
        /* Add a role called pupil */
        $bbp_roles['bbp_kursteilnehmer'] = array(
            'name' => 'Kursteilnehmer',
            'capabilities' => custom_capabilities( 'bbp_kursteilnehmer' )
            );
    
        return $bbp_roles;
    }
    
    add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
    
    function add_role_caps_filter( $caps, $role )
    {
        /* Only filter for roles we are interested in! */
        if( $role == 'bbp_mentor' )
            $caps = custom_capabilities( $role );
    
        if( $role == 'bbp_kursteilnehmer' )
            $caps = custom_capabilities( $role );
    
        return $caps;
    }
    
    add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
    
    function custom_capabilities( $role )
    {
        switch ( $role )
        {
    
            /* Capabilities for 'mentor' role */
            case 'bbp_mentor':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
                /* Capabilities for 'kursteilnehmer' role */
            case 'bbp_kursteilnehmer':
                return array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => true,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => true,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => true,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
                );
    
                break;
    
            default :
                return $role;
        }
    }
    

    it still does not work.

    Any hints, whats wrong here?

    #183622
    shlauncha
    Participant

    I feel as though I’m losing my mind. There’s an option to enable the full TinyCME editor correct?

    I’m looking at this: https://codex.bbpress.org/enable-visual-editor/

    But when I do that, all I’m seeing is this:

    I’ve tried the code in the codex on a base WordPress theme and all plugins disabled.

    Is it possible to enable a more robust editor?

    Thanks

    #183620
    floriancam
    Participant

    I dont know if I can answer my own question but I found a way to change this :

    function modify_breadcrumb_args() {
        $args['home_text'] = 'newname';
    
        return $args;
    }
    
    add_filter( 'bbp_before_get_breadcrumb_parse_args', 'modify_breadcrumb_args' );
    #183610
    lalit73545
    Participant

    Hi, is this possible we can display forum details like , suppose we have two forum, name called forum1 & forum2, Forum1 has 5 topics & forum2 has 10 topic. so is This possible on bbpress we can display first Forum1 then their associate topic 5 then later on forum2 then their associate topic 10. Please do the needful for me. Thanks i am waiting for your reply….

    #183605
    akira010203
    Participant

    Hello!

    I’ve added a new custom forum main page with some bb-codes instead of the default main page and I get a little disapointment, I can’t find out how to change the forums root page which redirect to mysite/forums instead of mysite/mynewmainforumpage.

    Is it possible to do it?

    Thanks!

    #183559

    In reply to: Hide links in posts

    virusek89
    Participant

    Is there anyone who can help me?

    I found this code but he does not want to work

    <?php
    function hide_links($post_content) {
     if ( in_category( array( 'YOUR CAT ID', 'YOUR CAT ID') )) {
    	global $wpdb;
    
    		return ($post_content = !is_user_logged_in()?preg_replace('/<a(.*?)>(.*?)<\/a>/m', '<div style="color:red;font-size:12px;"> YOUR TEXT</div>',$post_content):$post_content);
    	 }	
    
     }
      add_filter('the_content', 'hide_links')
    
    ?>
    #183546
    panda666uk
    Participant

    Are there any free tools/files/code out there to migrate a Kunena forum on a joomla site over to bbpress on a wordpress site ?

    Thanks

    #183543

    In reply to: content filter

    Col_Blimp
    Participant

    If you post a hyperlink using the link button then it matters not if it’s http or https as it’s just a reference on the page that does not download anything but if you use the img button then if your site is SSL and the image comes from a source that’s not then the certificate throws warnings.

    I don’t want to change all links to https as that overkill so I’m looking for the best way to just change links using the <img/> tag to https as using this does not work:

    <img src="i.imgur.com/V6sg3f0.png" alt="" />

    but does outside of WordPress ie in MYBB that is how you avoid certificate issues.

    #183541

    In reply to: content filter

    Col_Blimp
    Participant

    Hi Robin, you know images from my own site are all SSL so WordPress works in this instance but its with BBPress when the user makes a post and uses the insert image button to link an image from another site that the problems occour ie:



    <img src="https://i.imgur.com/V6sg3f0.png" alt="" />
    <img src="https://i.imgur.com/V6sg3f0.png" alt="" />
    <img src="i.imgur.com/V6sg3f0.png" alt="" />

    but this site here is changing the http to https in all links so the demonstration is a bit of a fail 🙂

    But a non https url will not break a certificate as that only happens if the link is embedding something in the post.

    #183539

    In reply to: content filter

    Robin W
    Moderator

    WordPress doesn’t seem to like it when you do that and wont show any image.

    wordpress will quite happily show images with no domain name just the directory & file

    eg

    change

    http://www.mysite.com/uploads/2017/march/pic.jpg  
    

    to

    /uploads/2017/march/pic.jpg

    #183524
    Pascal Casier
    Moderator

    Hi Steve,

    As Robin answered, you could look into his coding for the bbP Style Pack to see how it works.

    There is also https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#8-add-edit-profile-to-a-wordpress-menu that might give you a hint.

    Pascal.

    #183519
    KurzBaginski
    Participant

    The Code is available at https://github.com/georgemichaelis/bbpress-forced-subscription too.

    Regards
    Jörg

    #183518
    dominikb
    Participant

    @robin-w
    I moved the code to the functions.php file now, still no reaction.


    @casiepa

    Yes, i followed the procedure for adding new names with existing capabilities, but they are not appearing.
    Is it possible, that you cant add an existing capability to multiple roles?

    #183515
    Pascal Casier
    Moderator

    Hi @fabianno0572,

    The best way to put extra functions is in a functions.php in a child theme.

    Some is explained here: https://codex.bbpress.org/functions-files-and-child-themes-explained/

    #183513
    Pascal Casier
    Moderator

    Hi @sallyruchman,

    There is a standard widget for bbPress, you can find info here: https://codex.bbpress.org/features/widgets/

    You could also check this page https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#21-show-5-recent-topics-after-forum-index and e.g. topic 21 or so for different ideas.

    Pascal.

    #183511
    sally
    Participant

    Hello Pascal,

    Found the css code to adapt the image size.

    bbp-reply-content img {
    width:20%;
    }

    I dont use a plugin for this. Its just when people share images via links.

    Thx
    Sally

    #183508
    Pascal Casier
    Moderator

    @dominikb-1,

    Did you read till the end of the codex page ?

    Custom Capabilities

    #183507

    In reply to: No toolbar available

    Pascal Casier
    Moderator

    @adiek84,
    If you don’t know where to put the above code, you could also activate it in my ‘bbP Toolkit’ plugin. But if this is the only function you need, then copy the above in your child theme’s functions.php

    #183506

    In reply to: No toolbar available

    Robin W
    Moderator

    the code

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    in most themes should work fine. the wp-footer part was specific to the other poster.

    The code goes in your child theme’s functions file

    Functions files and child themes – explained !

    #183504
    Robin W
    Moderator

    sorry, I can’t write bespoke code for everyone, so it’s in the pack.

Viewing 25 results - 5,251 through 5,275 (of 32,505 total)
Skip to toolbar