Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 28,826 through 28,850 (of 32,458 total)
  • Author
    Search Results
  • #60921
    sethi2000
    Member

    I am still getting error after making all the recommended changes

    Warning: mysqli_get_server_info() expects parameter 1 to be mysqli, boolean given in /home/.mascot/digitalguruz/sheetudeep.com/bbpress/bb-includes/db-mysqli.php on line 80
    Cannot select DB.

    #61217
    livibetter
    Member

    I made some changes to have paginated search results on relevant post. However, I am not sure is this what you need. You need to modify two files: search.php in root of bbPress and search.php of your template files.

    Replace if block start at line 9 in search.php of root of bbPress with:

    if ( $q = stripslashes( $q ) ) {
    add_filter( 'bb_recent_search_fields', create_function( '$f', 'return $f . ", MAX(post_time) AS post_time";' ) );
    add_filter( 'bb_recent_search_group_by', create_function( '', 'return "t.topic_id";' ) );
    $bb_query_form->BB_Query_Form( 'post', array(), array( 'per_page' => 5, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' );
    $recent = $bb_query_form->results;

    $bb_query_form->BB_Query_Form( 'topic', array( 'search' => $q ), array( 'post_status' => 0, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author', 'count' => 'found_rows' ), 'bb_relevant_search' );
    $relevant = $bb_query_form->results;
    global $relevant_round_rows;
    $relevant_found_rows = $bb_query_form->found_rows;
    $q = $bb_query_form->get( 'search' );
    }

    I added a query parameter 'count'=>'found_rows' to second $bb_query_form for retrieving total post count. And I added global $relevant_found_rows to pass to template search.php (you can use bb_load_template to do same thing).

    Insert the following code just before second <?php endif; ?> from bottom in template search.php

    <div class="nav">
    <?php
    $uri = $_SERVER['REQUEST_URI'];
    if (false !== $pos = strpos($uri, '?')) {
    $uri = substr($uri, 0, $pos) . '?q=' . urlencode($q) . '%_%';

    if (!isset($page))
    $page = 1;

    global $relevant_found_rows;
    echo paginate_links(array('base' => $uri, 'format' => '&page=%#%', 'total'=>ceil($relevant_found_rows/$bb->page_topics), 'current'=>$page));
    }
    ?>
    </div>

    Should look like:

    <?php if ( $relevant ) : ?>
    <h2><?php _e('Relevant posts')?></h2>
    <ol class="results">
    <?php foreach ( $relevant as $bb_post ) : ?>
    <li><h4><a href="<?php post_link(); ?>"><?php topic_title($bb_post->topic_id); ?></a></h4>
    <?php echo bb_show_context($q, $bb_post->post_text); ?>

    <small><?php _e('Posted') ?> <?php bb_post_time( __('F j, Y, h:i A') ); ?></small>

    </li>
    <?php endforeach; ?>
    </ol>
    [insert the code above here]
    <?php endif; ?>

    You can find paginate_links in bb-includes/wp-functions.php.

    #61216
    chrishajer
    Participant

    I was not happy with bbPress search functionality a long time ago, now I just live with it. The results were always weird looking to me.

    Anyway, now I just use Google to search my site if I want to find anything. Something like:

    site:mysite.com term1 term2 at google.com does the trick. Of course, the content needs to be indexed at Google for that to work. An alternative I heard about was Google Custom Search Engine:

    http://www.google.com/coop/cse/

    I have no idea how that works but it’s an option.

    I think doing what you propose with the search results would require a lot of work (having 3 sets of search results complicates it in my mind), but maybe one of the plugin writers will show an easy way to do what you propose. Maybe you could perform all three searches and aggregate the results, then paginate them. That would be easier than breaking them into title matches, recent posts and relevant posts. That begs for having advanced search options anyway. Like, why can’t you search for a user’s name? I thought you used to be able to, but searching my forum now for a known user name doesn’t return anything like “User Name matches”: I thought it used to.

    Looking at how a user profile works is interesting. If you click on a user’s name to get to profile.php?id=the_user_id, you’ll see a paginated list of all posts made by that user ordered by the last time they replied (so, that user’s posts in the order that they made them, most recent first) and a list of threads started, I think. Maybe a plugin could be written to replace the search queries with something like what profile.php does, except instead of selecting all posts and threads for a user (which are returned in $posts and $threads) maybe you could do a similar query with your search term, in all the fields you want to check, then return that? Hmmmm…

    I think search is a weak point for lots of blogging platforms and forum software, and I think getting it right is important, so it’s worth looking into.

    Good luck.

    (sorry: edited version substantially)

    #61203
    simon551
    Member

    not sure if I understand that. I forgot to put the backticks around my links code which I’m sure didn’t help. the code you provided is already contained in the header.php file in templates. The link as is is to mysite/forum

    but I’d like to make one that goes to mysite. Or even better, the end link would be like this:

    <a href="http://mysite/">My Site </a> -- <a href="http://mysite/forum"> Discussion Forum</a>

    #2532
    krussell
    Member

    I’m looking for advice on how to modify the search functionality to paginate the results that are returned; i.e. the default functionality returns N matches in each of the following categories: thread title, recent posts and relevant posts, but I would like to allow a user to scroll through repeated pages of search results.

    I’ve had a look at search.php and this is structured around returning a fixed number of results for each query, which effectively hides anything that doesn’t come up in the first N results of the search. The concept of listing the results of 3 different queries in one results page also seems to be incompatible with providing a pagination mechanism (which list do you paginate?). I feel that the default method of handling search results is a bit limited and confusing for users familiar with a typical Google-style search that returns one simple list in multiple pages.

    I have had a look at the code, but I’m no PHP guru; is there any way of getting the sort of results I would like without fundamentally rewriting the search mechanism?

    p.s. not being overly critical here – I think bbPress is a great piece of work!

    #61202
    Trent Adams
    Member

    It would be easier to do the following if you want to change your title back in config.php and then download your header.php from your template folder and do something like this:

    <h1><a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a></h1>

    Then save the file and upload to /my-templates/ so if you make a mistake, you can delete it and bbPress will use the original!

    Trent

    #61183
    intellivision
    Participant

    Fixed. It was the path to the .js file that got changed with the template change. Check this in your source code, and if the path isn’t correct the buttons won’t show.

    #61200
    chrishajer
    Participant

    Never mind :)

    #61199
    livibetter
    Member

    I see. Then that would be

    require_once '../wp-blog-header.php';

    #53604
    livibetter
    Member

    Hi,

    Here is a quick php for it(Use this method at your own risk), you need pretty permalink to use it.

    Save the following code in bbPress root folder as page.php

    <?php
    require_once('./bb-load.php');
    if (preg_match('/.*/page/(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
    $file = bb_slug_sanitize($matches[1]) . '.php';
    if (file_exists(bb_get_active_theme_folder() . "/static/$file")) {
    bb_load_template("static/" . $file);
    exit(0);
    }
    }
    wp_redirect(bb_get_option('uri'));
    ?>

    Put your static pages in a new static folder under your template folder, they should looks like

    <?php bb_get_header(); ?>
    The static content here.
    <?php bb_get_footer(); ?>

    Then you can access a static file. For example, access test.php(bb-templates/yourtemplate/static/test.php) at http://yoursite.com/bbpress/page/test

    Remember: Use this method at your own risk

    #61197
    livibetter
    Member

    majea,

    You used require_once in a wrong way. If you installed WordPress in /path/to/wordpress and bbPress in /path/to/bbpress, then you should use

    require_once '../wordpress/wp-blog-header.php'.

    You normally use require/include for local .php.

    PS. I don’t use WordPress and bbPress together.

    #60752
    grosbouff
    Participant

    I thinking to start developping a plugin.

    I’m not a real coder but i’ll try.

    Anyway, I think the problem is that bbpress uses names and not levels (like wordpress) for roles, so it will be hard to do, no ?

    If you have ideas, if you want to help me, please feed this threat !

    #61186

    In reply to: Plugin: Gravatar

    livibetter
    Member

    Aha… I just realized that I didn’t know users can change their registered email. (I use a Key Master to edit normal user’s profile…)

    I should remove this Gravatar Email field to make code simpler and add another field Use Gravatar?. Maybe add some other features as well.

    I am also waiting Gravatar to allow larger avatar. Once it allow, I will put a new version out.

    #58170

    In reply to: bbSync

    vitovarducci
    Member

    Awesome. OK, so I removed the entry from the database and I was able to login like normal.

    Then I went back and created a new post again to test if it would create a new topic in bbpress. No new topic. And it wouldn’t let me login to the backend again.

    So I went back and removed the capabilites entry from the database.

    I can create topics no problem in bbpress. Just doesn’t create new topics when I write posts.

    #58169

    In reply to: bbSync

    fel64
    Member

    Mmmm. Bum.

    Open phpmyadmin, browse wp_usermeta, look for a very recent record for your user_id, where meta_key = capabilities and meta_value looks something like a:1:{s:6:"member";b:1;}. Then delete that and try again.

    #2523

    Topic: Plugin: Gravatar

    in forum Plugins
    livibetter
    Member

    I wrote a simple plugin for Gravatar. I am planning to put files on Extend, but I am still waiting. You can download it from Google Code for now, please visit this plugin’s homepage. You can find a download link and know how to modify your theme in the page.

    It is relatively simple:

    • Gravatar Email field – This plugin doesn’t use user’s registered email.
    • Email Verification – Users need to own the Gravatar Emails which they input.
    • Support Default Image
    • Size customized (1..80px)

    I hope I can hear your thoughts about this plugin.

    #61181

    In reply to: Error while posting

    chrishajer
    Participant

    What version of bbPress are you using and what type of host system is it on? It looks like the single quote in Mail's throwing for a loop, but I haven’t seen that happen in any recent version of bbPress.

    #55812
    Trent Adams
    Member

    I managed to destroy this one and with a server crash and just haven’t rewrote it yet, but if you head over to https://bbpress.org/plugins/topic/55?replies=8 that plugin will do the same thing ;)

    Trent

    #58165

    In reply to: bbSync

    fel64
    Member

    Yo,

    good good. Now instead of global $bb_cache; try global $bb_cache, $bb_roles; :)

    #52877
    bobbyh
    Member

    Thanks Sam! :-)

    #58164

    In reply to: bbSync

    vitovarducci
    Member

    hmm… I did it… but I get another error when creating new posts…

    Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271

    Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275

    Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271

    Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275

    Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271

    Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275

    Warning: array_filter() [function.array-filter]: The second argument, 'Array', should be a valid callback in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 271

    Warning: Invalid argument supplied for foreach() in /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php on line 275

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/28/d126493713/htdocs/cbusaffairs1/forum/bb-includes/capabilities.php:271) in /homepages/28/d126493713/htdocs/cbusaffairs1/wp-includes/pluggable.php on line 341

    Sorry, I just don’t understand the code well enough to figure it out myself… :(

    #58163

    In reply to: bbSync

    fel64
    Member

    Slex, you didn’t, it’s cool, and for the last week I have barely posted here without being rather drunk (since I usually see posts late at night when I come home). I did not know about you and I somewhat hope that you did not know about me. It is cool.

    Jazbek, have you tried it? It has been a good half-year since I came up with the globals solution, but even from a purely theoretical standpoint I don’t see why it would work. The key issue is that bb-include files cannot access the globals, and declaring globals in some function in wp shouldn’t change that. The only thing that seems like it could is the main code, ie. config.php.

    Of course, perhaps I’m making something of a fool of myself and it would totally work. If you’ve tried it and it worked for you (meaning also that without the globals code in bbsync.php you had fatal errors) then I’ll check it out again. Cheers.

    #58162

    In reply to: bbSync

    jazbek
    Member

    fel, do you think maybe you should add global $bb_cache; to the bbsync.php file instead of telling everyone to add it to their config? wouldn’t it work out of the box that way?

    #52876
    Sam Bauers
    Participant

    Put this in a plugin file named ‘_addSuperuser.php’ in the my-plugins directory:

    function addSuperuserToArray($array)
    {
    $array[] = 'Superuser';
    return $array;
    }

    add_filter('bb_trusted_roles', 'addSuperuserToArray');

    .

    If there is no my-plugins directory in the bbPress root, just create it. The underscore at the start of the file name should make the file autoload, so it is available without activation in the admin area.

    #52875
    bobbyh
    Member

    I ran into a similar problem. Specifically, I created a new Role called ‘Superuser’ that has capabilities between Member and Moderator. I don’t want these users ever to be spam-filtered.

    I solved this by replacing this function in /bb-includes/functions.php:

    function bb_trusted_roles() {

    return apply_filters( 'bb_trusted_roles', array('moderator', 'administrator', 'keymaster') );

    }

    with this:

    function bb_trusted_roles() {

    return apply_filters( 'bb_trusted_roles', array('moderator', 'administrator', 'keymaster', 'Superuser') );

    }

    This works, but I hate hacking the core. Is there a way to do this with a plugin? I tried and tried, but I couldn’t figure out how to array_push a new Role on that array. Can somebody help me, perhaps with their superior understanding of how add_filter works? :-)

    Thanks!

    -Bob

Viewing 25 results - 28,826 through 28,850 (of 32,458 total)
Skip to toolbar