Adam Harley (Kawauso) (@kawauso)

Forum Replies Created

Viewing 25 replies - 226 through 250 (of 285 total)
  • @kawauso

    Member

    register_globals is a gaping security flaw that’s been turned off in every recent PHP version. If you have it on, PHP takes anything passed by $_GET, $_POST, $_COOKIE and $_SERVER and turns them into global variables (i.e. ?book=1 in the $_GET array becomes $book = 1). I’d recommend turning it off ASAP.

    The edit link turns itself off after a while, it’s not just limited to if anyone else has posted :)

    Ah, and good luck integrating bb-load.php, I could never get it to even play nice with WordPress.

    @kawauso

    Member
    <?php if ( !bb_current_user_can('manage_options') ) : ?>
    GOOOOOGLE :)
    <?php endif; ?>

    or

    <?php if ( !bb_current_user_can('manage_options') ) { ?>
    GOOOOOGLE :)
    <?php } ?>

    bbPress/WordPress have a boolean function for pretty much everything

    @kawauso

    Member

    If you’re trying to get the forum list on the front page visible without anything else, just put something like:

    <?php if( !isset( $_GET[ 'forumsonly' ] ) ) : ?> after <?php if ( $forums ) : ?> in front-page.php, then before <?php if ( bb_forums() ) : ?> put <?php endif; // forumsonly ?>.

    That would allow you to put ?forumsonly in the URL to turn off the extra bits of the front page.

    The other option would be to copy index.php into a new file and change the template it loads to something else and take out the parts you don’t want in there, but if bbPress changes anything in index.php in a new version, you’d miss out on the changes.

    @kawauso

    Member

    The “Depreciated” error is caused by PHP complaining that the code is using an old-fashioned way of passing variables. The 2nd error is complaining that PHP has just output text when it shouldn’t have done (since it just gave error text).

    The short-term fix would be to look in your PHP’s php.ini and check allow_call_time_pass_reference is set to On, but I don’t know why your xampp would’ve shipped with it Off since mine came On or why it’s calling things like that in bbPress. So yep, re-download. That’s not an error caused specifically by a trunk build though ;)

    @kawauso

    Member

    Haha or that :P I work with a server that’s almost completely firewalled in most of the time, makes doing anything that easy impossible

    @kawauso

    Member

    It’s probably easier to use a RSS parser to be honest, but I couldn’t find one that’d use a local RSS source rather than a remote one passed through a PHP script first, so meh.

    @kawauso

    Member

    Ah the plugin is intended for WordPress installs only I’m afraid.

    A quick way of doing it:

    In your bbPress directory, make a file called javascript.php containing:

    <?php

    // Taken from index.php
    // Load everything up

    require('./bb-load.php');

    do_action( 'bb_index.php_pre_db' );

    $forums = bb_get_forums(); // Comment to hide forums
    if ( $topics = get_latest_topics( false, $page ) ) {
    bb_cache_last_posts( $topics );
    }

    bb_load_template( 'html_include.php' );

    ?>

    then in your template directory, make a file called html_include.php containing:

    <?php if ( $forums && $topics ) : ?>
    <table id="latest_discussions">
    <tr>
    <th><?php _e('Topic'); ?></th>
    <th><?php _e('Posts'); ?></th>
    <!-- <th><?php _e('Voices'); ?></th> -->
    <th><?php _e('Last Poster'); ?></th>
    <th><?php _e('Freshness'); ?></th>
    </tr>

    <?php foreach ( $topics as $topic ) : ?>
    <tr>
    <td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
    <td class="num"><?php topic_posts(); ?></td>
    <!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
    <td class="num"><?php topic_last_poster(); ?></td>
    <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td>
    </tr>
    <?php endforeach; // $topics loop ?>
    </table>
    <?php else : ?>
    No discussions.
    <?php endif; ?>

    and finally, in the page where you want to load the list, put something like:

    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>$.get("javascript.php", { rand: Math.random() }, function(data){ document.getElementById('latest').innerHTML = data; } );</script>
    <div id="latest"></div>

    Old-fashioned way of loading the HTML in there and use a local copy of jQuery or whatever library you use, but that’s the general idea really.

    html_include.php is just a cut down version of front-page.php so you can edit it the same as any other template. javascript.php doesn’t load in stickies, but that’s just how I felt like doing things, it’s a cut down version of index.php so it’s easy enough to put back.

    Even more cut down version of html_include.php (so you really do just get a list):

    <?php if ( $forums && $topics ) : ?>
    <ul>
    <?php foreach ( $topics as $topic ) : ?>
    <li><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></li>
    <?php endforeach; // $topics loop ?>
    </ul>
    <?php else : ?>
    No discussions.
    <?php endif; ?>

    @kawauso

    Member

    Hmm… easy way of doing that :)

    function bb_reset_newpostlink() {
    global $link, $topic_id;
    $link = get_topic_link( $topic_id );
    }
    add_action( 'bb-post.php', 'bb_reset_newpostlink' );

    Put that in either functions.php or a plugin, it’ll overwrite the redirect link with the general topic one.

    @kawauso

    Member

    What bbpress integration plugin are you using? You should be able to integrate 2.8 and 1.0 without any plugins installed in either, just set the bbPress up with the same settings as WordPress under Settings -> WordPress Integration in the bbPress admin.

    @kawauso

    Member

    There’s the latest topics RSS feed at /rss/topics and the WordPress Latest Post plugin: https://bbpress.org/plugins/topic/wordpress-latest-post/, either of those help?

    In reply to: Plugin suggestions

    @kawauso

    Member

    @Olaf: It’s about plugin suggestions, check the title. It’s just gotten off-topic.

    @kawauso

    Member

    For a start… <script> is for JavaScript code, not PHP :P You could avoid using a separate template for that one call anyway and use the function directly instead, or put it in functions.php. You might have to register template files though, but I’m not sure.

    In reply to: All RSS Feeds Broken?

    @kawauso

    Member

    Yeah that looks like WordPress is attempting to handle the RSS as well as bbPress, so it’s definitely a deep integration issue. I’m not sure how to detangle that, but hopefully someone else can or I’ll try and have a look tomorrow.

    In reply to: All RSS Feeds Broken?

    @kawauso

    Member

    Ah crap, everything is breaking today :(

    @Reboot Now: That looks like a different issue. Could you post line 13 of the broken RSS feed (view source)?

    In reply to: Closed registrations

    @kawauso

    Member

    I’ve found running SABRE with stealth mode on in WordPress stops 100% of our bot registrations and I just point bbPress at that. If you disable registration with either .htaccess or changing the function, it’ll put a complete stop to any registrations on the bbPress side, so you shouldn’t need any spam protection besides that unless you let unregistered users post. bbPress comes with Askimet installed anyway though.

    @kawauso

    Member

    Okay I can’t work out how to get it to position relative to the theme, since it just… disappears if I try aligning it properly at left: -1000px. Putting <div style="position: absolute; left: 100px;"> and </div> around it will put it on the left of the screen outside the layout though, just fixed against the side of the screen rather than the layout.

    @Olaf: this theme does some awful things if you try aligning anything to its left using a div :(

    In reply to: Closed registrations

    @kawauso

    Member

    @pixelgirl Give me your forums’ link and I’ll see if I can register ;P you might still get spambots if they work out how to spam bbPress forums. Brutally brutal way would be to change $_POST && 'post' == strtolower($_SERVER['REQUEST_METHOD']) in register.php in bbPress’ base directory to false, which would turn off processing for any data passed to the register page.

    @kawauso

    Member

    I don’t usually work with adsense so I don’t know what the div it’s in is called. If you can post a link to your site with AdSense running I can probably work out some CSS though.

    @kawauso

    Member

    Your image link returns a 403 Forbidden error, a direct link to your website would be much easier to work with anyway. I’d recommend putting it in header.php and using either tables or CSS to align it to the left of the main content.

    @kawauso

    Member

    I guess you mean you have WordPress.com blog then, as opposed to one on a server? You could try something like what’s being offered here: https://bbpress.org/forums/topic/free-hosting-for-bbpress

    @kawauso

    Member

    Right.

    In topics.php, delete:

    <?php if ( topic_is_open( $bb_post->topic_id ) ) : ?>
    <?php post_form(); ?>
    <?php else : ?>
    <h2><?php _e('Topic Closed') ?></h2>
    <p><?php _e('This topic has been closed to new replies.') ?></p>
    <?php endif; ?>

    Then after the first <?php topic_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?>, insert:

    <?php if ( $page === 1 ) : ?>
    <?php if ( topic_is_open( $bb_post->topic_id ) ) : ?>
    <?php post_form( array( 'last_page_only' => false ) ); ?>
    <?php else : ?>
    <h2><?php _e('Topic Closed') ?></h2>
    <p><?php _e('This topic has been closed to new replies.') ?></p>
    <?php endif; ?>
    <?php endif; ?>

    It’ll be different if you’re using something that’s radically different to Kakumei, but the general idea is to take the bit that looks something like the first part and put <?php if ( $page === 1 ) : ?> and <?php endif; ?> around it, change post_form() to post_form( array( 'last_page_only' => false ) ) then move it to the top of the page.

    In reply to: All RSS Feeds Broken?

    @kawauso

    Member

    https://www.yousendit.com/download/YkxKZGlsaTEzS3BjR0E9PQ

    Try that. The RSS validation is complaining that the xml header is on the 2nd line, rather than the first, so there’s a line return being inserted somewhere. If FTPing those over the old ones doesn’t work, it’s the dev’s problem :P

    @kawauso

    Member

    It’s throwing up 301 Moved errors so I’m wondering if it’s messed up your .htaccess file or something. Where did you install bbPress under? Also, what integration plugin? What version of bbPress did you install? By the way… your version of WordPress has a gaping security hole, UPGRADE!

    @kawauso

    Member

    There isn’t exactly as counterpart to login_form() for registering because it’s not expected to be embedded I guess. If you look under register.php though, you can see the internal function template call is bb_load_template( 'register.php', $_globals ); where $_globals are set earlier in the page before some code that handles the form output (ignore them at your own peril).

    The register.php template is also set up to be a full page though with calls to the header and footer functions, as well as a safety check for logged in users, so you’d probably need to cut it down and save it as a separate template to call.

    I’m pretty sure there’s been some discussion of embedding a register page in a template before in the forums, so you might want to look for that too.

    In reply to: All RSS Feeds Broken?

    @kawauso

    Member

    @kirpi.it Nevermind, ignore what I said earlier. You have a space or a line return before the opening <?php in rss2.php. Seems to be a consistent problem copying from the forums. :/

Viewing 25 replies - 226 through 250 (of 285 total)