Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 15,101 through 15,125 (of 32,519 total)
  • Author
    Search Results
  • #120766
    Michael
    Participant

    Okay, I’ve made some further progress with method #3 above (hooking into bbp_get_bbpress_template ).  Here’s the general approach I’m taking:

    add_filter( 'bbp_get_bbpress_template', 'my_add_page_template', $templates );
    function my_add_page_template( array $templates ) {
      $page_template = get_post_meta( $post_id, '_wp_page_template', true );
      if ( $page_template != 'default' )
        array_unshift( $templates, $page_template );
    return $templates;
    }

    The only issue I have right now is that $post_id is difficult to extract if the archive pages (Archive Base and Topics Base) are being displayed. Right now I am hard wiring it to the post_id of the Archive Base page (getting it from the editor), and it works okay but not what I want.

    Since these pages (archives) are custom post types, I haven’t found an easy way to find their post_id’s, and querying globals like $post->ID and calling functions like get_the_ID() and url_to_postid() don’t work for custom post IDs ($post->ID and get_the_ID() return 0).

    QUESTION: For a bbPress page that is currently being built for display, is the post_id of the page being stored somewhere in a bbPress global?

    Michael

    #120765
    Stephen Edgar
    Keymaster

    Use the [bbp-forum-index] shortcode https://codex.bbpress.org/shortcodes/

    Stephen Edgar
    Keymaster

    Basically all these functions names need to be unique…

    If you use the above from @JJJ with ‘foo’ and then you use another function from another topic called ‘bar’ and then use a third again called ‘foo’ you will now have a conflict because two custom functions are trying to use ‘foo’.

    A common practice is to name the functions with something to remind yourself (or others reading your code) that it is custom code you have added to your install.

    eg. Prefixing ‘foo’ with ‘hd_’ for ‘Halo Diehard’

    function hd_foo( $args = array() ) {
        $args['teeny'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'hd_foo' );

    Better yet, a more descriptive name again with ‘hd_’ Halo Diehard prefix.

    function hd_custom_teeny_mce_override( $args = array() ) {
        $args['teeny'] = false;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'hd_custom_teeny_mce_override' );
    #120751
    Stephen Edgar
    Keymaster

    Here are the steps I would follow:

    – Backup everything and often (WordPress, Xooops, MySQL etc)
    – Install WordPress locally to test the import
    – Research the Xoops MySQL database structure
    – Make a copy of importer example.php as xoops.php in the same folder
    – Edit xoops.php to match the xoops database table & field names

    eg. This from Example.php:
    // Forum id. Stored in postmeta.
    $this->field_map[] = array(
    'from_tablename' => 'forum',
    'from_fieldname' => 'forumid',
    'to_type' => 'forum',
    'to_fieldname' => '_bbp_forum_id'
    );

    Would become:
    // Forum id. Stored in postmeta.
    $this->field_map[] = array(
    'from_tablename' => 'xoops_forum_table_name',
    'from_fieldname' => 'xoops_forumid',
    'to_type' => 'forum',
    'to_fieldname' => '_bbp_forum_id'
    );

    The above is not accurate as I have no idea what table and field names xoops uses for its database, that is the bits you need to research. Do the above for as much as you can matching all the tables and fields testing your import.

    Once you have an import working and are happy with you can then look to importing it to your live site and I cannot emphasize this enough, backuyp, backup and more backups in case things go wrong.

    Halo Diehard
    Participant

    Thank you for your quick response, I guess what I’m trying to convey is my uncertainty whether or not I can just plug that code in and rename “foo” anything? I don’t understand why I have to rename the foo, so I thought perhaps there was another step as well it was assumed I would know. (aka: you also have to put “” into your html)

    Sorry I’m such a “foo” when it comes to coding 😉 I’m learning as fast as I can!

    Wait, I might understand! We rename “foo” so we can recognize what it does when we’re looking at the code?

    Hansaplastique
    Participant

    For some reason my code didn’t stick; I mean remove:

    bb_new_topic_link();

    Hansaplastique
    Participant

    +1 for me.

    I installed “bbPress Topics for Posts” (plugin link).
    I wanted to create one forum that collects comments on articles (this plugin does that very well – only downside is that comments made in the forum do not count as comments but are visible).

    Anyhow; I want users to be able to reply, but NOT create new topics.
    Right now it’s either no new topics and no new replies, OR new topics and new replies.

    Of course I could modify the forum.php and remove the for the specific forum. Is there an easier (more future proof) way?

    #120738
    Michael
    Participant

    Okay, after some sleuthing I’ve figured out why page.php is *always* called to display the Archive Base and Topic Base.

    The set of available templates appears to be hard-wired in (rather than selecting from all available Templates in the selected Theme) in bbp_get_theme_compat_templates() in …/bbpress/includes/core/template-loader.php.

    bbPress appears to want to select from a known list of “bbPress friendly” Templates to display pages, so it uses this hard-wired list when it goes hunting for the Template to use for displaying a given bbPress page.

    The $templates array includes the following Template file names (as of v2.2.2):

    $templates = array(
    'plugin-bbpress.php',
    'bbpress.php',
    'forums.php',
    'forum.php',
    'generic.php',
    'page.php',
    'single.php',
    'index.php'
    );

    What’s important here is that the ORDERING of the Templates in the array matters, as the function bbp_locate_template() goes through this array sequentially and returns the first Template it finds, which gets used to display the bbPress page.

    bbp_locate_template() searches the Child Theme first, then the Parent Theme, and finally the theme-compat folder, so in theory one can install a Template in the Child or Parent Theme with one of the above Template file names, and so long as bbp_locate_template() finds it first, we’re all cool — that Template will get used for Forum pages.

    There are 3 ways I can see to ensure my special Template is used when the Archive Base is displayed, in order of simplicity:

    1.  Edit the hard-wired $templates array in bbp_get_theme_compat_templates() in template-loader.php and add my template name to the top of the list.  Of course, this is BAD PRACTICE since it will get overwritten in the next bbPress update, but a quick way to test out a Template.

    2.  Create a Template called “plugin-bbpress.php” and put it in my Child Theme directory.  That’s the simplest.

    3.  Hook into bbp_get_bbpress_template, which is used as a filter on the $templates array and add my Template name as the first entry in the array.  This is the way it’s intended to be done, from what I can tell.

    All three of these will work, but they all have the downside of completely ignoring the Template setting of the Page Attribute for a given WP page (see here for what I’m talking about).  For a given WP page that is “partnered” with a bbPress page, bbPress should use the Template specified in the Page Attribute.  That’s what it’s there for.

    While I haven’t tried it yet, perhaps I can hook into bbp_get_bbpress_template and inject the current page’s Page Attribute for the Template.  I’ll have to dig into this a bit and see if it’s worth the effort.  It seems like that would be the cleanest way, as well as in the spirit of how Page Attributes are supposed to be used.

    Wish me luck.

    Michael

    #120735
    Pippin Williamson
    Participant

    Did you setup the home page of the forums using the short codes? If so, switch to the HTML view of your page editor and you will be able to see the PRE tags.

    #120734
    Michael
    Participant

    Okay, I’ve been doing some digging and perhaps as expected, the theme Template page.php (the default WP Template) is being called to build the Archive Base page.  I can edit the page.php in my child theme and customize from there (where it eventually calls the_content(), which apparently executes content-archive-forum.php to display the Forum “front page”), but that’s a brute-force method since page.php is the default Template for all pages. I want to create a Template explicitly for bbPress pages, which means I need a way to specify the Template to use on a per-page basis.

    Normally this would be done by simply creating a Template (like page.php) and put it in your child theme directory, then select it for a specific page you want to apply it to using the wp-admin Edit Page -> Page Attributes -> Template pull down, save it and voila, your page uses your custom Template.

    But with bbPress pages that are “partnered with a WordPress page” (per this topic discussion), this doesn’t work for the partnered page.  The Template setting seems to be ignored, and only for bbPress pages partnered this way.

    This may not be a show-stopper for me, but may be for others looking to customize the overall page Template for their bbPress pages.  Is it a bbPress bug?  I can’t tell, and hopefully I’m missing something painfully obvious, being new to installing/using bbPress.

    Seems like there must be some kind of code frag in the plugin that does something like:

    if (request to display (Archive Base | Topic Base) {
      if ((Archive Base | Topic Base) is partnered with WP page) {
        point the_content() at (content-archive-forum.php | content-archive-topic.php);
        call default page Template;
      }
    }

    JJJ or someone else in-the-know, can you comment on how the “partnering with a WordPress page” works? Where is this performed? Sorry if the question is naive, I’m just having trouble understanding how this partnering works at the Template execution level.

    Many thanks.
    Michael

    #120727
    tomazi
    Participant

    how do i add the code correctly to the core?

    is it ?

    I think its really wierd that bbpress does not have a easy way to add post count to the forum. Or is it something really easy i have missed?

    Thanks!

    #120720

    Exactly like you’d expect:

    • Create a page with the slug ‘topics’
    • Use the ‘bbp-topic-index’ shortcode in the page content.
    • Done.
    #120702
    Michael
    Participant

    For what it’s worth, I’m looking for whatever function is calling content-archive-forum.php.  I can edit this file in my child theme per the Codex, but I’m trying to figure out which function is calling this, and in particular, what function generates the code above the <div id=”bbpress-forums”> at the start of content-archive-forum.php.

    Does bbPress simply use the default post display template, and if so, where is the call to load and execute content-archive-forum.php  made?

    I tried a grep for content-archive-forum in the entire wordpress tree from wp-content on down, and I can’t find where this is called from.

    Many thanks

    Michael

     

    and not just this template file

    #120698
    Michael
    Participant

    Hi there — I’m running WP 3.4.2, bbPress 2.2.2 & buddypress 1.6.1.  Overall, I’m quite happy with the installation, and I’ve done a fair amount of customization on my site  to give it a nice L&F.  I’ve been using a child theme to do all customization, and it’s been reasonably straightforward, but not trivial.  That said, many thanks to all the bbPress folks who are putting lots of time in on this plugin — it’s a great platform.

    Onto my question:  How is the main forum archive page generated?  I want to create my own template to generate this page, and I’ve been stumped trying to trace the sequence of files/calls used to create it.

    For context, I have the Forums Base set to “member-area/forums” in Settings -> Forums. I can go to http://mysite/member-area/forums and see the standard listing of all the forums in a table.  Perfect, just what I want.

    That said, how exactly is this page created?  Which files & calls in the plugin create it?  I’ve found loop-forums.php in …/plugins/bbpress/templates/default/bbpress/which is used to create the table within the page (apparently called as the_content() somewhere), but I can’t find the code blocks that create the header, footer, etc.  Is there a single template page used to create the Archive Base page?

    Apparently this page is generated regardless of whether there is an existing page (permalink) to the same permalink used as Archive Base.  Nifty, but I want to use my own template (the whole thing) for creating the Archive Base page.

    Even when I create a page with a permalink address the same as Archive Base and insert a  [bbp-forum-index] in the post content, I can’t seem to select a Template from the Page Attribute pull down that has any effect on the creation of the Archive Base page.  It’s like it’s hard wired to use a very specific template — that I can’t find in the directory tree.

    Long winded, but I hope that conveys what I’m trying to do.  In short, I just want to create my own template for creating the Archive Base page.  Any pointers are appreciated.

    Cheers,

    Michael

    Pierre-Luc Auclair
    Participant

    Hi tzeldin88,

    I had a similar problem. I am using various get_post_field calls to display parts of a footer that need to be editable by a client and needed to do apply_filters(‘the_content’,$x).

    I have found that if I call bbp_restore_all_filters('the_content',0);, it will bring the filter back, but it doesn’t affect the rest of the forum. 🙂 I would assume that calling the bbp_remove_all_filters() function after will disable it back.

    Hopefully my example here is clearer.
    http://pastebin.com/BdiMFGTV

    #120692

    In reply to: bbPress 2.2.2 released

    SK
    Participant

    As reported elsewhere, my theme doesn’t seem to like bbPress 2.2.2 either.

    The problem caused is that I think the template files that make bbPress work with other themes broke.

    I can still go to the forum pages with direct URLs or links in forum list widget, but the forums (list of forums or list of topics) are not visible. All I see in content area is page/forum title and forum description.

    Similarly, on topic pages, I see topic title, but nothing else…

    When I view source, the code is not there. e.g. when on forums home I view code, I can’t find the forum names (except in the forum list widget)

    P.S. Reinstalling 2.2.2 has not resolved the issue.

    #120682
    sambedingfield
    Participant

    Not be the most elegant solution, but it’ll have to do for now:


    //redirect user profile topic permalinks to fix pagination, as we have topics embedded on profiles
    function rats_redirect_user_pagination( $pagination ) {
    // Get bbPress
    $bbp = bbpress();
    if (bbp_is_single_user() && is_array($pagination) && isset($pagination['base']) ) {
    //if topics has not been included in the url yet
    $check_topic = strpos($pagination['base'], '/topics/page/');
    if($check_topic === false) {
    $pagination['base'] = str_replace('/page/','/topics/page/', $pagination['base']);
    }
    }
    //return pagination array
    return $pagination;
    }
    add_action('bbp_topic_pagination', 'rats_redirect_user_pagination', 99, 1 );

    #120678

    In reply to: RSS feeds broken

    Steve
    Participant

    Sorry, I lost sight of this… there’s another bug – you use

    get_option( 'rss_language' );

    which no longer works…. it needs to be changed to:

    bloginfo_rss( 'language' )

    I can raise another trac ticket when I get home if you like

    Steve

    #120667
    Stephen Edgar
    Keymaster

    Make sure you select ‘phpBB’ with the ‘import forums tool’ option ‘Select Platform’

    Check out the brief docs here https://codex.bbpress.org/import-forums/

    The import works pretty well for the base of phpBB migration for users, forums, topics & replies.

    #120659
    #120655

    In reply to: How to rollback

    SK
    Participant

    Thanks @labsecrets, but that may not work for us because when I view source the code is not there. e.g. when on forums home I view code, I can’t find the forum names (except in the forum list widget)

    #120652

    In reply to: bbPress 2.2.2 released

    LabSecrets
    Participant

    Between 2.2.1 and 2.2.2, we found that the profile pages suddenly “vanished” (but the code was still there). It was a CSS issue.

    For our clients and personal sites, the fix was on line 78 of the default css:

    We changed “clear:none” to “clear:both”


    #bbpress-forums #bbp-user-wrapper ul.bbp-lead-topic, #bbpress-forums #bbp-user-wrapper ul.bbp-topics, #bbpress-forums #bbp-user-wrapper ul.bbp-forums, #bbpress-forums #bbp-user-wrapper ul.bbp-replies, #bbpress-forums #bbp-user-wrapper fieldset.bbp-form {   clear: both; }

    Pierre-Luc Auclair
    Participant

    I’m trying to understand if/how it is possible to call BuddyPress functions outside the forum (in a regular WP page). The Codex isn’t of much help…

    I am trying to create a latest topics list and a forums list on regular WP pages (home.php, index.php), etc.

    Thanks for the help !

    #120647

    It’s a bit difficult to wrap your head around at first, but the reason theme compatibility exists, is because you should not modify code/templates that come with plugins or themes. When using a plugin like bbPress, and a theme that isn’t yours, you need some other way to introduce code into WordPress.

    You can use either a plugin, or a child theme to do this.

    You’ll want to research both methods, and figure out which one suits your situation and needs.

    #120646

    Yep!

    • bbp_get_forum_content( $forum_id ); to return
    • bbp_forum_content( $forum_id ); to echo
Viewing 25 results - 15,101 through 15,125 (of 32,519 total)
Skip to toolbar