Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 25,701 through 25,725 (of 32,505 total)
  • Author
    Search Results
  • #71961
    _ck_
    Participant

    Yup “order by rand()” is very handy.

    I used it for a mod for WordPress years ago to make a “random” category which is very useful.

    It could even be done to make a “random topics” view in bbPress but not sure how useful that would be.

    It’s fine for casual use but keep in mind for larger tasks it’s very slow and makes mysql purists shudder.

    #71960
    deadlyhifi
    Participant

    and my final correction on the random thing!

    $stories = $bbdb->get_results("SELECT post_title, guid FROM site_posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date_gmt DESC LIMIT 0,10");
    shuffle($stories);

    previous example was getting a random 10 from all posts.

    This get’s 10 latest posts, then randomizes them with the ‘shuffle’.

    cheers!

    #71959
    deadlyhifi
    Participant

    On my version I’m fetching 10 latest rows, randomizing, then displaying 5 stories.

    $bbdb->get_results("SELECT post_title, guid FROM site_posts WHERE post_type='post' AND post_status='publish' ORDER BY rand() LIMIT 0,10");

    Admittedly, I didn’t make the correct alterations to the previous example. Anyway, it should give people an idea of what to do.

    oh, and _ck_ I hadn’t spotted your earlier post – it would have made it a lot easier for me to figure out if I had!

    #4891
    patrick10128
    Member

    Hi,

    I’m looking for someone who has had a bit of experience with theming bbPress to help me port a HTML/CSS template (which I have also made into a WordPress theme) over to bbPress. It should be relatively easy seeing as the design is simple and already coded.

    Please contact me at patrick.devivo [at] gmail.com if you know someone or are willing to help me out.

    #71958
    _ck_
    Participant

    FYI, the if ($i <= 4) { is not needed because you already do a LIMIT on the query.

    Related topic:

    https://bbpress.org/forums/topic/heres-how-to-show-bbpress-info-inside-wordpress-without-full-integration

    #71957

    FYI, this only lists 4 posts but is FREAKIN AWESOME! :D

    #4885
    deadlyhifi
    Participant

    Just made a query in my forum functions.php to display the 5 latest stories from WordPress. Pretty basic but it may help someone:

    // get WP news
    function wpnews() {
    global $bbdb;
    $stories = $bbdb->get_results("SELECT post_title, guid, post_date_gmt FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY post_date_gmt DESC LIMIT 0,4");
    foreach ($stories as $story) {
    if ($i <= 4) {
    echo '<li><a href="' . $story->guid . '">' .$story->post_title . '</a></li>';
    $i++;
    }
    }
    }

    then call it on your forum with <?php wpnews() ?> and style to suit.

    #4881
    rockin
    Member

    I’m looking for talented coders/designer who can help me theme a bbPress forum to my needs.

    Contact me directly at:

    andreas [at] jaxvine.com

    #71943
    WPAlex
    Member

    Ipstenu, thanks. To solve this problem I delete all messy code from profile-edit.php of Refresh theme and replace it with default one from Kakumei.

    #71946

    In reply to: Theme: TooNewsy

    _ck_
    Participant

    Good fix, I got distracted after I posted that and never did it myself.

    There’s also a border issue on images but I think most themes have that problem and it’s another thing I have to enforce in it’s own stylesheet.

    actually, you are causing it here:

    #posts .post .content a img {
    border: 1px solid #ccc;
    }

    You may way to limit it to topic pages and not any kind of table like latest-discussions.

    #71778

    Heh :) Politics are a different beast all together in terms of readership. BUT to be constructive:

    SALON (political left)

    – Blog posts are presented like forum topics here: http://open.salon.com/cover.php?view_sort=recent

    – The authors’ blogs are listed here: http://open.salon.com/people.php

    Actually that’s just a blog. It’s probably a WPMU sort of blog, but it’s ‘presented like forum topics’ because that’s their design. A very straightforward one at that. That’s it. Same with Pajamas, actually. Which I find a much nicer design, as I prefer blogs to give a little excerpt hint at what’s to come.

    #68941

    In reply to: reCAPTCHA for bbPress

    mvds
    Member

    Works like a charm for me :) Saves me about 5 bot registrations per day :)

    #71923

    In reply to: Custom User Groups

    farly
    Member

    Okay I had to change it a bit:

    <?php
    /*
    Plugin Name: Add custom usergroups
    Description: Adds custom usergroups
    Author: fel64, farly
    */
    add_filter('get_roles', 'add_custom_usergroups');

    function add_custom_usergroups( $roles ) {

    //define custom groups

    //$groups['GROUPNAME'] = array('CAPABILITIES LIKE','HUMAN GROUPNAME', array(EXTRA CAPABILITY, EXTRA CAPABILITY));

    $groups['probemitglied'] = array('member','Mitglied auf Probe', array());
    $groups['mitglied'] = array('member','Mitglied', array());
    $groups['kernmitglied'] = array('member','Kernmitglied', array());
    $groups['koordinator'] = array('moderator','Koordinator', array());
    $groups['leiter'] = array('administrator','Leiter', array());

    foreach ($groups as $key => $g) {
    $roles[$key] = $roles[$g[0]]; //duplicate member capabilities
    $roles[$key]['name'] = __($g[1]); // change name
    foreach( $g[2] as $capability ) {
    $roles[$key]['capabilities'][$capability] = true; // add extra capabilities
    }
    }
    return $roles;
    }
    ?>

    #71922

    In reply to: Custom User Groups

    farly
    Member

    Thanks!

    I modified this approach slightly and ended up with this:

    <?php
    /*
    Plugin Name: Add custom usergroups
    Description: Adds custom usergroups
    Author: fel64, farly
    */
    add_filter('get_roles', 'add_custom_usergroups');

    function add_custom_usergroups( $roles ) {

    //define custom groups
    $groups['mitglied_probe'] = array('Mitglied auf Probe', array('rulord_level1'));
    $groups['mitglied'] = array('Mitglied', array('rulord_level1', 'rulord_level2'));
    $groups['kernmitglied'] = array('Kernmitglied', array('rulord_level1', 'rulord_level2', 'rulord_level3'));
    $groups['koordinator'] = array('Koordinator', array('rulord_level1', 'rulord_level2', 'rulord_level3', 'rulord_level4'));
    $groups['leiter'] = array('Leiter', array('rulord_level1', 'rulord_level2', 'rulord_level3', 'rulord_level4', 'rulord_level5'));

    foreach ($groups as $key => $g) {
    $roles[$key] = $roles['member']; //duplicate member capabilities
    $roles[$key] =& $user[$key]; //convenience
    $user[$key]['name'] = __($g[0]);
    foreach( $g[1] as $capability ) {
    $user[$key]['capabilities'][$capability] = true;
    }
    }
    return $roles;

    }
    ?>

    It works for me so far :)

    #71942

    Flip back to the default themes and see if the problem persists. If no, it’s the theme. If it persists, collect the following:

    1) bbPress version

    2) Plugins

    3) WP version (if integrated)

    and report back! :)

    #71921

    In reply to: Custom User Groups

    johnhiler
    Member

    You can use fel64’s unofficial plugin to add a new Role:

    https://bbpress.org/forums/topic/adding-a-new-user-type?replies=6#post-9210

    I’ve used this together with Hidden Forums, and it works really nicely! :-)

    #69481

    In reply to: del Sol Owners Club

    Shagalaga
    Member

    Nice :D

    but some usernames are missing(or hidden?) :-P

    #71917
    coolsaggu
    Member

    Hi chrishajer,

    Thanks for the suggestion…….

    but they are bound to change sometime in future.

    I also read your article. Thanks I was bit struggling with this thing also(getting WP info in BBpress). But even if I get the information, how would i construct the Permalink structure of the WP.

    I have been following the WP code to write my own functions, but they seem to go pretty deep and I dont know whether creating a copy of these functions in BBpress would be safe or not.

    #71885
    chrishajer
    Participant

    There is no restart required for modifying an .htaccess file: Apache reads that for every access.

    The permalinks are not related to PHP4 vs PHP5.

    The permalink stuff is definitely 100% right now, at least for the 0.9.x series.

    I’m assuming you made the change in the admin to turn on the permalinks, in conjunction with adding the .htaccess rewrite rules?

    I had to insert this into my .htaccess to turn OFF the multiviews before the rewrite rules would work:

    Options -MultiViews

    #71916
    chrishajer
    Participant

    It would be easiest to hard code them if they don’t change very often.

    _ck_ described how to get bbPress information inside WordPress. Maybe something similar would work in an opposite fashion to get WordPress information inside bbPress:

    https://bbpress.org/forums/topic/heres-how-to-show-bbpress-info-inside-wordpress-without-full-integration

    #71255
    lookfab
    Member

    Will there be a version of 0.9 that supports php4, or is 1.0 the next time we’ll see php4 support in an official (beta) release?

    #71214

    In reply to: List all Tags?

    circuit
    Member

    my line 2529 was blank so i replaced the nearest thing i could see that was similar to

    return "<small> - <a href="/forum/profile.php?id=$tag->user_id">$poster</a></small> [<a href='$url' class='delete:$list_id:tag-{$tag->tag_id}_{$tag->user_id}' title='$title'>&times;</a>]";

    now, either as a result of this or as a result of the updates described in this page:

    https://bbpress.org/forums/topic/theme-template-files-to-change-for-10#post-23794

    …my tag area no longer automatically reloads when a tag is added, even though the tag is committed to the db and can be seen if you reload the page. i am a bit worried that users are going to be confused by this. i bet i have replaced the wrong line, but i am not sure…

    #71678

    I’m having the same problem and it seems that the WP integration for whatever mysterious reason forces the MySQL connection into “localhost” mode. I’ve configured both WP and bbPress to connect to another MySQL host, but still it seems like bbPress is trying to connect to “localhost”.

    I added a print_r($args) inside the db_connect_host() function and found that the function is called twice and the first time the credentials, host, etc., are correct and the second time they aren’t. The second time the function is called, the credentials are for some reason set to the ones of the logged in user. So somewhere in the bbPress code, authentication is done not with the values stored in bb-config.php, but with the username and password of what’s stored in the session cookie and the host is then set to “localhost”.

    I don’t know how to investigate this problem any further.

    #71666

    Works like magic..You are a rockstar, Chris!! :)

    Thanks again..

    #71664
    chrishajer
    Participant

    Yes, probably. You can see if that’s the problem by logging in as keymaster and going to the Admin section, then Settings > General (sometimes this is the URL http://wat2.com/bb-admin/options-general.php). Once there, change “Pretty Permalink Type” to “None” and then try your forum. If your forum is usable after that, then yes, it’s because bbPress is trying to use permalinks, but you have not set up the .htaccess file with rewrite rules.

    You can create the rewrite rules by accessing this URL in your forum:

    http://wat2.com/bb-admin/rewrite-rules.php

    Now, take the output from that browser window and paste it into a .htaccess file in the forum root (/home/web/htdocs/whatever/wat2/.htaccess) on your server. Once that’s done, change the permalink setting back to one of the other two options (Numeric or Name based) and then try accessing topics and the profile page in your forum.

    https://bbpress.org/documentation/faq/#pretty-permalinks

    (I don’t recommend the Options +MultiViews line, but that does work for some people instead of creating the rewrite rules in the browser). Be sure you’re logged in as keymaster before you try to access http://wat2.com/bb-admin/rewrite-rules.php or it won’t work.

Viewing 25 results - 25,701 through 25,725 (of 32,505 total)
Skip to toolbar