Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 8,651 through 8,675 (of 32,505 total)
  • Author
    Search Results
  • #162681

    In reply to: New Replies on top

    saju746
    Participant

    I got a error after putting this code. But that error helped me to find out the code where I needed to change. Thanks very much 🙂 I appreciate 🙂

    #162680

    In reply to: New Replies on top

    Robin W
    Moderator

    try adding this to your functions file

    add_filter('bbp_has_replies_query', 'modify_replies_query');
    
    function modify_replies_query($bbp_r) {
    $bbp_r = 'ASC';
    return $bbp_r;
    }
    
    

    Functions files and child themes – explained !

    #162670
    Kennon1st
    Participant

    I’ve been working hard at setting up a site for my podcast and things had been going swimmingly, but while looking around at some RSS feed import widgets and such today, somehow I seem to no longer have working BBpress forums. It doesn’t seem like it would be related, but who knows?

    The forums still show in my dashboard, and I was able to create a forum page by hand and get it to show the index with shortcode, but when I click on any of the forum links, it gives me a page not found error. It seems to do so even if I swap to one of the bundled 201x themes.

    The RSS widget I was testing out is RSS Multi Import 3.15 and I’m running WordPress 4.2.2 with the Generate Press theme 1.2.9.8 and BBpress 2.5.7. Website is http://www.whitebookpodcast.com.

    I’m a quite a newb to delving in to WordPress stuff, so I have to admit that I’m at a loss. Any thoughts on possibilities?

    #162664
    Shmoo
    Participant

    That’s why I installed it.. Testing the code and by the time my forum is done bbPress 2.6 will be released I hope.
    But still, a missing core stylesheet?

    Some developer who has worked last on the code should’ve mentioned it don’t you think, maybe the developers have some fancy tool where they test/fork the alpha and beta versions with?
    I just downloaded the latest version (trunk) of the trac website.

    https://bbpress.trac.wordpress.org/browser/trunk ( bottom – download .zip )

    BenM
    Participant

    Hi,

    Lots of plugins make this message appear :

    
    Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /srv/wp-includes/functions.php on line 3560

    How could we correct this, it’s very annoying because even my functions (not related to bbpress) causes this !

    For example, this code display bbpress error :

    if (!current_user_can('update_plugins')) {
     	add_action('admin_init', create_function(false,"remove_action('admin_notices', 'update_nag', 3);"));
     }
    #162662
    BenM
    Participant

    In fact, I prefered to do iy myself. It’s not specific to bbpress and I’m very surprised that WP doesn’t have this feature natively.

    For the ones who nedd this, here is my simple code :

    function yournamespace_exclude_menu_items( $items, $menu, $args ) {
        // only hide items in front, not admin
        if ( !is_admin() ) {
        // Iterate over the items
        foreach ( $items as $key => $item ) {
          // hide menu items which leads to pages with 'private' status
          if ( !is_user_logged_in() && get_post_status($item->object_id) == 'private' ) unset( $items[$key] );
        }
        return $items;
      }
      else return $items;
    }
    
    add_filter( 'wp_get_nav_menu_items', 'yournamespace_exclude_menu_items', null, 3 );
    #162659
    Robin W
    Moderator
    #162658
    Robin W
    Moderator

    it’s an alpha version – this is unreleased code, so you would expect stuff to be wrong/missing.

    hammed4real101
    Participant

    Hi Everyone,

    Please, i want to make my wordpress site a forum website. so, have decided to use bbpress.

    And i want my forum to look exactly like this forum (styling and everything)

    So, have decided to use a template file.

    So, can somebody help me with the php code and css code to make my forum look exactly like this one.

    Thanks in anticipation.

    #162653
    Robin W
    Moderator

    yes, it is only already declared because I used the same function name.

    Just combine the two and you get

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    if ( $translated_text == '%s ago') {
    $translated_text = '%s';
    }
    	if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) {
    	$translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s and %2$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s.' ) {
    	$translated_text = 'This elephant contains %1$s.';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    
    #162647
    joym
    Participant

    Well…I’ve run into a problem. I have this code that removed the word “ago” from the freshness layout:

    function change_translate_text( $translated_text ) {
    if ( $translated_text == '%s ago') {
    $translated_text = '%s';
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    The only place I want to include the word “ago” is on the top of the forum within the forum data block. Right now it reads: This forum contains x topics, and x replies, and was last updated by x 4 minutes.

    When I use the code above and manually add the word ago at the end of the line, I get an error because it was already declared. Is there a way around this? Thank you.

    #162643
    Robin W
    Moderator
    #162635
    BenM
    Participant

    Hi,

    I would like to add private forums. So I set my forums to private and I create a private page with [bbp-forum-index] shortcode (slug of this page is ‘forums’). After this, I add the forum page to my top menu.

    But nothing works for guest visitors :
    – I see the forum page in menu even if I’m not logged in.
    – If I’m not logged in and I click on forum page, I’ve a 404.

    If user is logged, it works.

    What’s the problem ? How can I hide menu item to non-logged users ?

    Thanks.

    #162632
    bayan.assaf
    Participant

    You can add the following code in your functions.php file:

    add_action(‘media_buttons’, ‘ml_pre_media_buttons’, 1);
    add_action(‘media_buttons’, ‘ml_post_media_buttons’, 20);
    function ml_pre_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post_temp’] = $GLOBALS[‘post’];
    $GLOBALS[‘post’] = null;
    }
    function ml_post_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post’] = $GLOBALS[‘post_temp’];
    }

    #162629
    Robin W
    Moderator

    it’s in

    /includes/forums/template.php

    lines

    1987, 1995, 2007, 2017

    You could probably filter it by

    
    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) {
    	$translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s and %2$s.' ) {
    	$translated_text = 'This elephant contains %1$s and %2$s.';
    	}
    if ( $translated_text == 'This forum contains %1$s.' ) {
    	$translated_text = 'This elephant contains %1$s.';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    in your functions file

    Functions files and child themes – explained !

    #162627
    Robin W
    Moderator

    I believe the following in your functions file should work

    function no_edit_lock($retval, $cur_time, $lock_time, $post_date_gmt){
     return false;
     }
     add_filter( ‘bbp_past_edit_lock’, ‘no_edit_lock’, 1, 4);

    Functions files and child themes – explained !

    Please come back and tell us if it does !

    #162606
    Jonny5ive7
    Participant

    Does this go into the theme style.css the bbpress.ccs style? And do I just copy and paste said code?

    aaronos
    Participant

    thanks for your help! Your codex worked for me and has now given me the basis to style the page a bit more.

    Thanks a lot

    #162581
    David13_13
    Participant

    @Robkk

    I didn’t minify the code and I think there is no ajax comments

    #162569
    Robkk
    Moderator

    @dc4x_admin

    I found something awhile ago , sorry I forgot about this topic.

    i cannont seem to find the code i used though.

    But you can just use this plugin instead , it should do the same thing.

    https://wordpress.org/plugins/bbpress-popular-topics/

    The shortcode is something like this for that plugin.

    [bbpresspopulartopics qty = 5]

    #162559
    Robkk
    Moderator

    bbPress is inheriting some CSS from your theme that is suppose to be for the WordPress comments.

    try this custom CSS to fix the issue

    #bbpress-forums .reply {
      margin: 0px;
    }
    #162531
    qbow-admin
    Participant

    i found it somewhere on the web that users cannot use iframe code because wordpress prohibits it for the sake of security. -it says that – if they r allowed to use iframe codes, they might be able to attack you –

    #162530

    In reply to: Edit Page Title

    entrapped
    Participant

    @pinkishhue: I’m using Weaver Xtreme Theme.


    @Robkk
    : The custom titles in AIO SEO are all set to %page_title% | %blog_title%
    There are none of the forum related options you said to check. (Maybe in pro version)

    The forum is displayed via shortcode on a standard page.
    When I remove the forum shortcode the title is displayed correctly. Adding the forum to the page removes the title.

    #162528
    qbow-admin
    Participant

    did you add the iframe code into ‘text editor’?
    it won’t work if you put it into ‘visual’ tab

    qbow-admin
    Participant

    I’ve been using bbpress plugin to set up forums for my website’s users. Originally there is no function when it comes to ‘counting views’ of each post. So I added some codes according to this website’s advice.

    It works fine with general(sitewide) forums but when I made a group(buddypress function) and tried to integrate it with bbpress forum, the view count php code does not work in group forums. (Still, it works perfectly fine at sitewide forums)

    this is my code right now (wp-content/plugins/bbpress/templates/default/bbpress/loop-single-topic.php)

    <li class="bbp-topic-voice-count">
        <?php 
    
    if( !function_exists('get_wpbbp_post_view') ) :
    // get bbpress topic view counter
    function get_wpbbp_post_view($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0";
    }
    return $count;
    }
    function set_wpbbp_post_view($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if( $count == '' ){
        add_post_meta($postID, $count_key, '1');
    } else {
        $new_count = $count + 1;
        update_post_meta($postID, $count_key, $new_count);
    }
    }
    endif;
    
    if( !function_exists('add_wpbbp_topic_counter') ) :
    // init the view counter in bbpress single topic
    function add_wpbbp_topic_counter() {
    global $wp_query;
    $bbp = bbpress();
    $active_topic = $bbp->current_topic_id;
    set_wpbbp_post_view( $active_topic );
    }
    add_action('bbp_template_after_single_topic', 'add_wpbbp_topic_counter');
    endif;
    
    echo get_wpbbp_post_view( bbp_get_topic_id() ); ?>
    </li>
Viewing 25 results - 8,651 through 8,675 (of 32,505 total)
Skip to toolbar