hatter (@hatter)

Forum Replies Created

Viewing 7 replies - 26 through 32 (of 32 total)
  • In reply to: Post_Text Front Page

    @hatter

    Member

    If I understand correctly, you are trying to get the first post of the topic in its entirety. If that is the case, use the function bb_get_first_post to get the first post for the topic, which is what is used by the RSS feed. Then, use the post_text function to get the text for the post based on post_id. Using your example above, you would use:

    $post = bb_get_first_post(get_topic_id());

    $post_text = post_text($post->post_id);

    Whenever you can, you should use the built in functions instead of calling the db directly, unless you have a valid reason for doing so. When you use the built in functions, the appropriate filters are called so that any installed plugins can work (One example would be adding rel=no-follow, or target=blank within your links). Only if you are trying to avoid running the plugins, or you are doing something completely custom, should you not use the built in functions.

    In reply to: A question about icons

    @hatter

    Member

    If you’re trying to get the user for the current post in post.php, you might want to use:

    $user=bb_get_user(get_post_author_id());

    This should get the user for the current post author. Then you can loop through the roles.

    In reply to: User does not exist

    @hatter

    Member

    Are you getting any errors in the error log?

    @hatter

    Member

    You can use the bbPress-Wordpress Syncronization plugin for this, found at http://bobrik.name/code/wordpress/wordpress-bbpress-syncronization/. We are currently running bbPress 1.0.2 and WordPress 2.8.5 and have no issues.

    @hatter

    Member

    I should change that to say, 10 seconds for a connection, not a query. Occasionally when the server is under heavy load due to a lot of users, the total time used on a connection may exceed 10 seconds, causing this issue.

    In reply to: Intergration problem?

    @hatter

    Member

    Make sure your cookies are set properly and match between bbPress and WordPress. Usually, if you have to login when going between the two, the cookies don’t match. Also, when testing this, make sure you delete old cookies from your system as they may be causing a conflict.

    In reply to: PHP Warning: parse_url

    @hatter

    Member

    I pasted the code with an error in it. Use this function instead:

    function bb_get_path( $level = 1, $base = false, $request = false ) {

    if ( !$request )

    $request = $_SERVER;

    if ( is_string($request) )

    {

    // parse_url throws a warning for a url that has http:// as a query parameter and doesn’t start with http://

    $pos = strpos($request, “http://”);

    // Check if we found http:// in the string and it’s not at the beginning, and the url starts with a forward slash

    if ($pos !== false && $pos > 0 && substr($request,0,1) == “/”)

    {

    // We got here, so it’s not at the beginning and is in the url. Add in the domain to the beginning

    $oldRequest = $request; // Use a new variable since some PHP versions don’t like re-assigning

    $request = “http://”.$_SERVER[“HTTP_HOST”].$oldRequest;

    }

    $request = parse_url($request);

    }

    if ( !is_array($request) || !isset($request) )

    return ”;

    $path = rtrim($request, ” tnrx0B/”);

    if ( !$base )

    $base = rtrim(bb_get_option(‘path’), ” tnrx0B/”);

    $path = preg_replace(‘|’ . preg_quote($base, ‘|’) . ‘/?|’,”,$path,1);

    if ( !$path )

    return ”;

    if ( strpos($path, ‘/’) === false )

    return ”;

    $url = explode(‘/’,$path);

    if ( !isset($url[$level]) )

    return ”;

    return urldecode($url[$level]);

    }

Viewing 7 replies - 26 through 32 (of 32 total)