Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 22,876 through 22,900 (of 32,481 total)
  • Author
    Search Results
  • #81314

    In reply to: Post_Text Front Page

    Doobus
    Member

    Funny thing is that is what I’m planning on delving into next. I’m new to bbPress but decided to try it out because I was familiar with WordPress. I don’t have any formal training in code, I’ve pretty much just learned by piecing things together and seeing if they work.

    Back to my original train of thought, I’m planning on implementing something like queries, which I think is what you mean by loop of topics. I was actually browsing around the forums looking for ways to pull related topics together not by keywords but by relation to forums. I plan on putting this within the topics template to display similar topics to members. Will definitely be looking for help on that one as I’m sure it won’t be as easy to implement as in WordPress.

    I was planning on using <?php if (in_category() ): ?>, that is what I used in WordPress to pull similar posts together. However I’m wondering if this approach is possible in bbPress because I’m not sure if there is such a thing as in_category. I guess this will be another thing to get into. Will check back after I take a much needed rest. Thanks again.

    #81313

    In reply to: Post_Text Front Page

    hatter
    Member

    You beat me to it :) Glad you figured it out. Just to clarify, what I mean was you need to pass the proper topic ID depending on what you are doing. In this case, you are using get_topic_id(), which will get the current topic ID being worked on based on the global topic object. In other cases, you may be within a loop of topics, in which case you would need to use something along the lines of $topic->topic_id, depending on your topic object name. This will start to make more sense as you progress within php and bbPress. Until then, don’t be afraid to ask questions for help, everyone has to learn somehow.

    #81311

    In reply to: Post_Text Front Page

    Doobus
    Member

    I’m a little confused, please bare with me :). If I put in a topic id wouldn’t that just read out the same forum name by the file under: ?

    To clarify I will be putting the code in the topic template as well as the front-page template which will show the latest discussions. Problem is if I put in a topic id wouldn’t it just read that all the topics are under one category?

    #81310

    In reply to: Post_Text Front Page

    hatter
    Member

    Ah, copying the exact code would be the problem. That was meant as a guide, meaning you need to pass in the correct topic ID into the get_topic function. Depending on where in the front-page template you are putting this, you need to get the correct / current topic id.

    #81309

    In reply to: Post_Text Front Page

    Doobus
    Member

    I literally just copied the code you provided and pasted it in the front-page.php template file and topic.php template file. The front-page template shows the url however it does not display the forum name. The topic template shows the forum url and the forum name.

    This is what I put in the template files:

    <?php $topic = get_topic($topic_id);
    $forumName = forum_name($topic->forum_id);
    $forumLink = forum_link($topic->forum_id); ?>

    #81308

    In reply to: Post_Text Front Page

    hatter
    Member

    That’s odd that it wouldn’t work in the front-page.php template file, since it is used within there. Make sure you are calling it correctly and that your code is hit. Can you post a code snippet for how you’re calling it?

    #81306

    In reply to: Post_Text Front Page

    hatter
    Member

    Ok, I see what you’re looking for now. To get the forum name, use the forum_name() function and to get the forum link, use the forum_link() function. Once you have the topic ID, use the get_topic() function to get the topic object. From here, you can use the forum id. So, your code would look like:

    $topic = get_topic($topic_id);

    $forumName = forum_name($topic->forum_id);

    $forumLink = forum_link($topic->forum_id);

    An example of the forum_name and forum_link functions being used is in the bb-templateskakumeiforum.php file. Keep in mind that the example uses the current forum_id and doesn’t pass it in, but this should give you an example of how to use them.

    #81305

    In reply to: Post_Text Front Page

    Doobus
    Member

    I guess I made it a little confusing with the category reference to WordPress.

    You’re on the right track, but what I’m looking for is detecting what forum a topic is in, this will be used by title in the front_page as well the titles in the topic_pages.

    Illustration:


    Topic Title

    File under: Forum 1


    Making the forum link linkable would be ideal as well. Thanks.

    #81303

    In reply to: Post_Text Front Page

    Doobus
    Member

    Hatter thanks for the lesson, even though most of it was above my head I’m very grateful for your help. Btw your code worked like a charm.

    I feel like an a** since I’ve been littering these boards with newb questions. With that said, I was wondering if you could help me with another minor thing that I have been trying to figure out. In WordPress you can call the_category(); which indicates which category the post is in. I’ve been searching the forum and there was one person who asked the same question but didn’t get a reply can this be done?

    Sorry for hijacking my own post :(.

    #81049

    In reply to: Help out with bbPress

    r-a-y
    Participant

    +1 for _ck_ to join the bbPress team.

    She knows the project inside and out and is a stickler for code optimization and performance!

    #81301

    In reply to: Post_Text Front Page

    Doobus
    Member

    A bit surprised no one has chimed in yet, didn’t think it was that difficult to achieve.

    Anyways here is the code that I found in another thread:

    <?php
    function get_post_teaser($chars = 200){
    global $bbdb;
    $topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic
    $first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1");
    $content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0, $chars); //gets the first 200 chars of the post
    return $content;
    }
    ?>

    I figured it’s the same basis, however since I’m pretty much brain dead in regards to php I can’t for the life of me make the post_text show fully. This code strips out html code so links don’t show, how can the code be altered to allow html? I figure this code is similar to WordPress’ content_excerpt. If there is another way, I’m open to suggestions.

    Sorry for all the newbie questions, I assure you I’ve tried my best to track down my issues in the forum search before asking my questions, unfortunately due to lack of a codex and documentation I’m pretty much at a lost.

    #32284

    I have what I hope is a fairly easy question to answer: On the WordPress side of my site (running 2.8.5), I have a custom script that loads a small icon showing the status of users who have donated to the site, as well as for staff members. As you’ll see below, it calls the user_id and then looks for and displays an image with the matching name.

    <?php $user = new WP_User( $comment->user_id );

    if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
    foreach ( $user->roles as $role )
    echo "<img src='/{$role}.gif' />";
    } ?>

    I’d like to introduce this to the forum side as well. I’m running bbPress 1.0.2, and it’s fully integrated, and I’m trying to add this to the standard Kakumei template in the post.php file, above the post_author_avatar_link line. It doesn’t appear to break anything, but it also doesn’t load the image, or show a broken image link that would hint that there’s no appropriate image to be found.

    It also appears to recognize the WP_User term, but not BB_User (it breaks with an error when changed).

    Any ideas how I can get this working for at least the staff levels (keymasters, admins, moderators)?

    #81289
    travis07
    Member

    Resolved. I had created and was working on a development instance (copied db and code) instead of doing an install from scratch. I had missed changing one of the database url’s that was still pointed to Prod instance.

    #81271
    tdh11
    Member

    @circuit: i’ve looked at your website, and im genuinely impressed. the latest forum posts on the right hand side are visable on your wordpress pages. Was this achieved by calling bbpress header after wp header? Im wondering if this is an option as I have read some now about it being doable. It seems the code you have included brings in the latest posts in your forum, correct? My aim is to bring in latest posts in a specific forum on my catagory pages, with each forum included different dependent on catagory.

    Does anyone know if what Im trying to do is possible with this software? Im going to be trying to do this with the header method for the next few days, so anyone who has some info on the subject would be a god send. I have a few threads from this forum that I’ve got saved, but they are very dated.

    #81269
    circuit
    Member

    there are a LOT of threads about this on the forum already. so much so that it’s becoming hard to find threads about anything else ;)

    search the site (i recommend the ‘search google’ option) for ‘integration’ or ‘wordpress’.

    what you want is possible but not without a considerable amount of time and some intricate theme modification.

    you can see my wordpress(MU) + bbpress + buddypress install here:

    http://www.copsandrobbers.net

    the forum is actually entirely separate, apart from the wp_users table. what you are seeing is a shared header graphic and cloned stylesheet. that is probably what you need to do.

    #81048

    In reply to: Help out with bbPress

    deadlyhifi
    Participant

    Hi Matt,

    I’ve been running a large bbP community for 11 months now, so I’ve come to know what users expect and the kinds of limitations we’ve had to overcome (or not). My skills lie mostly in user experience and CSS coding, but I’m also getting quite proficient in PHP. I’d be more than willing to help in any of these areas. With PHP some of the lighter side of things would be desirable.

    I’d also love to help out with the codex, answer questions here, and moderate.

    A great person to have on board would be CK ( https://bbpress.org/forums/profile/_ck_ ). She seems to have disappeared off the radar of late, but she wrote many plugin (for 0.9), offered much advice, and stated she’d be updating plugins for 1.0 from December onwards.

    #81046

    In reply to: Help out with bbPress

    Hey Matt!

    Without too much detail, I’ve been neck deep in theme development, bug patching, code re-factoring and clean-up since the Windows 3.11 and Visual Basic 3.0 days. I’ve been interested in making bbPress be better integrated with WordPress for probably a year or so now? I was a long time phpBB2.0 junkie, and moved to WordPress because I was frustrated at how forcibly linear typical forum software is. When I fell in love with the WordPress way, I quickly found bbPress, and expected it to include all of the features that BuddyPress now does, hence my shift in that direction.

    I’d like to help restyle bbpress.org, maybe bring it a little more in line with the other Automattic websites. There’s no doubt that bbPress needs some TLC in the codex and source-code documentation areas too, and I have recent experience absorbing the WP Code Standards from working under Andy with BuddyPress.

    Right now my focus is 100% BuddyPress, but since you asked… I’d love to be more involved in all of the WP projects and communities if there’s opportunity. ;)

    #80849

    In reply to: Future of bbPress

    Justin Tadlock
    Participant

    One could run a filter function on bb_template to check for templates in both the parent and child themes.

    Or, the user could set it in bb-config.php:

    define( BB_DEFAULT_THEME_DIR, 'path/to/default/theme/directory' );

    I don’t really like either of those two options. Your average user gets confused enough as it is. Trying to tell them to input PHP code can cause headaches sometimes.

    As far as I know, there’s no way to filter the default theme directory either. I’m open to ideas though. If anyone could offer a solution with a few lines of code, I’ll be happy to give it a whirl.

    Ideally, the constant BB_DEFAULT_THEME_DIR would be based off the theme’s Template line in style.css. Or, bb_get_default_template() would recognize the Template line.

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

    #81243

    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://&#8221;);

    // 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://&#8221;.$_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]);

    }

    #32258
    hatter
    Member

    In the php_errorlog, there is a common warning, “PHP Warning: parse_url(…..”. This warning is caused within the bb_get_path function in bb-includes/functions.bb-core.php. The common cause of this issue is due to urls being passed to this function in the following format:

    /bb-login.php?re=http://example.com/tags.php?tag=sometag

    Due to the http:// within the query string, parse_url will fail and log an error. The way to get around this is to pre-pend the website address and http:// to the beginning of the url, such as:

    http://example.com/bb-login.php?re=http://example.com/tags.php?tag=sometag

    This format is valid with the parse_url function. To change your code to use this format, change the bb_get_path function in bb-includes/functions.bb-core.php to the following:

    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($url, “http://&#8221;);

    // 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://&#8221;.$_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]);

    }

    Doing this will get rid of the common error in your error log, and prevent site issues.

    Note: This will need to be changed if your site is using SSL, such as https://

    #81238

    In reply to: bbRating FF issue

    Doobus
    Member

    Upon further inspection of the source code. I noticed that the link to the star.gif was awkward:

    http://localhostbbpressmy-pluginsbb-ratings/star.gif

    To make sure that was an issue with FF, I copied it into the address bar and it returned an error. Changed the backslash to forward slashes and it worked. However now I’m stuck on how to change it, looked into the php file and it just calls the path to bb url. Checked in the bb admin section and the url is set with forward slashes, so I have no clue why it’s backward slashes.

    #32257

    Topic: bbRating FF issue

    in forum Plugins
    Doobus
    Member

    Posted this in the bbRating plugin section, but figured my issue would have more exposure if I posted here.

    I have bbPress 1.0.2 on a test server with bbRating 0.8.5.

    bb_rating() and bb_rating_dingus() work correctly on IE8 and Safari, and oddly does not work in FireFox. Firefox simply doesn’t show anything, looking at the source code it shows the same thing as IE8 and Safari, with my limited coding knowledge I’m not sure what the issue could be.

    Also bb_top_topics, which I assume lists the highest rated threads doesn’t do anything on any of the browsers.

    Thanks.

    #32255

    Topic: BB Seo Tools Bugs

    in forum Plugins
    alegria
    Member

    There’s some conflicts in the bb seo tools plugin with human test. This is the error:

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /web/htdocs/www.alegria.it/home/forum/my-plugins/bb-seo-tools.php on line 178

    #81206

    In reply to: Help with css layout

    The problem is with the menu tabs. If you cut the html part out, the heading aligns fine.

    I tried some css changes, but to no avail. Really odd… in any event, the problem seems to fix itself if you add a div with some height (40px), like this:

    <div id="blog-menu" class="clearfix">
    <ul>
    <li class="about"><a href="/about-2">About</a></li>
    <li class="join"><a href="/join">Join</a></li>
    <li class="blog"><a href="/blog">Blog</a></li>
    <li class="contact"><a href="/contact">Contact</a></li>
    <li class="wiki"><a href="/wiki">Member - Wiki</a></li>
    <li class="forum"><a href="/forum">Member - Forum</a></li>
    </ul>
    </div>
    <div style="height:40px;"></div>

    There must be some other solution, but at least there is a quick fix for now, and you know where to look for the source of the issue.

    Hope this helps.

Viewing 25 results - 22,876 through 22,900 (of 32,481 total)
Skip to toolbar