Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,501 through 29,525 (of 32,481 total)
  • Author
    Search Results
  • #59537
    howtogeek
    Member

    I activated this plugin, but when I click on the link for “topics i’ve started”, all I get is a white page… looking at a sql trace, it doesn’t appear to be running the code at all.

    Any idea what I could be doing wrong here?

    #59558
    fel64
    Member

    Not a problem as long as you have access to the databases. :) Open phpMyAdmin through your administration panel of your web hosting account, go to your database, open wp_usermeta and then click the ‘Search’ tab. Put into the “search conditions” field user_id = 1 AND meta_key = 'bb_capabilities' (this should be the user_id of your admin account). Edit the (hopefully) one result that comes up, and change the meta_value to a:1:{s:9:"keymaster";b:1;}. Then you should be keymaster.

    #59327
    Sam Bauers
    Participant

    Apache processes rewrite directives in the order they are found.

    First the main Apache config file is used, then (if they are allowed) the .htaccess files are used in the order they are encountered from the root of the website out through the directories until the final directory that contains the file that is being accessed.

    So if you have a page at http://www.example.com/blog/forum, then the order of processing is like:

    Apache config
    |
    +-> /path/to/site/www.example.com/.htaccess
    |
    +-> /path/to/site/www.example.com/blog/.htaccess
    |
    +-> /path/to/site/www.example.com/blog/forum/.htaccess

    So the “blog” rewrite rules will be assessed first. This means that you may want to place your bbPress rewrite rules in the same .htaccess file as your blog rules, before the blog rules, as they are more specific and should be handled first.

    Also, there were some problems with WordPress throwing 404 errors based on what mod_rewrite was doing. This was specifically with version 2.1 I think, so your WordPress may need to be upgraded.

    #49633

    In reply to: Emoticons For bbPress?

    fel64
    Member

    It’s Javascript. PHP files are just like HTML files, and anything outside the <?php ... ?> is treated as HTML. Calling the particular function around that makes it go to that place and then go through and output the HTML (which happens to be JS).

    #59534
    Sam Bauers
    Participant

    > is there a method way to delete a view

    In current trunk…

    bb_deregister_view( $view )

    #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');
    }

    #49632

    In reply to: Emoticons For bbPress?

    mazdakam
    Member

    hi again i want to know why the function grin(tag) { is out of php code

    why it need to be out side?

    #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');

    #59530
    _ck_
    Participant

    Wow I was making it too complicated! Try this…

    I managed to use internal functions but there’s a catch with get_recent_user_replies in that all topic data is not attached properly so I have to run through get_topic to pull all the cache data out again (the only proper way to do it without peeking in the cache directly)

    <?php
    /*
    Plugin Name: my views
    Description: views for a user's topics started and other participated topics
    Plugin URI:
    Author:
    Version: 0.01
    */

    function my_views_filter( $views ) {
    global $views;
    $views['my-topics'] = "Topics I've Started";
    $views['my-posts'] = "Topics I've Participated In";
    return $views;
    }
    add_filter('bb_views', 'my_views_filter');

    function my_views_action( $view ) {
    global $bbdb, $topics, $view_count; $user_id=bb_get_current_user_info( 'id' );
    if ($view=='my-topics') {$topics=get_recent_user_threads($user_id); $view_count = count($topics);}
    if ($view=='my-posts') {
    $posts=get_recent_user_replies($user_id); $topics="";
    foreach ($posts as $post) {$topics[]=get_topic($post->topic_id );}
    $topics=bb_append_meta( $topics, 'topic' );
    $view_count = count($topics);}
    }
    add_action( 'bb_custom_view', 'my_views_action' );

    if (!function_exists(bb_get_view_title)) {
    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' );
    }

    ?>

    #59476
    mazdakam
    Member

    hummm i am listeing to good news :)

    #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' );

    #59243
    Sam Bauers
    Participant

    My other option is to make the update check more atomic. Here, your pagination idea could help. So instead of fetching all the plugins, I could just fetch the first page, then the second etc. etc. on request. More complicated to code, but it might be the best long term solution to keep the best of both worlds. I could also add a way to list installed plugins first, or even have a separate view of installed plugins.

    I wouldn’t think Trac is faster, it has a few more overheads on the server side I think. I don’t think it will come down to that though.

    Neither the Trac site nor the SVN repository use compression on their output, so gzip is useless, but that was a good suggestion. I’m not sure the SVN repository could use gzip anyway as it would potentially get in the way of some SVN clients, I’m not sure SVN even supports compression techniques like that (although it probably should).

    #51573
    Sam Bauers
    Participant

    You’ll need to order that query by using ORDER BY post_time DESC. There is no guarantee that the last row of a table is the last row that was added.

    #59474
    _ck_
    Participant

    Auto closing formatting is being worked on by mdawaffe now I believe.

    It’s a single boolean bug (true/false) so I should hope it doesn’t take too long ;-)

    #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.

    #51570
    outchy
    Member

    i want to display the most recent post, no matter what forum it happens to be from. is that possible?

    i tried doing what you said but maybe i messed it up because i’m getting a mysql syntax error. here is what i have, forgive me if it looks glaringly stupid:

    <?php
    $forum_id = 1;
    $forum_one_topics = $bbdb->get_row("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id ORDER BY topic_time DESC ") ?>
    <?php
    $forum_one_topic_posts = get_thread( $forum_one_topics->topic_id); ?>
    Re: <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a>
    <span class="gray">
    <a href="<?php get_user_profile_link( $id = 0, $page = 1 ); ?>">
    <?php echo $forum_one_topics->topic_last_poster_name; ?></a> said:</span> <span class="justify"><?php echo $forum_one_topic_posts[0]->post_text;
    ?></span>

    sorry, i’m really trying to get it :/

    #59500
    refueled
    Member

    @moopress: Thanks for the comments.

    @fel64: Forgot about that sticky-green. Changed it to a temporary color. I was wanting to do something different, that’s why it’s not a fixed width theme. It can always be changed later.

    Thanks again for both of your comments. More are welcome. :-)

    #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>

    #59432
    _ck_
    Participant

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

    Look at forum.php template to remind yourself

    <?php while ( bb_forum() ) : ?>
    <tr<?php bb_forum_class(); ?>>

    $forum is being treated as a global and not reset back.

    I could remember and reset $forum I guess before and after the while-loop $temp=$forum; loop-here; $forum=$temp; but that’s an ugly hack. It’s got to be fixed in the core and that’s beyond my knowledge of bbpress.

    #59516

    In reply to: subforums and markup

    _ck_
    Participant

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

    Look at forum.php template to remind yourself

    <?php while ( bb_forum() ) : ?>
    <tr<?php bb_forum_class(); ?>>

    $forum is being treated as a global and not reset back.

    I could remember and reset $forum I guess before and after the while-loop $temp=$forum; loop-here; $forum=$temp; but that’s an ugly hack. It’s got to be fixed in the core and that’s beyond my knowledge of bbpress.

    #59513

    In reply to: subforums and markup

    fel64
    Member

    Yup. Just don’t display the forum if $forum->forum_parent is true. Change the bit in your templates that goes like this:

    <?php foreach( $forums as $forum ) : ?>
    //blaaaaah HTML
    <?php endforeach; ?>

    to this sort of thing:

    <?php foreach( $forums as $forum ) :
    if( !$forum->forum_parent ) { ?>
    //blaaaaaah HTML
    <?php }
    enforeach; ?>

    (ugh colon syntax)

    [Edit] Beat me to it ck (by the way, blockquote is already allowed and you’re overwriting it. Doesn’t really matter but could add conflict problems if someone wants to allow it to have attributes). Claire, worth mentioning that this method means it will ignore any subforums without you having to tell it it’s a subforum.

    Claire, markup is like this:

    <anytag> your text here </anytag>

    so actually HTML tags go between < and >. Actual code, like php code, will be shown as code if you put backticks around it. :)

    You can also use a simplified markup like http://www.loinhead.net/files/felise (just copy that into a plugin file and activate), which means that *this* is bold, _this_ italic and this@someurl turns into <a href="someurl">this</a>, etc. More on that https://bbpress.org/forums/topic/markdown?replies=10

Viewing 25 results - 29,501 through 29,525 (of 32,481 total)
Skip to toolbar