Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,776 through 2,800 (of 32,492 total)
  • Author
    Search Results
  • #211278
    Robin W
    Moderator

    the bbpress theme that this site uses is here

    https://meta.trac.wordpress.org/browser/sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base

    the following file holds the code

    https://meta.trac.wordpress.org/browser/sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/header-subnav.php

    but you will also need to pull through some css from the theme, and JavaScript to do the drop downs

    then tie all this back to the right place in your theme.

    It’s quite doable, but well beyond free help

    #211269
    failxontour
    Participant

    Hey so I’m trying to enqueue custom CSS for bbPress v2.6.4 on the WP 5.4.1 clan website running a WP Twenty Twenty-child theme.

    This is what my functions.php currently looks like

    <?php
    /**
    * Child theme stylesheet einbinden in Abhängigkeit vom Original-Stylesheet
    */
    add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
    function child_theme_styles() {
      wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
      wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/style.css' , array('parent-style'));
      wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/css/bbpress.css', array());
    }
    ?>
    

    And this is how my bbpress.css looks like.

    
    #bbp-forum-info,
    #bbp-forum-topic-count,
    #bbp-forum-reply-count,
    #bbp-forum-freshness {
      color: #232323;
    }
    #bbpress-forums {
      background: transparent;
      clear: both;
      margin-bottom: 20px;
      overflow: hidden;
      font-size: 1.75rem;
      color: #232323;
    }
    

    The changes I applied in the bbpress.css won’t update the bbpress CSS on the above mentioned site. So their must be something wrong with my functions.php but I can’t yet put my finger on it how to load it properly as I’m pretty new when it comes to WordPress. I wanna append these changes globally to all parts of bbPress forum.

    Can someone tell me to if and what i need to specify inside the arrray() call for the bbpress.css to load properly? Or hint me towards what’s wrong here.

    Robin W
    Moderator

    meta boxes are used in the backend, but you are most of the way there.

    so to add the dropdown you can use

    add_action(‘bbp_theme_before_reply_content’, ‘so_additional_content’);

    (there is a bbp_theme_after_reply_content action as well)

    and then in the function put the drop down stuff – I’ve not checked your code, so you’ll need to tidy and correct the following if it doesn’t work

    so

    function so_additional_content () {
    ?>
    <label>Choose the size of the element : </label>
    <select name=”custom_element_grid_class” id=”custom_element_grid_class”>
    <option value=”normal” <?php selected( $meta_element_class, ‘normal’ ); ?>>normal</option>
    <option value=”square” <?php selected( $meta_element_class, ‘square’ ); ?>>square</option>
    <option value=”wide” <?php selected( $meta_element_class, ‘wide’ ); ?>>wide</option>
    <option value=”tall” <?php selected( $meta_element_class, ‘tall’ ); ?>>tall</option>
    </select>
    <?php 
    }

    Then when the user presses submit a function in bbpress called ‘new reply handler’ takes over.

    that has a hook

    do_action( ‘bbp_new_reply_post_extras’, $reply_id );

    which you can link to, to do the save.

    so you would have

    add_action ( 'bbp_new_reply_post_extras' , 'so_save' ) ;
    
    function so-save ($reply_id) {
    $meta_element_class = $_POST[‘custom_element_grid_class’];
    update_post_meta($reply_id, ‘custom_element_grid_class_meta_box’, $meta_element_class);
    }

    again your code is not checked.

    you will need to add functionality if you want users to edit their replies and change the dropdown selection

    I’ll let you play with the above, and do come back with a first version if you need extra help.

    If you fix it, then PLEASE post your solution here to help others

    g28f99
    Participant

    I hope to customize bbpress reply form area with dropdown selection list. I could not find any previous post reporting similar case in bbpress. Referring to post “Save meta box data from selected dropdown list” with link I prepared similar code for the bbpress reply post condition, but failed to achieve the goal.
    Please kindly provide suggestions!

    ` add_action( ‘bbp_theme_before_reply_form_content’, ‘so_custom_meta_box’ );
    //add_action( ‘add_meta_boxes’, ‘so_custom_meta_box’ );

    function so_custom_meta_box($post){
    add_meta_box(‘so_meta_box’, ‘Custom Box’, ‘custom_element_grid_class_meta_box’, $post->post_type, ‘normal’ , ‘high’);
    }

    add_action(‘bbp_theme_before_reply_content’, ‘so_save_metabox’);

    function so_save_metabox(){
    global $post;
    if(isset($_POST[“custom_element_grid_class”])){
    //UPDATE:
    $meta_element_class = $_POST[‘custom_element_grid_class’];
    //END OF UPDATE

    update_post_meta($reply_id, ‘custom_element_grid_class_meta_box’, $meta_element_class);
    //print_r($_POST);
    }
    }
    function custom_element_grid_class_meta_box($post){
    $reply_id = bbp_get_reply_id();
    $meta_element_class = get_post_meta($reply_id, ‘custom_element_grid_class_meta_box’, true); //true ensures you get just one value instead of an array
    ?>
    <label>Choose the size of the element : </label>

    <select name=”custom_element_grid_class” id=”custom_element_grid_class”>
    <option value=”normal” <?php selected( $meta_element_class, ‘normal’ ); ?>>normal</option>
    <option value=”square” <?php selected( $meta_element_class, ‘square’ ); ?>>square</option>
    <option value=”wide” <?php selected( $meta_element_class, ‘wide’ ); ?>>wide</option>
    <option value=”tall” <?php selected( $meta_element_class, ‘tall’ ); ?>>tall</option>
    </select>
    <?php
    }

    #211250
    Robin W
    Moderator

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

    Code Snippets

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'old text' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    and change the old text and new text to suit.

    Robin W
    Moderator

    ok, let’s try adding this

    add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
    function my_bbp_verify_nonce_request_url( $requested_url )
    {
        return 'http://localhost:8888' . $_SERVER['REQUEST_URI'];
    }

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

    Code Snippets

    #211225

    In reply to: Adding roles

    Robin W
    Moderator

    https://codex.bbpress.org/custom-capabilities/ is a better way, as updates to bbpress don’t overwrite, but as long as you know that bbpress updates will need you to go back into those files.

    #211222
    thomasprice61
    Participant

    I also followed this: https://codex.bbpress.org/getting-started/installing-bbpress/deleting-bbpress/
    and get the same fatal error:

    Fatal error: Uncaught Error: Cannot unset string offsets
    in /hsphere/local/home/audax/dev1.audax.org.au/wp-includes/class-wp-role.php on line 75

    Call stack:

    WP_Role::remove_cap()
    wp-content/plugins/bbpress/includes/core/capabilities.php:240
    bbp_remove_caps()
    wp-content/plugins/bbpress/includes/admin/tools/reset.php:262
    bbp_admin_reset_database()
    wp-content/plugins/bbpress/includes/admin/tools/reset.php:100
    bbp_admin_reset_handler()
    wp-includes/class-wp-hook.php:287
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:311
    WP_Hook::do_action()
    wp-includes/plugin.php:478
    do_action()
    wp-admin/admin.php:232
    require_once()
    wp-admin/tools.php:40

    #211220

    In reply to: Adding roles

    zirow
    Participant

    I’ve added this reply like 3times and everytime i edit it it disappeared and when i try to re-paste it and submit i cant cuz i get a warning for duplication 😛

    I’m pretty sure theirs a better way of doing it but that’s how I did since its the only way I could figure it out

    Open Capabilities.php

    Under “function bbp_get_caps_for_role”
    Add this case along with the other cases

    case bbp_get_tutor_role() :
    $caps = array(

    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,

    // Forum caps
    ‘read_private_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,

    // Topic tag caps
    ‘assign_topic_tags’ => true,
    );

    Under:

    function bbp_get_participant_role() {

    // Filter & return
    return apply_filters( ‘bbp_get_participant_role’, ‘bbp_participant’ );
    }

    Add:

    function bbp_get_tutor_role() {

    // Filter & return
    return apply_filters( ‘bbp_get_tutor_role’, ‘bbp_tutor’ );
    }

    Save and close Capabilities.php and open bbpress.php in the plugin directory not the one inside the theme.

    Search for:
    public function roles_init() {

    You will see this code:

    $keymaster = bbp_get_keymaster_role();
    $moderator = bbp_get_moderator_role();
    $participant = bbp_get_participant_role();
    $spectator = bbp_get_spectator_role();
    $blocked = bbp_get_blocked_role();

    // Build the roles into one useful array
    $this->roles[ $keymaster ] = new WP_Role( ‘Keymaster’, bbp_get_caps_for_role( $keymaster ) );

    $this->roles[ $moderator ] = new WP_Role( ‘Moderator’, bbp_get_caps_for_role( $moderator ) );
    $this->roles[ $participant ] = new WP_Role( ‘Participant’, bbp_get_caps_for_role( $participant ) );
    $this->roles[ $spectator ] = new WP_Role( ‘Spectator’, bbp_get_caps_for_role( $spectator ) );
    $this->roles[ $blocked ] = new WP_Role( ‘Blocked’, bbp_get_caps_for_role( $blocked ) );
    }

    So you just want to add these two codes in their:

    $tutor = bbp_get_tutor_role();

    $this->roles[ $tutor ] = new WP_Role( ‘tutor’, bbp_get_caps_for_role( $tutor ) );

    If u want to rename an existing role u added or bbpress default roles u can add this into your functions.php

    Add:

    function ntwb_bbpress_custom_role_names() {

    return array(

    // Keymaster

    bbp_get_keymaster_role() => array(

    ‘name’ => ‘Administrator’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_keymaster_role() )

    ),

    // Moderator

    bbp_get_moderator_role() => array(

    ‘name’ => ‘Moderator’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_moderator_role() )

    ),

    // Participant

    bbp_get_participant_role() => array(

    ‘name’ => ‘Member’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_participant_role() )

    ),

    bbp_get_tutor_role() => array(

    ‘name’ => ‘Member2’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_tutor_role() )

    ),

    // Spectator

    bbp_get_spectator_role() => array(

    ‘name’ => ‘Spectator’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_spectator_role() )

    ),

    // Blocked

    bbp_get_blocked_role() => array(

    ‘name’ => ‘Blocked’,

    ‘capabilities’ => bbp_get_caps_for_role( bbp_get_blocked_role() )

    )

    );

    }

    robertherold
    Participant

    I tried the following code:
    remove_action( 'bbp_user_edit_after', 'extra_user_profile_fields' );
    But failed!

    I tried to put somewhere else:
    add_action( 'bbp_user_edit_after_about', 'extra_user_profile_fields' );
    So it has displayed in two places 🙂

    #211209
    Mudit Kumawat
    Participant

    @frendeliko Admin bars were not being shown on my website, so you gave this code without adding conditions.  Thanks for adding conditions in my code 🙂

    #211205
    Carlos Faria
    Participant

    Thanks @mudit-kumawat. I would add this, as admin users will still show the admin bar, so with your code we will have two divs with the same id:

    
    // Add adminbar blank div to fix BBPRESS jQuery issue
    function add_admin_bar_div() {
      if( is_bbpress() && ! current_user_can('administrator') ){
        echo '<div id="wpadminbar" style="display:none;"></div>';
      }
    }
    add_action('wp_footer', 'add_admin_bar_div',15); 
    
    #211203

    In reply to: import data

    Robin W
    Moderator

    you’ll need to create a custom importer

    Custom Import

    if you do this, let us know, and we can add details to this site

    #211193

    Topic: login plugin

    in forum Installation
    momomoko
    Participant

    Hello there,

    I am stucked with this issue since some days : i am using the default bbpress connection widget (bpress version : 2.6.4) , but i am not satisfied by it behaviors such as redirect to wordpress admin login, the fact that the link on registration mail, bring the user again to wordpress back end, and also that email sender adress is the wordpress email (not mine !!) .. i had tried to change this last issue with this code in my functions.php :

     add_filter( 'wp_mail_from', 'your_email' );
    function your_email( $original_email_address )
    {
    	return 'myemail@domain.com';
    }
    
    add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
    function custom_wp_mail_from_name( $original_email_from )
    {
    	return 'My Forum Name';
    }

    But instead i just received a “mail delivery failed”

    I have tried other plugins such as “weaver” or “bbPress login register link..” but still not found the “good one” (or surely didn’t know how to optimize it)

    Did someone know how to solve this problem ??

    #211191
    cjerrells
    Participant

    Is there a reason the fixes in the patches above haven’t been integrated into trunk?

    This has been driving our users crazy and I’m surprised to find such an old thread here with an apparent solution. I made the changes and it seems fixed. Is there a hidden downside or complication that’s prevented it from becoming part of the standard codebase?

    theicebooky
    Participant

    @robkk

    Is it possible to hide the link? What is the code. Differently from killer_x10, I would like to hide the topic subscribtion link (I only want forum link). Is this possible to just hide it?

    #211168
    theicebooky
    Participant

    Never mind, I found and edit the code already… if you wanna know my code:

    #bbpress-forums > #subscription-toggle{
    float:right;
    }

    #bbpress-forums div.bbp-reply-content a.subscription-toggle,
    #subscription-toggle a{
    font-weight:bold;
    padding: 8px 8px 4px 8px;
    border: 0px solid #66FF33;
    background-color: #66FF33;
    color: white;
    }

    #bbpress-forums div.bbp-reply-content a.subscription-toggle,
    #subscription-toggle a:hover{
    background-color: #00FFFF;
    color: white;
    }

    #bbpress-forums div.bbp-reply-content .is-subscribed a.subscription-toggle,
    #subscription-toggle .is-subscribed a.subscription-toggle{
    border: 0px solid #e6e6e6;
    background-color: #e6e6e6;
    padding: 2px 4px 2px 4px
    }

    #211159
    Mudit Kumawat
    Participant

    @mjonesnerdery and @hoch to fix this issue add this function in the theme functions.php file

    // Add adminbar blank div to fix BBPRESS jQuery issue
    function add_admin_bar_div() {
      echo '<div id="wpadminbar" style="display:none;"></div>';
    }
    add_action('wp_footer', 'add_admin_bar_div',15); 
    #211154
    ctmichelle
    Participant

    Hi,

    I’ve added a blog element (pulling in topics) to my community homepage but need to display some additional stats in the feed.

    I need to display the following:
    1. # of views (Ive selected this in the settings, but stats are not displaying)
    2. # of likes
    3. # of replies

    Additionally, there is an ‘0’ after the excerpt. I’ve set the excerpt length to 160 characters to pull in a large portion of the title. The ‘0’ appears where the title is less than 160 characters. Is there a CSS code I can use to hid the ‘0’?

    See the page here. https://community.catalysttech.co/
    Would appreciate any advice.
    Thanks.

    #211149
    Robin W
    Moderator

    can you post the code you are using

    #211144
    theicebooky
    Participant

    Thank you @myndphunkie for a great CSS code. Works very well!!!

    #211134
    Robin W
    Moderator

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

    Code Snippets

    or it is available as an option in

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Topic/Reply Form

    #211133
    jamnet.kr
    Participant

    Where can I add that code?
    I mean, could you give me information about number of line in functions.php?

    #211127
    theicebooky
    Participant

    It did it guys with two codes :))

    #211115
    rashidkalwar
    Participant

    Shortcodes
    Codex Home → bbPress Features → Shortcodes
    Since Version 2.0 bbPress support so called Shortcodes. They have been introduced for creating macros to be used in the layout of your forum content on WordPress pages. To use any of the shortcodes simply insert the desired shortcode into any WordPress page.

    To get the required numerical ID for $forum_id, $topic_id, $reply_id and $tag_id you will need to visit your /wp-admin/ section and either by editing the post or by hovering your mouse over the applicable forum/topic/reply/tag post type you will see a numeric ID for that post eg. /wp-admin/post.php?post=47

    Forums
    [bbp-forum-index] – This will display your entire forum index.
    [bbp-forum-form] – Display the ‘New Forum’ form.
    [bbp-single-forum id=$forum_id] – Display a single forums topics. eg. [bbp-single-forum id=32]

    Topics
    [bbp-topic-index] – Display the most recent 15 topics across all your forums with pagination.
    [bbp-topic-form] – Display the ‘New Topic’ form where you can choose from a drop down menu the forum that this topic is to be associated with.
    [bbp-topic-form forum_id=$forum_id] – Display the ‘New Topic Form’ for a specific forum ID.
    [bbp-single-topic id=$topic_id] – Display a single topic. eg. [bbp-single-topic id=4096]

    Replies
    [bbp-reply-form] – Display the ‘New Reply’ form.
    [bbp-single-reply id=$reply_id] – Display a single reply eg. [bbp-single-reply id=32768]

    Topic Tags
    [bbp-topic-tags] – Display a tag cloud of all topic tags.
    [bbp-single-tag id=$tag_id] – Display a list of all topics associated with a specific tag. eg. [bbp-single-tag id=64]

    Views
    [bbp-single-view] – Single view – Display topics associated with a specific view. Current included ‘views’ with bbPress are “popular” [bbp-single-view id=’popular’] and “No Replies” [bbp-single-view id=’no-replies’]

    Search
    [bbp-search] – Display the search input form.
    [bbp-search-form] – Display the search form template.

    Account
    [bbp-login] – Display the login screen.
    [bbp-register] – Display the register screen.
    [bbp-lost-pass] – Display the lost password screen.

Viewing 25 results - 2,776 through 2,800 (of 32,492 total)
Skip to toolbar