Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: Latest Replies

Viewing 9 replies - 1 through 9 (of 9 total)
  • Great work!

    Trent


    LMD
    Participant

    @louisedade

    Plugin updated!

    Now you can also display an individual user’s latest replies on their profile page.


    bbolman
    Participant

    @bbolman


    spicycauldron
    Member

    @spicycauldron

    Hi there

    I installed both of these to my forums today and they look great and do exactly what they’re supposed to – but since installing I can no longer automatically cross-post blog entries to the forums using the bb Press Post plugin, http://dev.mbzeus.net/

    What happens is blog entries do appear on the forums but they appear as having been closed topics – though of course I didn’t close them – and I can’t open them up while nobody comment on them in the forums.

    Any ideas, please? I don’t want to undo the work I did today getting your plugins working on my forums but I do find the other plugin very useful and there’s no other out there as far as I am aware….?


    LMD
    Participant

    @louisedade

    Hi,

    Thank you for letting me know. I suspect the problem is something to do with the fact that an extra database field has been created, and the ‘bbPress Post’ plugin is not updating that field. I have downloaded the plugin and will look at the code to see what’s going on — the fix may have to be in ‘bbPress Post’ rather than my plugins – but it may just be a small code change you can make yourself.

    So, I’ll get back to you in this topic later.


    LMD
    Participant

    @louisedade

    Hello again, just finished examining code. There are two issues.

    The first issue is that the blog entries you are posting to bbPress appear as closed topics. This problem is totally unrelated to the “Add Titles to Replies” plugin, which does not touch the ‘topics’ table in the database at all. I suggest you enquire with the ‘bbPress Post’ author about this. Did you update that plugin on your forum at the same time as installing mine? That could be the source of the problem.

    Now, having said all that, the second issue is going to seem to contradict it. What I mean is, are you sure the topics are ‘closed’, or is it just that the content does not appear – that is, is it a phantom topic?

    This can occur when the ‘topics’ table gets updated, but the ‘posts’ table does not for some reason (usually a coding error). When you create a new topic in bbPress, you are actually simultaneously creating the topic and making the first post in that topic – so both tables get updated.

    This is where the problem involves my “Add Titles to Replies” plugin, because we have altered the ‘posts’ table, which may be causing an error in the ‘bbPress Post’ plugin code (that plugin writes to the database in a different way to the bbPress core).

    Still with me? Good…

    Now, I do not have access to an integrated WordPress/bbPress installation, so I have made a stab in the dark at trying to fix this the easy way. I’ve written a very short function (a bit of a hack really) that you can add to the ‘bbPress Post’ plugin.

    In the ‘bbPress Post’ plugin open the file called ‘bbpress_post.php’ and add the following code to the bottom of the page, just before the bottom PHP tag ?>

    /* Ugly 'Add Titles to Replies' Hack by LouiseDade */
    function bbpress_add_reply_title( $post_id, $topic_id ) {
    global $wpdb, $otherdb;
    $bb_table_prefix = bbpress_getoption('bb_prefix');

    if (bbpress_getoption('bb_other_base') === "no") {
    $topic_title=$wpdb->get_var("SELECT topic_title FROM ". $bb_table_prefix ."topics WHERE topic_id=$topic_id LIMIT 1; ");
    $wpdb->query("UPDATE ". $bb_table_prefix ."posts SET post_title='$topic_title' WHERE post_id='$post_id' LIMIT 1");
    } else {
    $topic_title=$otherdb->get_var("SELECT topic_title FROM ". $bb_table_prefix ."topics WHERE topic_id=$topic_id LIMIT 1; ");
    $otherdb->query("UPDATE ". $bb_table_prefix ."posts SET post_title='$topic_title' WHERE post_id='$post_id' LIMIT 1");
    }
    }

    Next, scroll up to the bbpress_new_post() function and at the bottom, before the closing curly brace, add:

    /* Added by LouiseDade - updates post reply title */
    bbpress_add_reply_title( $post_id, $topic_id );

    Then scroll up again to the bbpress_post_update() function and add the same code as above just before the closing curly brace again.

    Re-upload the plugin with the changes made and try posting a WordPress entry.

    If it works I shall jump around for joy, but unfortunately I have grave doubts about it. I think it might need to be done the hard-way, which involves rewriting some of the ‘bbPress Post’ plugin.

    Good luck!


    spicycauldron
    Member

    @spicycauldron

    louisedade, thanks so much for getting back to me on this and yes, I’ve emailed the other plugin developer but no response as yet.

    I am enormously appreciative of you going to the trouble of working on a possible fix. I hear what you’re saying about your views on its chances, but I will give it a try and head back here to let you know if it works or no.

    Other than that, I only hope the BBPress Post plugin author gets back to me on this. But yeah, thank you!


    spicycauldron
    Member

    @spicycauldron

    Aagh. Sadly I get SQL errors. But I can tell you the posts appear empty as well as closed in the forums, in line with your comments above. So thanks to you I know what’s going on and will try to get the other plugin developer to come take a look here. Thanks again!


    LMD
    Participant

    @louisedade

    I’m not that surpised it didn’t work. Here is a different fix, editing the ‘bbPress Post’ plugin itself. I’m using line numbers to reference the code. I’ve based the line numbers on an UNEDITED version of the ‘bbpress_post.php’ file. So, if you open up a fresh version of the file that hasn’t been touched (i.e. do not use the version you previously added my ‘fix’ to – you no longer need that fix).

    Try these code changes:

    Line # 457 – replace with:

    bbpress_bb_new_post($topic_id, $content, $forum, $author, $now, $title);

    Line #533 – replace with:

    $wpdb->query("UPDATE ". $bb_table_prefix ."posts SET post_text='$content', post_title='$title' WHERE post_id=$bbpost_id LIMIT 1;");

    Line #540 – replace with:

    $otherdb->query("UPDATE ". $bb_table_prefix ."posts SET post_text='$content', post_title='$title' WHERE post_id=$bbpost_id LIMIT 1;");

    Line #585 – replace with:

    function bbpress_bb_new_post( $topic_id, $content, $forum, $author, $now, $title ) { // making new post in bbPress

    Line #587 – replace with:

    $wpdb->query("INSERT INTO ". $bb_table_prefix ."posts VALUES ('', $forum, $topic_id, $author, '$content', '$now', '127.0.0.1', 0, 1, $title);");

    Line #591 – replace with:

    $otherdb->query("INSERT INTO ". $bb_table_prefix ."posts VALUES ('', $forum, $topic_id, $author, '$content', '$now', '127.0.0.1', 0, 1, $title);");

    Note: this is assumes two things:

    1. That in the bbPress ‘posts’ table the ‘post_title’ field was added as the last field.

    2. That you do not have any other plugins that have added fields to the bbPress database.

    Let me know how you get on this time.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar