Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'test'

Viewing 25 results - 10,676 through 10,700 (of 11,524 total)
  • Author
    Search Results
  • #52666
    _ck_
    Participant

    Whoops, I bet there were some situations I didn’t test for.

    Will investigate… (and she‘ll fix ’em asap)

    #56418

    In reply to: Freshness Linked

    citizenkeith
    Participant

    Ok, I finally got around to some testing. I have disabled almost all plugins and recounted… still the same behavior. However, I was unable to disable “Online List” and “BBPress Private Messaging” because it broke the admin console. So there’s a chance that one of those plugins might be causing this strange behavior.

    #51582
    outchy
    Member

    yes, good call:

    <?php
    $latestpost = $bbdb->get_row("
    SELECT *
    FROM $bbdb->posts
    WHERE post_status = 0

    ORDER BY post_time DESC
    LIMIT 1

    ");
    ?>

    Re:
    <a href="<?php echo get_topic_link($latestpost->topic_id); ?>"><?php echo get_topic_title($latestpost->topic_id); ?></a>:<br /><br />

    <a href="<?php user_profile_link($latestpost->poster_id); ?>"><?php echo get_user_name($latestpost->poster_id); ?></a> said:

    <?php echo $latestpost->post_text; ?>

    #59544
    _ck_
    Participant

    Er, wait a minute. This new view registation method takes away massive potential from views.

    For example you can’t manipulate the data before and/or after the BB_QUERY.

    Here’s how I find “most viewed” and “least viewed” topics and create new views for them. How the heck is this even remotely possible with the new method? The new method also takes away all natural mysql query methods, making things much more complicated and easier to make mistakes on query configuration.

    function most_views( $view ) {
    global $bbdb, $topics, $view_count;
    if ($view=='most-views') {$sort="DESC";}
    if ($view=='least-views') {$sort="ASC";}
    if ($view=='least-views' || $view=='most-views') {
    $limit = bb_get_option('page_topics');
    $where = apply_filters('get_latest_topics_where','');
    $most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) $sort LIMIT $limit");
    foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
    $topics ="SELECT * FROM $bbdb->topics WHERE topic_status=0 AND topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
    $topics = $bbdb->get_results($topics);
    $view_count = count($topics);
    $topics = bb_append_meta( $topics, 'topic' );
    }}

    .

    Absolutely no way to do that purely though BB_QUERY, at least to my limited knowledge. You’d have to hook BB_QUERY and check for what it’s doing on every call and that’s nasty.

    #59543
    _ck_
    Participant

    Sigh, I guess I’ll tempt fate and install the latest trunk. Though I know it’s going to instantly break half a dozen plugins or more, so I need to do that when I have a full night to dedicate to it.

    I really like “views” and keep thinking of more helpful ones I can create that drill down through the data.

    You should enquire about the development priorities and directions on the bbPress dev list though, you may get more joy there.

    I find it somewhat hilarious that a *forum* development team uses a mailing list for group communications. The year 2000 called – it wants it’s static email posts back!

    #59566
    _ck_
    Participant

    Since there’s no real way to cache bbpress as static pages like wordpress (and not that there ever really can be, defeats the purpose) if you plan to have anything bigger than a “micro-forum” it’s important your host has mysql caching and optionally but recommend, some kind of php opcode cache (ie. eaccelerator)

    Otherwise you’ll be getting emails from your host about your account creating all of the mysql load, etc.

    The problem is I think most hosts do not have the two features I mentioned enabled. At least most shared hosting that’s done on cpanel “out of the box” on defaults. They have to be a bit more tech-savvy. And then if they are that clever, sometimes they will “oversell” the box thinking it can do more work than average.

    Last but not least, on all shared hosting and VPS, you can have great performance for the moments you test it, but then a “bad neighbour” comes along and your performance will become quite bad for no reasons of your own, until the host does something about it, which can be days. Sometimes even the host can make poor decisions that will cripple your site, like backing it up during times of higher activity or allowing the statistics programs to run on dozens of clients at the exactly same time.

    I wish I could afford dedicated hosting myself! Solves most of these problems. But spending $100 per year instead of $100 a month is no contest.

    ps. 2.490 – 8 queries is not good at all if you are expecting high traffic – I have mysql cache and opcode cache and get always get under 0.300 for 10-30 queries no matter how many visitors. But I suspect I pay much more for my hosting. My guess is there’s definitely no mysql cache on there or you are paying very very little for that hosting.

    #51580
    outchy
    Member

    excellent! i got it to work with this just before i checked back for your reply:

    <a href="<?php echo get_topic_link($latestpost->topic_id); ?>"><?php echo get_topic_title($latestpost->topic_id); ?></a>

    i think i understand it better now, thanks again! :D

    #51579
    fel64
    Member

    That’s great! Passing parameters is just giving the function some data to work with.

    $latestpost->topic_id is the topic ID. There are probably some functions like topic_title() and link_to_topic() or similar that you can use to get the title and link. They too will need the topic ID passed as a parameter, so if those are the actual functions it could be topic_title( $latestpost->topic_id ); :)

    #51578
    outchy
    Member

    wait, i got this to work to display the name:

    <?php echo get_user_name($latestpost->poster_id); ?>

    and this to make it into a link to the person’s profile:

    <a href="<?php user_profile_link($latestpost->poster_id); ?>"><?php echo get_user_name($latestpost->poster_id); ?></a>

    now all i need is to display the topic title and make it a link … i need help with this one please :)

    #2187
    riddle
    Member

    I’m in the process of setting up a bbPress installation (my first) at a new hosting provider (also my first time with them).

    Subjectively, things seem a bit slow. Is there a tool for testing response time on a generic PHP hosting provider? Maybe a PHP app for very gentle stress testing?

    Failing that, what sort of response time should be considered normal in bbPress’s self report in the comments at the bottom of the page? My top page currently says, “2.490 – 8 queries.” (That’s with a nearly-empty database.)

    If there are serious problems with this host, I’d like to figure it out now, before I get settled in and launch.

    Thanks.

    #59450
    _ck_
    Participant

    Oh if you are trying to do it from an integrated WordPress you’ll need to do this:

    <?
    if function_exists("get_currentuserinfo") {global $user_ID;}
    else { $user_ID=bb_get_current_user_info( 'id' )}
    if ($user_ID) { echo '<a href="/forums/profile.php?id='.$user_ID.'&tab=favorites">favorites</a>';} ?>

    untested – change /forums/ to whatever your bbpress path is.

    #51574
    outchy
    Member

    yes, that worked, thank you.

    i’m going through the template-functions.php trying to find how to display the last poster’s username and his/her profile link, as well as the link to the topic itself but the only ones i can get to work are these:

    <?php echo $latestpost->post_text; ?>

    <?php echo $latestpost->poster_id; ?>

    <?php echo $latestpost->post_time; ?>

    any suggestions? :)

    #59539
    Sam Bauers
    Participant

    > Any idea what I could be doing wrong here?

    Are you using the latest trunk or the standard 0.8.2.1 release?

    Latest trunk won’t work with the above code.

    #59244
    _ck_
    Participant

    Web compression is on an “offered/accepted” handshake of sorts.

    It would not affect clients that do not support gzip.

    Everytime IE or Firefox (etc.) requests a webpage, it tells the server “I support gzip” in the headers and then if the server supports it, it sends it that way.

    Technically compression can be forced through the server – if trac is under the same litespeed server as wordpress/bbpress then it’s just a matter of making sure it’s enabled.

    A quick test shows both the svn+trac are using apache, so depending on which version it’s either a matter of building with mod_gzip (for apache 1.3.x) or if apache 2.0 they need to just add a couple of easy httpd.conf directives.

    Really though, Matt knows how good litespeed is over apache, both the trac+svn should on litespeed. I bet it could even work with the free 150 connection version instead of buying a license.

    #59532
    _ck_
    Participant

    Ugh. So that breaks a view things I’ve done.

    I’m waiting for an addition to the plugin svn and I’ll just update there at this point. I also missed checking if the user is logged in, now fixed.

    I don’t run the newest trunk so I don’t have a way to test. Looks like I’ll have to setup a test account and install it again.

    and I just put the finishes on a nice dropdown view box too… :-(

    function views_dropdown() {
    $views_dropdown='<form name="views_dropdown" id="views_dropdown">
    <select size=1 name="views_dropdown_select" onchange="if (this.selectedIndex != 0) {location=this.options[this.selectedIndex].value;}}">
    <option value="#">SHOW ME
    > </option>';
    $views=get_views(); foreach ($views as $view => $title ) {
    $views_dropdown.='<option value="'.get_view_link($view).'">'.$views[$view].'</option>';
    }
    $views_dropdown.='</select></form>'; echo $views_dropdown;
    }

    #59531
    Sam Bauers
    Participant

    You should be aware that views are registered differently in the latest versions in trunk. Views are now constructed using the BB_Query class.

    See the latest Support Forum plugin for a way to use both the new and old, although it is wrapped in a Class in there so the basic idea is:

    if (is_callable('bb_register_view')) { // Build 876+
    $query = <SOME ARRAY ACCEPTABLE TO BB_QUERY>;
    bb_register_view('myview', __('My view name'), $query);
    } else { // Build 214-875
    add_filter('bb_views', 'my_addView');
    add_action('bb_custom_view', 'my_processView');
    }

    #59030
    _ck_
    Participant

    Oh figured out how to fix the moderator’s profile, very easy to do when using my additional function – just attached more “where filters”:

    function private_forums_filter_private($where,$prefix=''){
    if (function_exists("private_forums_custom_get_options")) {
    $private_forums = private_forums_custom_get_options('private_forums');
    foreach($private_forums as $forum => $role) {
    if(!private_forums_check_user_access_to_forum($role)) {
    $where.=" AND ".$prefix."forum_id != ".$forum." ";
    }
    }
    }
    return $where;
    }
    add_filter( 'get_latest_topics_where', 'private_forums_filter_private');
    add_filter( 'get_latest_posts_where', 'private_forums_filter_private');
    add_filter( 'get_recent_user_replies_where', 'private_forums_filter_private');
    add_filter( 'get_recent_user_threads_where', 'private_forums_filter_private');

    #59528
    _ck_
    Participant

    I haven’t seen them (doesn’t mean it doesnt exist) but I’ve figured out the framework on how to build and attach a view if you’d like to copy my homework :D

    This is the code I whipped up for “most-views” and “least-views” (which requires the view count plugin to be installed (and inserting the views column in view.php)

    function most_views_views( $views ) {
    global $views;
    $views['most-views'] = 'Topics with the most views';
    return $views;
    }
    add_filter('bb_views', 'most_views_views');

    function least_views_views( $views ) {
    global $views;
    $views['least-views'] = 'Topics with the least views';
    return $views;
    }
    add_filter('bb_views', 'least_views_views');

    function most_views( $view ) {
    global $bbdb, $topics, $view_count;
    if ($view=='most-views') {$sort="DESC";}
    if ($view=='least-views') {$sort="ASC";}
    if ($view=='least-views' || $view=='most-views') {
    $limit = bb_get_option('page_topics');
    $where = apply_filters('get_latest_topics_where','');
    $most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) $sort LIMIT $limit");
    foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
    $topics ="SELECT * FROM $bbdb->topics WHERE topic_status=0 AND topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
    $topics = $bbdb->get_results($topics);
    $view_count = count($topics);
    $topics = bb_append_meta( $topics, 'topic' );
    }
    else {do_action( 'bb_custom_view', $view );}
    }
    add_action( 'bb_custom_view', 'most_views' );

    As you can see a new view requires both 1. an action 2. a filter

    Easy once you’ve seen it, but try figuring it out from scratch!

    This bit adds the title to view pages (missing by default in bbpress)

    function bb_get_view_title($title) {
    if (is_view()) {$title = get_view_name(). ' &laquo; ' . bb_get_option( 'name' ); }
    return $title;
    }
    add_filter( 'bb_get_title', 'bb_get_view_title' );

    #59475
    Sam Bauers
    Participant

    This is fixed in the latest trunk. I believe, the WordPress tag closing function has been moved across to bbPress.

    #51572
    outchy
    Member

    ok cool, thank you. it’s doing something so that’s good :)

    this is what i’m using:

    <?php
    $latestpost = $bbdb->get_row("
    SELECT *
    FROM $bbdb->posts
    WHERE post_status = 0
    LIMIT 1
    ");
    ?>

    <?php echo $latestpost->post_text; ?>

    it’s displaying the first post from forum 3 for some reason, not the most recent post. i’ve posted a few new posts since then in other forums and it never changes on the front page, it still shows that first post from that forum 3. any idea how come?

    (thanks for your help on this)

    #51571
    fel64
    Member

    Sure that’s possible. :)

    You want a query that gives you the last post. Forget anything messing around with the forum or the topic. You want the last post, right?

    There’s no API function to do this AFAIK, so you will have to use a query. I think the structure could go something like this:

    $latestpost = $bbdb->get_row("
    SELECT *
    FROM $bbdb->posts
    WHERE post_status = 0
    LIMIT 1
    ");

    And then $latestpost has $latestpost->post_text, poster_id and so on. But unfortunately not filtered, so you’d need to apply all those. Which is a bit nasty.

    But this is all unchecked and unresearched, you’ll need to play around with it. :P All this is is a bare start.

    #51569
    fel64
    Member

    $forum_one_topics is not an array which is why it’s failing (although I’m surprised it’s not).

    Do you actually want the 1 latest topic from forum 1? Then use $bbdb->get_row() instead of get_results() and stop treating it as an array (basically, just take out the foreach part since you don’t have several, and replace $topic with $forum_one_topics).

    If you want all the topics from forum one, then take out the LIMIT 0, 1 bit from the query which as I understand it would give you only one result.

    Also, you have some malformed HTML just under span gray.

    #59520

    In reply to: subforums and markup

    fel64
    Member

    fel64, the string is internal to bbpress, not the template loop.

    Fair enough, shoulda checked that. So I went and looked through the code, you know, to find the problem. bb has quite an interesting structure there. Couldn’t find the problem, though, so I looked at the code in the .8.2.1 version and it’s missing a bit.

    It’s fixed in trunk. Claire, upgrade to the latest version and it’ll work just fine.

    #51568
    outchy
    Member

    sure, here is line 13:

    foreach($forum_one_topics as $topic) :

    and here is the surrounding stuff:

    <h2><?php _e('Latest Post'); ?></h2>

    <?php
    $forum_id = 1;
    $forum_one_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id ORDER BY topic_time DESC LIMIT 0,1") ?>
    <?php
    foreach($forum_one_topics as $topic) :
    $forum_one_topic_posts = get_thread( $topic->topic_id); ?>
    Re: <a>"><?php topic_title(); ?></a>

    <span class="gray">
    <a>">
    <?php echo $topic->topic_last_poster_name; ?></a> said:</span> <span class="justify"><?php echo $forum_one_topic_posts[0]->post_text;
    endforeach;
    ?></span>

    #59511

    In reply to: subforums and markup

    _ck_
    Participant

    If you mean so topics in sub-forums do not show up on “latest discussions” I whipped this up to solve that:

    function filter_front_page_topics($where){
    // $exclude_forums=array ("8"); // enable this to manually specify specific forums by id #
    $forums = get_forums(); foreach ($forums as $forum) {if ($forum->forum_parent) {$exclude_forums[]=$forum->forum_id;}} // exclude ALL sub-forums
    if ( is_front()) {foreach($exclude_forums as $forum) { $where.=" AND forum_id != ".$forum." "; }}
    return $where;
    }
    add_filter( 'get_latest_topics_where', 'filter_front_page_topics');
    add_filter( 'get_latest_posts_where', 'filter_front_page_topics');

Viewing 25 results - 10,676 through 10,700 (of 11,524 total)
Skip to toolbar