Michael (@michaelhpdx)

Forum Replies Created

Viewing 21 replies - 1 through 21 (of 21 total)

  • Michael
    Participant

    @michaelhpdx

    Thank you all for the kind words, bbpress has worked out well for me and my Italian Wine Lifestyle site. Keep up the great work, bbpress folks!

    Cheers.
    Michael
    http://www.dalluva.com


    Michael
    Participant

    @michaelhpdx

    No response to this in the last 2 weeks, anyone have thoughts on why this occurs?  Does anyone else have this problem?

    Thanks.

    Michael


    Michael
    Participant

    @michaelhpdx

    Thanks for the kind words, Stephen.  I still have some format tweaking to do in the coming weeks, but it’s mostly there.  That page in particular (the Experimental Chianti Wine Tour map) shows off the integration of the Woo theme formatting with the Forum post.  For that one, I used the MS live writer (that uses my theme formatting) to draft it, then just cut-and-pasted the html into the Forum editor.  Worked like a charm.

    It will take a while to get the Forum participation up, but so far, so good.

    Cheers
    Michael


    Michael
    Participant

    @michaelhpdx

    Okay, I think I figured this out on my own, though I don’t quite have the list of usable html matching what the default TinyMCE editor offers.  I’ll have to play with that separately.

    What I did was add a function in my functions.php file that changed the allowed markup for all bbPress (and blog) posts to include what I think is a reasonable list AND is still safe. I’ve added the IMG tag as well — for my Forum that’s a useful feature, and I’ll just have to monitor what people post in terms of image links.

    Here’s the code I added to my functions.php file:

    add_action('init', 'my_html_tags_code', 10);
    function my_html_tags_code() {
            define('CUSTOM_TAGS', true);
            global $allowedposttags, $allowedtags;
            $allowedposttags = array(
                    'p' => array(
                            'style' => array()),
                    'strong' => array(),
                    'em' => array(),
                    'i' => array(),
                    'del' => array(),
                    'h1' => array(),
                    'h2' => array(),
                    'h3' => array(),
                    'h4' => array(),
                    'h5' => array(),
                    'hr' => array(),
                    'blockquote' => array(),
                    'q' => array(),
                    'pre' => array(),
                    'span' => array(
                            'style' => array()),
                    'div' => array(
                            'style' => array()),
                    'ul' => array (),
                    'ol' => array (
                            'start' => array()),
                    'li' => array (),
                    'a' => array(
                            'href' => array (),
                            'title' => array (),
                            'rel' => array()),
                    'img' => array (
                            'src' => array(),
                            'width' => array(),
                            'height' => array(),
                            'alt' => array())
            );
            $allowedtags = array(
                    'p' => array(
                            'style' => array()),
                    'strong' => array(),
                    'em' => array(),
                    'i' => array(),
                    'del' => array(),
                    'h1' => array(),
                    'h2' => array(),
                    'h3' => array(),
                    'h4' => array(),
                    'h5' => array(),
                    'hr' => array(),
                    'blockquote' => array(),
                    'q' => array(),
                    'pre' => array(),
                    'span' => array(
                            'style' => array()),
                    'div' => array(
                            'style' => array()),
                    'ul' => array (),
                    'ol' => array (
                            'start' => array()),
                    'li' => array (),
                    'a' => array(
                            'href' => array (),
                            'title' => array (),
                            'rel' => array()),
                    'img' => array (
                            'src' => array(),
                            'width' => array(),
                            'height' => array(),
                            'alt' => array())
    
            );
    }

    Michael
    Participant

    @michaelhpdx

    I’ve noticed this problem as well.

    I’m running WP 3.5.1 and bbPress 2.2.4.  My bbPress area is here: http://www.dalluva.com/member-area/forums/

    When a non-Admin user attempts to post a Topic or Reply using the Visual mode (built-in TinyMCE support), they’re led to believe that they can use do things like create ordered/numbered lists, etc.

    The visual editor does show it, but when they Submit it, bbPress strips this out.

    No surprise there: while the visual Editor bar shows these editing capabilities, the little box below the editor that says “You may use these HTML tags and attributes:” doesn’t list ol, ul, li etc.  Doh!

    I noticed that posting to this bbPress site, it shows in the little box that I can use ol, ul, li, and it does work.

    QUESTION:  How can I expand the available HTML tags and attributes (ideally without hacking the bbPress code) to include other tags like ul, ol, li, br, hr, etc?

    Thanks.

    Michael


    Michael
    Participant

    @michaelhpdx

    Hi John James — thanks for responding, much appreciated.

    Regarding get_the_ID() not working on an archive page, I understanding your point — there isn’t a page associated with it.

    The only issue I have is that the Forum Archive page is associated (“partnered” to use the documentation phrase) with a real page, and essentially it is just a regular page with embedded shortcodes.

    In my case, the partnered page has content and embedded shortcodes, and it has a real page ID (#1296 in my case).  That’s what I wanted to find so I can extract information specific to that partnered page.

    What am I doing with all this?  Well, the short story is that certain specific pages on my website have some special header images attached above the_content(), and I have created a custom Template in my child theme to handle it.  Information about the slug is extracted, which is used to lookup random images in a database of images.

    I’m trying to keep a consistent approach with all pages, hence the use of a custom Template that I set as a page attribute in the editor.

    None of this is fatal for my needs, but if a page is partnered with the Forum or Topic Archive pages, it seems like the selected Template for displaying those pages should come from the Template page attribute associated with it.  Hence the need for post ID of the partnered page.

    Cheers.

    Michael


    Michael
    Participant

    @michaelhpdx

    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


    Michael
    Participant

    @michaelhpdx

    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


    Michael
    Participant

    @michaelhpdx

    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


    Michael
    Participant

    @michaelhpdx

    Yep, that does indeed work. I still have a problem with being able to apply different page templates to this page, though — and this may not be a bbPress-specific issue, but it shows up only on bbPress pages created this way.

    The thread for this discussion is here.

    Thanks
    Michael


    Michael
    Participant

    @michaelhpdx

    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


    Michael
    Participant

    @michaelhpdx

    Did you ever get an answer for this?

    Michael


    Michael
    Participant

    @michaelhpdx

    Gotta agree with John James Jacoby, you’ve gotta expect to spend a decent amount of money to hire a contractor to do this kind of work. It’s not trivial, and was never meant to be (my opinion).  My guess is you’re looking at a decent project size of 20-40 hours minimum, unless the task is very basic.

    To put it in perspective, I’ve put in about 20+ hours to customize my bbPress installation so that it matches my Wootheme. bbPress documentation could be better, but it’s not too difficult if you can do rudimentary CSS3 coding (or pick it up on the fly, as I have).  Now, getting Buddypress to integrate and play nice with my theme and Woocommerce site, on the other hand, has consumed a lot more time than bbPress integration has.

    Best of luck, and don’t skimp on a good WordPress consultant.

    Michael


    Michael
    Participant

    @michaelhpdx

    Looks like you’ll need a plugin (or something) to override the $defaults array in bbp_get_the_content() in template-tags.php.  The “teeny’ variable is hard wired to TRUE — changing this to FALSE enables whatever TinyMCE config is set (through Ultimate TinyMCE et.al.).

    It would be nice if this were a configurable option in the Forums settings, right next to “Fancy Editor” tic box. 🙂

    Cheers.

    Michael


    Michael
    Participant

    @michaelhpdx

    It looks like the editor munged my code, so here’s a pointer to the code (in a .txt file): http://www.dalluva.com/temp/topic-excerpt.txt

    Cheers.
    Michael


    Michael
    Participant

    @michaelhpdx

    Okay, I’ve made some progress with this, though it’s not quite where I want it to be. I’ve been playing around with the function calls in bbp-topic-template.php, and been able to create a block of code that creates excerpts of topics (though not replies to topics…yet).

    Here’s the resulting output: http://www.dalluva.com/temp/example-excerpt-block-getting-there.JPG

    And here’s the code block (so far):

    $max_shown = 3;
    $parent_forum = 'any';
    $excerpt_length = 200;
    $avatar_size = 60;
    
    $topics_query = array(
        'author'         =&gt; 0,
        'post_type'      =&gt; bbp_get_topic_post_type(),
        'post_parent'    =&gt; $parent_forum,
        'posts_per_page' =&gt; $max_shown,
        'post_status'    =&gt; join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
        'show_stickes'   =&gt; false,
        'meta_key'       =&gt; '_bbp_last_active_time',
        'orderby'        =&gt; 'meta_value',
        'order'          =&gt; 'DESC',
        'meta_query'     =&gt; array( bbp_exclude_forum_ids( 'meta_query' ) )
        );
    
    $topic_query = new WP_Query( $topics_query );
    if ( $topic_query-&gt;have_posts() ) :
        $first_time = 1;
        ?&gt;
    
            have_posts() ) :
                if ( $first_time == 1 ) : $first_time = 0;
                else : echo "" ;
                endif;
                $topic_query-&gt;the_post();
                $topic_id = bbp_get_topic_id( $topic_query-&gt;post-&gt;ID ); ?&gt;
    
    
                    &lt;a class=&quot;home-topics-a&quot; href=&quot;" title=""&gt;
                    In Forum ""
                    By , Posted about 
    
    
                    &lt;a class=&quot;home-topics-more more&quot; title=&quot;Join the Conversation&quot; href=&quot;"&gt; READ MORE
    
    
         &lt;?php
    endif;
    

    I'm going to keep working this and I'll post my final results in the coming days. Any comments/input are appreciated. Cheers. Michael


    Michael
    Participant

    @michaelhpdx

    Checking the function code in bbp_topic_template.php, the call bbp_topic_excerpt() already accepts a $length argument; the default is 100, but it can be changed. Doh! It can be used as-is.

    Michael


    Michael
    Participant

    @michaelhpdx

    I am also interested in finding a reliable and simple way to display a post excerpt without having to hack the core files.

    Michael


    Michael
    Participant

    @michaelhpdx

    Here’s an example of what I’m trying to generate. This requires access to: Topic name, most recent Topic post/reply, name of the member posting, and his avatar.

    http://www.dalluva.com/temp/example-excerpt-block.JPG

    In this example (which I mocked up in PowerPoint), it is showing the 3 most recent bbPress posts across 3 different Forums/Topic areas.

    I hope that makes it clearer as to what I’m trying to accomplish.

    Thanks.
    Michael

    • This reply was modified 11 years, 6 months ago by Michael.

    Michael
    Participant

    @michaelhpdx

    Hi mostafaghanbari — not exactly like that, the home page of this forum just shows the topics, an not the text in the topics and replies.

    I want to display an excerpt of the most recent N topics and replies across all forums/topics. Think of it as just displaying the first 100-200 characters of member posts. This will go on the home page of my site in a small box, and in a sidebar on various pages on the site.

    Does that make sense?

    Michael


    Michael
    Participant

    @michaelhpdx

    I like the “display:none” fix in theme. Perfect. Thanks TSCADFX

Viewing 21 replies - 1 through 21 (of 21 total)