Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 25,826 through 25,850 (of 32,495 total)
  • Author
    Search Results
  • This is how phpBB already works. ;)

    I think its a good idea though.

    frooyo
    Member

    I believe I have a simple but highly effective fix.

    Since the vast majority of forum traffic is for non-logged in users AND, since the only time a forum page changes is if a POST is made … why not implement a very basic disk caching system that caches the content for the FrontPage and Topic page for non-logged in users.

    Here is the pseudo code:

    // Front page


    if (not logged in)

    …….. serve disk cache

    …………….if (disk cache not present)

    ……………………generate page and save to disk

    else (logged in user)

    ……..generate page (PHP)

    // Topic page


    if (not logged in)

    ……..serve disk cache

    ……..if (disk cache not present)

    …………….generate page and save to disk

    else (logged in user)

    ……..generate page (PHP)

    // post a comment function


    delete Topic cache for non-logged in users

    delete Front page cache for non-logged in users

    The benefit being, now for any non-logged in user – the Front page and individual Topic pages will be cached once some submits a new comment.

    And if you are logged in, non of this effects you.

    Thoughts?

    #71196
    fwilson789
    Member

    Come on, there has to be a way to do this!

    It worked fine for me with the current stable release, but the login was broken, so I installed the unstable. The login started working, but wp_head() stopped.

    bb-config.php:

    include('../wp-config.php');

    /**
    * The base configurations of bbPress.
    *
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys and bbPress Language. You can get the MySQL settings from your
    * web host.
    *
    * This file is used by the installer during installation.
    *
    * @package bbPress
    */

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for bbPress */
    define('BBDB_NAME', 'bbpress');

    bb-templateskakumeifront-page.php:

    <?php get_header(); ?>
    ... page ...
    <?php get_footer(); ?>

    #67924
    frooyo
    Member

    @sambauers & @andersson

    I believe I have a simple but highly effective fix.

    Since the vast majority of forum traffic is for non-logged in user AND, since the only time a forum page changes is if a POST is made … why not implement a very basic disk caching system that does the following pseudo code:

    // Front page


    if (not logged in)

    …….. serve disk cache

    …………….if (disk cache not present)

    ……………………generate page and save to disk

    else

    ……..generate page (PHP)

    // Topic page


    if (not logged in)

    ……..serve disk cache

    ……..if (disk cache not present)

    …………….generate page and save to disk

    else

    ……..generate page (PHP)

    // post a comment function


    delete Topic cache for non-logged in users

    delete Front page cache for non-logged in users

    The benefit being, now for any non-logged in user – the Front page and individual Topic pages will be cached once some submits a new comment.

    And if you are logged in, non of this effects you.

    tomwi
    Member

    right now I am using:

    echo "<li><a>topic_id."'>".$result->topic_title."</a>Posted by: <a>topic_poster."'>".$result->topic_poster_name."</a> in </li>";

    #65143
    chrishajer
    Participant

    Are the functions capitalized in the same manner? Windows doesn’t seem to care about capitalization, but Linux does. I’ve had that trouble with WordPress plugins before, where it seems the plugin was developed on Windows and the function was called

    function DoThis() {, so calling dothis() stops working on Linux where it was fine on Windows.

    Could that be a possibility?

    martenk
    Member

    Started running bbpress 1.0-Alpha6 recently on a productionsite… Probably a bad idea but everything seems to work… A few plugins that don’t work but other than that it’s all good! :)

    #71532
    joshposh
    Member

    I found out that the CSS class for the definition of the pagination was missing in the CSS file of the theme. I’ve added it but can’t figure out how to change the space between the page numbers. I tried padding, margin and letter-spacing and they all worked for the text (“next” & “previous”) but not for the page numbers :/

    EDIT: OK, works now but looks still stupid *sigh*

    http://f.imagehost.org/0960/p1.png

    #4735
    joshposh
    Member

    I can’t add links in posts properly :/

    When I try to add a link I do it like that:

    <a href="http://www.mysite.com/">My Site</a>

    but the link generated by bbPress in the post isnt linking to

    http://www.mysite.com/

    but to

    http://www.mysite.com/

    :(

    #70905
    walkerevans
    Member

    The forum isn’t “inside” the blog. The templates are all just set up to look the same across the site. :D

    #4733
    deadlyhifi
    Participant

    I would like to modify the bb_list_tags to show who the author of that tag was (to moderators)

    So I created a functions.php in my theme and have copied function bb_list_tags from functions.bb-templates.php file. And done the following (note the changes to the function have not yet been made)

    <?php
    // to override bb_list_tags to show tag author

    remove_filter('bb_list_tags', 'bb_list_tag');

    function bb_list_tag( $args = null ) {
    $defaults = array(
    'tags' => false,
    'format' => 'list',
    'topic' => 0,
    'list_id' => 'tags-list'
    );

    $args = wp_parse_args( $args, $defaults );
    extract( $args, EXTR_SKIP );

    if ( !$topic = get_topic( get_topic_id( $topic ) ) )
    return false;

    if ( !is_array($tags) )
    $tags = bb_get_topic_tags( $topic->topic_id );

    if ( !$tags )
    return false;

    $list_id = attribute_escape( $list_id );

    $r = '';
    switch ( strtolower($format) ) :
    case 'table' :
    break;
    case 'list' :
    default :
    $args['format'] = 'list';
    $r .= "<ul id='$list_id' class='tags-list list:tag'>n";
    foreach ( $tags as $tag )
    $r .= _bb_list_tag_item( $tag, $args );
    $r .= "</ul>";
    endswitch;
    echo $r;
    }

    add_filter('bb_list_tags', 'bb_list_tag');

    ?>

    Is this the correct way to change a core function? Changing anything within it doesn’t appear to override the original function.

    #71527
    chrishajer
    Participant

    I am going to take a SWAG:

    SimplePie supports RFC 822, RFC 2822, RFC 3339, and ISO 8601 datestamps. My guess is Magpie does as well. I would start by trying a RFC 2822 timestamp.

    Sat, 24 Jan 2009 08:09:12 -0500

    #4730
    joshposh
    Member

    [Sorry if this is the wrong place to ask, I couldn’t find a better one]

    I know it a lot to ask but could someone help me with a short piece of code please? I never worked with PHP and would like to insert a bit of HTML into a piece pf PHP. I would really appreciate any help.

    The Problem:

    I have some not so web savvy users at my board and I’d like to make the pagination of threads better to see for them.

    At the moment it’s kinda tiny and has no spaces between the page numbers for some strange reason.

    (Screenshot of how it looks at my board: http://f.imagehost.org/0070/toosmall.png)

    I guess I found the place to change it in the post-template.php

    $output = '';
    if ( $multipage ) {
    if ( 'number' == $next_or_number ) {
    $output .= $before;
    for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
    $j = str_replace('%',"$i",$pagelink);
    $output .= ' ';
    if ( ($i != $page) || ((!$more) && ($page==1)) ) {
    if ( 1 == $i ) {
    $output .= '<a href="' . get_permalink() . '">';
    } else {
    if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
    $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
    else
    $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
    }

    }
    $output .= $link_before;
    $output .= $j;
    $output .= $link_after;
    if ( ($i != $page) || ((!$more) && ($page==1)) )
    $output .= '</a>';
    }
    $output .= $after;
    } else {
    if ( $more ) {
    $output .= $before;
    $i = $page - 1;
    if ( $i && $more ) {
    if ( 1 == $i ) {
    $output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
    } else {
    if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
    $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
    else
    $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
    }
    }
    $i = $page + 1;
    if ( $i <= $numpages && $more ) {
    if ( 1 == $i ) {
    $output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
    } else {
    if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
    $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
    else
    $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
    }
    }
    $output .= $after;
    }
    }
    }

    if ( $echo )
    echo $output;

    return $output;
    }

    And I would like to change the visual output to this

    <p><strong>  Next Page ></strong></p>

    for “Next”

    and

    <p><strong><  Previous Page  </strong></p>

    for “Previous”

    Thanks for your time :)

    [and please excuse my poor English xD]

    #4725
    bean_zj
    Member

    After a successful installation, the main page shows as follow:

    ” You must specify a table prefix in your bb-config.php file. “

    I AM sure my config.php has defined table prefix as follow:

    ” $bb_table_prefix = ‘bb_’; “

    after I add the code, my main page shows as follow:

    ” $bb_table_prefix = ‘bb_’;You must specify a table prefix in your bb-config.php file. “

    What is going wrong?

    #71036
    mrc2407
    Member

    Ipstenu: I still have the same problem. I’ve checked if KEY strings matched, and they do.

    WP KEY:

    define('AUTH_KEY', 'this is my key');

    bbPress KEY:

    define('BB_AUTH_KEY', 'this is my key');

    I’ve tried th change “BB_AUTH_KEY” (bbPress KEY) to “AUTH_KEY”, but it still doesn’t work…

    _ck_
    Participant

    Looks like the forum ate your code but to display the forum name when you only have the id, you can use the built in bbpress functions

    echo get_forum_name($result->forum_id);

    or

    echo "Posted by $result->topic_poster_name in ".get_forum_name($result->forum_id);

    or

    echo "Posted by <a href='".bb_get_profile_link($result->topic_poster)."'>$result->topic_poster_name</a>
    in <a href='".get_forum_link($result->forum_id);."'>".get_forum_name($result->forum_id)."</a>";

    tomwi
    Member

    also, I got this far… just not sure how to get the forum name, since only the forum ID is listed in this table… not sure how I pull the otehr table and combine the two.

    echo "
    <li><a>topic_id."'>".$result->topic_title."</a>Posted by: ".$result->topic_poster_name.".</li>
    ";

    #64929
    martenk
    Member

    As for linking to the forum from the blog like as if it was a page it’s just a matter of installing this plugin: http://txfx.net/code/wordpress/page-links-to/

    Works great.

    #4727

    Topic: Adding Theme Pages

    in forum Themes
    slambert1971
    Member

    I have bbPress 0.9.0.4 up and running and have heavily modified a theme to change the front page, and forum pages. Here is my hierarchy:

    Front Page – displays only the top level forums (Parent), but also display sub forums descriptions (Group), then the sub forums of each group (Child) are listed and linked. Looks really cool and is exactly what we need for a project I am working on. I have modified the forum.php to check what type of forum it is (Parent, Group, Child) and load the correct file.

    Now, I would like to have a “Hot Topics” page where any item set as “sticky to the top” will list just like they would normally list on the standard home page. Is there a way to set bbpress to load a non-standard file, so like /bbpress/hot-topics.php, which is actually the original forum.php

    Hope that hasn’t confused anyone. I have looked around at all the bbPress code to find a hook, action or filter for this, but can’t seem to find it. Thanks.

    #58922
    Ben L.
    Member

    Delete the plugin, just put <input name="remember" type="hidden" id="quick_remember" value="1" /> in your login-form.php file.

    #71520
    joshposh
    Member

    Hm, I don’t know if I have PHP error logs somewhere to be honest, I’m not that good with that stuff, sorry xD

    I just looked into the cPanel of my Server and it has a few logs but nothing related to PHP.

    Ah, well, it’s not that important anyways since everything is actually working as far as I can tell, I just thought I could ask if it’s a bug or feature ;)

    #4706

    This isn’t a plugin, it’s a ‘hack’ but I can’t think of where else to put this.

    I have blog posts (duh) and I have forum topics that, sometimes, relate. I wanted to have a way to relate the blog posts to say ‘Comment here’ and ‘Forum chat here.’

    The solution is stupid easy. I made a custom field in my blog (forum_topic) and then added this to the link with my comments link:

    <?php $forum= get_post_meta($post->ID, 'forum_topic', true); if ($forum) : ?><a href="<?php echo $forum; ?>">Forum Topic</a>

    And now if there’s a related forum topic, I make the custom field, add the link in that field for the post, and it shows up. No topic? No link!

    Now if I can do that in reverse, that would be cool… related blog posts to this forum topic.

    #71488
    virginiagirl
    Member

    You’re right – I think when I hid the top header it also removed the Login/Logout buttons. Do you know what code in the PHP file controls these buttons? I know I didn’t delete any of the PHP code, I just applied display:none to the CSS file.

    #4704
    Tom Lynch
    Participant

    I have recently migrated my entire phpBB over to bbPress and now want to move the bbPress users into wordpress mu so I can use wordpress integration the problem was that there is no easy way to migrate and check the users aren’t doubling up…

    I wrote a simple php script to do just that and it allowed me to list out the users where manual attention is required, it can be run just from the command line like this…. ‘php -f file.php’ and will move the users over perfectly (at least for me)…

    Note there has been no testing of this code it worked for me and may cause you issues, back up your database first!

    Comments on the code appreciated for future improvement.

    ‘<?php

    echo “n”;

    echo “+


    +n”;

    echo “| bbPress to WordPress User Migration |n”;

    echo “+


    +n”;

    echo “| Created by: |n”;

    echo “| Tom Lynch |n”;

    echo “+


    +n”;

    echo “n”;

    echo “Messages:n”;

    echo “n”;

    echo “Username Messagen”;

    echo ”



    n”;

    function printSpaces($username) {

    $spaces = 25 – strlen($username);

    echo $username;

    for ($i = 0; $i < $spaces+1; $i++) {

    echo ” “;

    }

    }

    // Enter your database host, username and password here…

    mysql_connect(‘localhost’, ‘username’, ‘password’);

    // Enter your database name here (both tables must be in same database – sorry)

    mysql_select_db(‘database’);

    $migrated = 0;

    $errors = 0;

    $query = mysql_query(“SELECT user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name FROM bb_users WHERE user_pass LIKE ‘$P$B%’;”);

    while ($data = mysql_fetch_assoc($query)) {

    $query2 = mysql_query(“SELECT user_login, user_email FROM wp_users WHERE user_login = ‘”.$data.”‘ || user_email = ‘”.$data.”‘;”);

    if (mysql_num_rows($query2) > 0) {

    $data2 = mysql_fetch_assoc($query2);

    if ($data == $data2 && $data == $data2) {

    // Suppressing already migrated users error

    //echo printSpaces($data) . ” has already been migrated by the looks of it!n”;

    } else if ($data == $data2) {

    echo printSpaces($data) . ” could not be migrated, that user name is already taken! (“.$data.”)n”;

    $errors++;

    } else if ($data == $data2) {

    echo printSpaces($data) . ” could not be migrated, that email address is already taken! (“.$data.”)n”;

    $errors++;

    }

    } else {

    mysql_query(“INSERT INTO wp_users (user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_status, display_name) VALUES (‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘, ‘” . $data . “‘);”);

    // Suppressing user migrated message

    //echo $data . ” was migratedn”;

    $migrated++;

    }

    }

    $alreadyDone = ((mysql_num_rows($query) – $errors) – $migrated);

    echo “n”;

    echo “Stats:n”;

    echo “n”;

    echo “Users Migrated: ” . $migrated . “n”;

    echo “Already Migrated: ” . $alreadyDone . “n”;

    echo “Not Migrated: ” . $errors . “n”;

    echo “=======================================n”;

    echo “Total: ” . mysql_num_rows($query) . “n”;

    echo “n”;

    ?>’

    #71496
    Andrew
    Member

    Additional info:

    Following the error, the page displays fine with the exception of user roles and the link to the user profile. All are listed as invalid, with the exception of the user that is logged in.

    The malformed SQL request is listing the user ID’s in the thread. The ID’s are in order of post appearance. Once an anonymous post is in the sequence it fails to insert the userID.

    Another example is below:

    SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (17,23,1,18,) /* WP_Users::append_meta */

    The fifth post in the topic is an anonymous poster with no corresponding wp_user or wp_usermeta information but it appears a null is inserted in the request rather than the legacy user ID.

    If I look into the database and examine topics and posts made by anonymous users the legacy user ID’s are there. bb_posts has the old user IDs for the posts made by deleted users . Somehow, this data isn’t making it into the request.

Viewing 25 results - 25,826 through 25,850 (of 32,495 total)
Skip to toolbar