Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 27,626 through 27,650 (of 32,453 total)
  • Author
    Search Results
  • #3362
    ipsource
    Member

    Sorry I’m new and I tried to look around for this topic but I guess I’m not wording it right in the search.

    I want to make BBPress a page on my WordPress site. I’ve installed both and they are both sharing information just fine. I just want to integrate it visually into my site.

    So is there anyway that when you click “forum” on my Navigation bar that the forum would just show up in the window below?

    Again, I’m pretty new to this so when I have to go in and start messing with code I get lost easily. I really would appreciate any advice or help you can give. Thank you.

    #60387
    mrhoratio
    Member

    I discovered another issue with this hack. If you write a new post in a new topic, after the submitting the form, you are redirected back to the forum’s front page, instead of the forum you were on. I spent some time digging around the get_post_link() related functions, and couldn’t figure out exactly what was going on. However, I was able to make this modification to the bb-post.php file to get it to redirect properly.

    Paste this after line 43, in bb-post.php of bbPress 0.9.0.2

    $link = str_replace('forums/', "forums/". $forum->$topic_slug, $link);

    #64781
    mrhoratio
    Member

    Hey Sam, thanks for making a ticket for this. I was able to query for topics within a date from directly from WordPress as well. Here’s something I wrote to merge “super sticky” bbPress topics into the WordPress loop. It’s a bit of hack, but it brings the “Promote to Front Page” functionality of Drupal into WordPress/bbPress:

    <?php get_header(); ?>

    <?php

    //Put WordPress posts into an array
    $wp_posts = $posts;

    if (!is_single()){

    //Retrieve first post of previous page (we need this post's date to query bbPress topics
    $offset=$paged*$posts_per_page+$posts_per_page;
    $first_post_of_previous_page = get_posts('numberposts=1&offset='.$offset);

    //First set the start and end dates to limit the query to the bbPress table
    $startdate=(date('YmdHis',strtotime($first_post_of_previous_page[0]->post_date_gmt)));

    //If it's the most recent page, set end date to today
    if ($paged){
    $enddate=(date('YmdHis',strtotime($wp_posts[0]->post_date_gmt)));
    } else {
    $enddate=gmdate('YmdHis');
    }

    //Retrieve "Super Sticky" topics from bbPress tables
    //This assumes your bbPress and WordPress tables are in the same database
    $bb_topics = $wpdb->get_results("SELECT * FROM bb_topics WHERE topic_sticky = 2 AND topic_start_time BETWEEN $startdate AND $enddate ORDER BY topic_start_time DESC");

    //Map bbPress topics to WordPress posts structure
    foreach($bb_topics as $bb_topic){
    $bb_first_post = $wpdb->get_results("SELECT post_text FROM bb_posts WHERE post_position = '1' AND topic_id = $bb_topic->topic_id", ARRAY_A);
    $bb_post->ID = "forum_topic_".$bb_topic->topic_id;
    $bb_post->post_author = $bb_topic->topic_poster;
    $bb_post->post_date = $bb_topic->topic_start_time;
    $bb_post->post_content = $bb_first_post[0][post_text];
    $bb_post->post_title = $bb_topic->topic_title;
    $bb_post->post_status = "publish";
    $bb_post->comment_status = "open";
    $bb_post->ping_status = $bb_topic->post_id;
    $bb_post->post_name = "forums/topic/".$bb_topic->topic_slug;
    $bb_post->post_type = "post";
    $bb_post->comment_count = $bb_topic->topic_posts-1;

    //add bbPress topic to WordPress posts array
    $wp_posts[] = $bb_post;

    };

    //Create function to sort array of posts by date
    function compare($x, $y){
    if ( $x->post_date == $y->post_date )
    return 0;
    else if ( $x->post_date < $y->post_date )
    return 1;
    else
    return -1;
    }

    //Sort array
    usort($wp_posts,'compare');
    }

    ?>

    <div id="content-box" class="span-8">

    <div id="content-area" class="clearfix">

    <?php if ($wp_posts): ?>
    <?php foreach ($wp_posts as $post): ?>
    <?php setup_postdata($post); ?>

    <div class="entry">

    <div class="entry-header clearfix">

    <div class="info span-2">
    <a href="<?php the_permalink(); ?>#comments" class="comment-activity"><?php comments_number('<strong>Post comment</strong>', '<strong>1</strong> Comment', '<strong>%</strong> Comments' );?></a>
    </div><!-- end info -->

    <div class="content span-6 last">
    <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    </div><!-- end content -->

    </div><!-- end entry-header -->

    <div class="entry-content clearfix">

    <div class="info span-2 clearfix">
    <p><strong><?php the_author() ?></strong><br />
    <?php the_time('M j, Y'); ?>
    </p>
    <p class="share-this"><?php akst_share_link(); ?></p>

    <p class="post-comment"><a href="<?php the_permalink(); ?>#respond">Comment</a></p>

    </div><!-- end info -->

    <div class="content span-6 last clearfix">

    <?php the_content('Click to continue'); ?>

    <p class="entry-tags"><?php the_tags('<strong>Posted in: </strong>', ', ', ''); ?> </p>

    </div><!-- end content -->

    </div><!-- end entry-content -->

    </div><!-- end entry -->

    <?php endforeach; ?>

    <?php include (TEMPLATEPATH . '/navigation.php'); ?>

    <?php else : ?>

    <h2 class="page_header center">Not Found</h2>
    <div class="entry">
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
    </div>

    <?php endif; ?>

    </div><!-- end content-area-->

    </div><!-- end content-box -->

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    #64910

    In reply to: New bbPress BUGGY!!!

    mdata
    Member

    Let me premise this by stating that I installed an “integrated” version of the upgrade (BTW, the instructions could be a LOT clearer on this process – not everyone is experienced with php).

    I was planning on spending some time on this later, but on this subject (links), my original links were set to “Numeric …/forums/1”. After upgrading, links from my web sites to the bbPress section no longer worked and generated a 404 error. I looked at the links within the bbPress site and they looked fine. For instance, a “sticky” topic I link to from all my web sites is “http://www.masterdata.com/forum/bbpress/topic/62&#8221; (I copied the shortcut with a right click on the link). It looks correct, but it does not work. Not even within the bbPress section and certainly not from the outside coming in.

    So I switched the setting on my “Pretty permalink type” to “None …/forums.php?id=1”. With this setting, everything once again worked. I left it this way, but these are definitely not “pretty” links. The link to the same topic is now “http://www.masterdata.com/forum/bbpress/topic.php?id=62&#8221;. BTW, “Name based …” links do not work either.

    OK, that is the first issue. There are more and I will detail those tomorrow, each one in its own separate topic as suggested above.

    Let me, however, compliment everyone who has been involved in this project and WordPress. Both efforts are truly beyond belief in terms of what you get by simply downloading some code from the internet. ABSOLUTELY EXCELLENT! So good, in fact, you spoil us to the point where we expect everything to be close to perfect at all times. That is a bit irrational and the experience with both programs should be graciously appreciated. Thank you for your work!

    Best

    L. Carhartt

    #64809

    In reply to: Profile hook/filter

    Sam Bauers
    Participant

    Dirty hacks are prone to break from release to release… :)

    #64806
    Sam Bauers
    Participant

    It’s worth noting here that you can also override the database value in your bb-config.php file. Just in case anyone can’t directly access their database.

    $bb->uri = 'http://example.com/bbpress/';

    #64891
    _ck_
    Participant

    It would be easier to disable the auto-link entirely for a post when is detected than to parse it out, if that will do. Somehow I missed the original question was scrolling on code, sorry about that but as you found it’s very simple CSS.

    Disabling auto-link is something like: (untested)

    remove_filter('post_text', 'make_clickable');
    add_filter('post_text', 'make_clickable_if_not_code');
    function make_clickable_if_not_code($text) {
    if (strpos($text,'<code>')===false) {return make_clickable($text);}
    return $text;
    }

    [code] is detected than to parse it out, if that will do. Somehow I missed the original question was scrolling on code, sorry about that but as you found it’s very simple CSS.

    Disabling auto-link is something like: (untested)

    remove_filter('post_text', 'make_clickable');
    add_filter('post_text', 'make_clickable_if_not_code');
    function make_clickable_if_not_code($text) {
    if (strpos($text,'<code>')===false) {return make_clickable($text);}
    return $text;
    }

    #64779
    Sam Bauers
    Participant

    BB_Query can’t do this at the moment as far as I can tell. It probably should though.

    I’ll make a trac ticket to suggest this.

    At the moment you could do two BB_Queries and intersect their results. But that’s pretty poor.

    Just be sure if you do use a direct query that you prepare it first. e.g.:

    $startdate="20070602103049";
    $enddate="20080212090232";

    $query = $bbdb->prepare("SELECT * FROM %s WHERE topic_start_time BETWEEN %s AND %s ORDER BY topic_start_time DESC", $bbdb->topics, $startdate, $enddate);
    $topics = $bbdb->get_results($query);

    #64907

    In reply to: Theme Editor

    _ck_
    Participant

    Correct me if I am wrong but the “theme editor” in WordPress is simply a remote file editor for templates. Doesn’t do anything special other than let you edit a file directly on your server without having to use FTP (or shell).

    While it seems handy, if I am not mistaken it also requires you to chmod 777 your theme folder which is very dangerous on a shared server.

    I suppose bbPress will get the feature eventually because it’s so very simple. I would guess it could be ported from the WordPress code in probably an hour.

    #64316

    In reply to: Rewriting?

    haagendazs1
    Member

    mrhoratio,

    Thanks a lot for the input. Sucks that it isn’t working out for a lot of people. I guess I’ll just live with it (for now?), and patiently wait for something out there. :) Thanks again

    #64868
    mrhoratio
    Member

    Okay, I think I got it working.

    I was able to fix the redirection issue by modifying the get_user_profile_link() function in the template-functions.php. I added the following line towards the end of the function, right before the last line of code in the function:

    $r = str_replace('forums/profile/' . $user->$column , "profile/" . $user->$column, $r);

    This is the full code:

    function get_user_profile_link( $id = 0, $page = 1 ) {
    $user = bb_get_user( bb_get_user_id( $id ) );
    $rewrite = bb_get_option( 'mod_rewrite' );
    if ( $rewrite ) {
    if ( $rewrite === 'slugs' ) {
    $column = 'user_nicename';
    } else {
    $column = 'ID';
    }
    $r = bb_get_option('uri') . "profile/" . $user->$column . ( 1 < $page ? "/page/$page" : '' );
    } else {
    $r = bb_get_option('uri') . "profile.php?id=$user->ID" . ( 1 < $page ? "&page=$page" : '' );
    }

    $r = str_replace('forums/profile/' . $user->$column , "profile/" . $user->$column, $r);

    return apply_filters( 'get_user_profile_link', $r, $user->ID );
    }

    I noticed that if you did not install bbPress with WordPress cookie integration, then this hack will cause bbPress to always think you are logged out. I think it has something with it not being able to retrieve the cookie because of the path change.

    However, if you have WordPress cookie integration enabled, then everything seems to work. Not exactly sure why. But I think it must be something to with the path that’s being set in the cookie.

    #57728
    Detective
    Member

    If you have a WP profile (like the author archive or some other profile) you can redirect the bbPress profile using this hook:

    //add_action('bb_init', 'profile_redirect');

    function profile_redirect() {
    if (is_bb_profile() && $_GET['tab'] != 'edit' && $_GET['tab'] != 'favorites') {
    $user = bb_get_user($_GET['id']);
    if ($user) wp_redirect("http://www.example.com/member/" . $user->user_nicename);
    }
    }

    I did this using this plugin for WordPress profiles, so even users who don’t have published posts have a profile. It works but you miss the profile edit messages (like “your profile has been updated”).

    #63719
    Detective
    Member

    Hi, i have a plugin that will support this soon :)

    The plugin is named Gaming Codes. It’s for WP, but i have a stripped down version for bbPress. I’ll post it here soon.

    #56985
    kmccallum
    Member

    The code he pasted, above, is missing the <?php … ?> tags, so I’m also getting compiler errors.

    #64890
    bobbyh
    Member

    joneywalker4u, to remove the hyperlinkification of URLs for text inside of code tags, you could write a plugin that removes the filter that hyperlinkifies URLs for the entire post, and then create a new filter that splits the post into strings-enclosed-by-code-tags and strings-not-enclosed-by-code-tags, apply the filter that hyperlinkifies URLs to the strings-not-enclosed-by-code-tags, and then glue the strings together.

    This is totally doable, but it seems like a lot of work, which is why I suggested the CSS approach…

    #64315

    In reply to: Rewriting?

    mrhoratio
    Member

    Hey I’m been trying to get this to work also. And have posted to some other similar threads here, but there haven’t gotta a solution working.

    Here’s what I’ve learned.

    1. From what I gathered, the problem is with how bbPress redirects its pages. Even if you have the proper mod_rewrite rules, bbPress will automatically redirect the rewritten URL to the full URL that it thinks the page is supposed to have. This basically makes custom mod_rewrite useless.

    2. You can prevent bbPress from redirecting by fooling bbPress into thinking it should have a different URL than its supposed to. You can do this by modifying the get_forum_link, get_topic_link, get_user_profile link, etc. functions in the template-functions.php file. The idea is to use pattern matching to strip out the base directory from the URL.

    function get_user_profile_link( $id = 0, $page = 1 ) {
    $user = bb_get_user( bb_get_user_id( $id ) );
    $rewrite = bb_get_option( 'mod_rewrite' );
    if ( $rewrite ) {
    if ( $rewrite === 'slugs' ) {
    $column = 'user_nicename';
    } else {
    $column = 'ID';
    }
    $r = bb_get_option('uri') . "profile/" . $user->$column . ( 1 < $page ? "/page/$page" : '' );
    } else {
    $r = bb_get_option('uri') . "profile.php?id=$user->ID" . ( 1 < $page ? "&page=$page" : '' );
    }

    $r = str_replace('forums/profile/' . $user->$column , "profile/" . $user->$column, $r);
    return apply_filters( 'get_user_profile_link', $r, $user->ID );
    }

    3. If you strip out the base directory from the URL however, it makes bbPress think you’re no longer logged in, and you can’t log in. I still can’t figure out a fix yet.

    Seems like a lot of people are having issues with mod_rewrite in bbPress. Hopefully the next update will resolve some of these issues.

    #60309

    In reply to: Rewriting up one level

    mrhoratio
    Member

    Sambauers,

    As you suggested, I was able to modify get_user_profile_link() function in template-functions.php to prevent the redirection. Mod_rewrite will now rewrite to the profile page properly, without redirecting it.

    But now, it shows I’m no longer logged in when I’m on a rewritten page, even though I am. When I try to log in. It just reloads the page.

    Here’s the mod in_user_profile_link():

    function get_user_profile_link( $id = 0, $page = 1 ) {
    $user = bb_get_user( bb_get_user_id( $id ) );
    $rewrite = bb_get_option( 'mod_rewrite' );
    if ( $rewrite ) {
    if ( $rewrite === 'slugs' ) {
    $column = 'user_nicename';
    } else {
    $column = 'ID';
    }
    $r = bb_get_option('uri') . "profile/" . $user->$column . ( 1 < $page ? "/page/$page" : '' );
    } else {
    $r = bb_get_option('uri') . "profile/" . $user->$column . ( 1 < $page ? "/page/$page" : '' );

    }
    $r = str_replace('forums/profile/' . $user->$column , "profile/" . $user->$column, $r);
    return apply_filters( 'get_user_profile_link', $r, $user->ID );

    }

    My goal is create a short URL such as http://www.example.com/profile/username

    #57727
    mrhoratio
    Member

    Perhaps this idea of a single profile page for both WordPress and bbPress will be part of the recently accounted backPress.

    It would great to have a profile link such as:

    http://www.example.com/member/username

    that works for both WordPress and bbPress. Instead of separate ones at:

    http://www.example.com/forums/profile/username or

    `http://www.example.com/author/username

    #64889

    I don’t want my text that i enter between

    Code:

    to be trated as hyperlink even if it is. What @bobbyh say will only change the formatting but not remove hyperlink.

    #64906
    sachrilege
    Member

    I found my absolute path and resolved my problem.

    << Nub :)

    #3358
    sachrilege
    Member

    I’ve finished integrating 2.5 WP with BBpress and everything was working fine, until I changed something and broke my bb-admin page.

    I have require_once('../wp-blog-header.php'); in my bb-config.php which was working correctly at one point in time.

    Now I see that /bb-admin/ doesn’t work because the relative path is broken.

    This is where my knowledge fails me, how do I find the Absolute Path to blog-header or how do I trick /bb-admin/ to reading the relative path properly?

    Thanks a bunch.

    #64808

    In reply to: Profile hook/filter

    Bloggsbe
    Member

    So I noticed. But I found a kind of dirty hack that I used in the bb-twitter plugin. It works, but it’s not the best way to do it :-)

    Rune

    #3347
    bryan868
    Member

    Is there a version 1.0 development plan anywhere? I’m curious what new features we’ll be seeing in bbPress.

    Additionally, are there plans to update the web site design (like wordpress.org) and add a Codex?

    That “future of bbpress” announcement in January was very exciting, but it doesn’t seem like much as happen since then. Other than the WP 2.5 integration of course, which is great don’t get me wrong.

    #64871

    In reply to: My Private Forum

    Shagalaga
    Member

    Thx, i know, free webhoster :-(

    but Firefox + Adblock + Noscript will fix the problem :-P

    #64888
    bobbyh
    Member

    Can you just use CSS to style links so they look just like your text.? If so, something like this might work (obviously modify this as appropriate for your theme):

    .post code a, .post code a:link, .post code a:visited {

    color: #9c0;

    text-decoration: none;

    font-size: 8pt;

    font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;

    color: #000;

    }

Viewing 25 results - 27,626 through 27,650 (of 32,453 total)
Skip to toolbar