Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 27,851 through 27,875 (of 32,462 total)
  • Author
    Search Results
  • #61280
    Detective
    Member

    I finally made a custom “private forum” (note the single noun) plugin:

    define('FORO_STAFF', 22);

    add_filter('get_posts_where', 'ryuuko_staff_where_posts');
    function ryuuko_staff_where_posts($where) {
    if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
    //var_dump($where);
    $where .= " AND p.forum_id <> '" . FORO_STAFF . "' ";

    }
    return $where;
    }

    add_filter('get_topics_where', 'ryuuko_staff_where_topics');
    function ryuuko_staff_where_topics($where) {
    if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
    $where .= " AND t.forum_id <> '" . FORO_STAFF . "' ";
    }
    return $where;
    }

    add_filter('get_forums', 'ryuuko_staff_forums');
    function ryuuko_staff_forums($forums) {
    if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
    $where .= " AND t.forum_id <> '" . FORO_STAFF . "' ";
    $forum_key = -1;
    foreach ($forums as $key => $forum)
    if (intval($forum->forum_id) == FORO_STAFF) {
    $forum_key = $key;
    break;
    }
    unset($forums[$key]);
    }
    return $forums;
    }

    add_action('bb_forum.php_pre_db', 'ryuuko_forum_redirect');
    function ryuuko_forum_redirect($forum_id) {
    if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
    if ($forum_id == FORO_STAFF) bb_die("No puedes ver esto!");
    }
    }

    Maybe it’s useful for someone. The constant FORO STAFF is the id for the private forum. In this case, only users with the ‘moderate’ capability can see the forum.

    #64311

    In reply to: Rewriting?

    chrishajer
    Participant
    #3199

    Topic: Rewriting?

    in forum Installation
    haagendazs1
    Member

    Hi everyone,

    Currently my forum is located in something like:

    example.com/dir/forum/

    But I want to rewrite it to be like this:

    example.com/forum/

    Since WordPress can do that, I was hoping bbPress can too, but I’m not sure how. Is there some setting I can change?

    Also secondary to that is that if there is no setting for such an option, can I just move the “forum” directory out of “dir” and into the root, and change the “bbPress address” to force it to physically be like “example.com/forum/” or would that screw things up?

    Thanks a lot everyone :)

    #64309
    haagendazs1
    Member

    nevermind I just figured it out! it’s in the bb_topicmeta table in the database. thanks everyone! :)

    #3197
    bruinfelix
    Member

    I’am currently working on a Dutch translation file for bbPress, zo maybe today, otherwise today it will be come available ;-)

    #64249

    In reply to: Change Gravatar Size?

    citizenkeith
    Participant

    Thanks Rune. I actually don’t like to hack admin files… Wyvn’s suggestion did the trick. I just made note of the change so I can do it again when I upgrade next.

    Maybe you can submit that for a future version of bbPress. :-)

    #64203
    skehoe
    Member

    sam is there any way I can edit the role map code to account for this. Changing the prefix could cause a lot of problems.

    #3195
    berfarah
    Member

    I want to be able to add the latest post made in a forum section on the front page (and everywhere it lists forums).

    If I try to do that, it will just keep repeating the value for the first throughout the list.

    It’s on this site, if it makes a difference

    Thanks in advance for any help :)

    #64248

    In reply to: Change Gravatar Size?

    Bloggsbe
    Member

    Well, if you like to hack you admin files, you can add the following code to the options-general.php file just after line 143, making this code start on line 144;

    <label for="avatars_size">
    <?php _e('Gravatar Size:'); ?>
    </label>
    <div>
    <select name="avatars_size" id="avatars_size">
    <?php
    $selected = array();
    $selected[bb_get_option('avatars_size')] = ' selected="selected"';
    ?>
    <option value="16"<?php echo $selected[16]; ?>><?php _e('16 px'); ?></option>
    <option value="32"<?php echo $selected['32']; ?>><?php _e('32 px'); ?></option>
    <option value="36"<?php echo $selected['36']; ?>><?php _e('36 px'); ?></option>
    <option value="48"<?php echo $selected['48']; ?>><?php _e('48 px'); ?></option>
    <option value="80"<?php echo $selected['80']; ?>><?php _e('80 px'); ?></option>
    <?php
    unset($selected);
    ?>
    </select>
    </div>

    And in the bb-includes/template-functions.php file, after line 1198 you can add this;

    $size = bb_get_option('avatars_size');

    Then you can change the size in the admin section, and the correct size will show with the posts.

    Or you can download the edited files here

    Rune

    #62868
    Detective
    Member

    It is really easy to add profile fields.

    First, you need to print the fields you need:

    add_action('extra_profile_fields', 'print_extra_fields');
    function print_extra_fields($user_ID) {
    /* get the current values for that user, and print your form items */
    }

    add_action('profile_edited', 'process_extra_fields');
    function process_extra_fields($user_ID){
    /* here, $_POST contains the new field values. so you can do things like bb_update_usermeta($user_ID, 'your_field', $_POST['your_field']); ... */
    }

    Please correct me if i’m wrong. I don’t remember the action names. But this works :) I use it in WP and BBP.

    #63027
    _ck_
    Participant

    I believe you are looking for the functions bb_get_option and get_post_link.

    #63116
    _ck_
    Participant

    Well some are far easier than others.

    First look for $wpdb and change to $bbdb

    Then you have look at things like get_option and other functions and see if they can easily use the bb_get_option or other bb_ version of the function.

    But even if the alternative function exists you have to be sure that it’s doing what you want. Things that relate to users are similar but things that relate to posts have to be change to topics and then there is comments vs posts.

    #64053
    _ck_
    Participant

    Aha! I think it’s this simple. Make yourself a mini-plugin and install it containing this:

    global $bb_roles;
    $bb_roles->remove_cap('member','write_topics');

    If you don’t know how to make a plugin, it might be possible to just put those two lines into your template’s header.php

    #64052
    _ck_
    Participant

    Unlike WordPress I don’t believe bbPress has an easy way to do role management (yet). There is a privilege built-in for bb_current_user_can( 'write_topics' ) which means it is technically possible to control who can start topics by taking away that role privilege from the “member” role.

    In theory a small plugin should be able to do this – I’ll take a look at how it might be done as an exercise in learning more about bbPress roles…

    #64154

    In reply to: Prblem upgrading

    Sam Bauers
    Participant

    Sorry, that should have been:

    $bb->wp_table_prefix = 'wp_';

    #64220
    _ck_
    Participant

    Sounds interesting but:

    Fatal error: Call to undefined function: bb_option() in wp-content/plugins/bbpress-admin/bbpress-options-admin.php on line 38

    Is this for people who has bbPress running INSIDE WordPress, instead of just stand-alone integration?

    #64101
    woodsnwind
    Member

    yes, please, file attachment is valuable for my implementation. I’ll take it as a plugin or hardwired. :)

    #58948
    citizenkeith
    Participant

    Hmm…. not sure to how to change that code without getting errors (I’m running 0.9.0.1 on this particular forum).

    function get_profile_info_keys() {
    return apply_filters(
    'get_profile_info_keys',
    array('user_email' => array(1, __('Email')), 'user_url' => array(0, __('Website')), 'from' => array(0, __('Location')), 'occ' => array(0, __('Occupation')), 'interest' => array(0, __('Interests')))
    );
    }

    function get_profile_admin_keys() {
    global $bbdb;
    return apply_filters(
    'get_profile_admin_keys',
    array($bbdb->prefix . 'title' => array(0, __('Custom Title')))
    );
    }

    #64247

    In reply to: Change Gravatar Size?

    citizenkeith
    Participant

    Thanks Wyvn. It would be nice if there was something in the Admin menu to change this, but for now I’ll just change that file. :)

    #64029
    affacat
    Member

    to better illustrate my issue, my current code for the profile page is:

    if ( avatarupload_get_avatar(ID) ) {

    avatarupload_display($user->ID);

    } else {

    echo bb_get_avatar( $user->ID );

    }

    which means if uploaded avatar exists then display it, else get gravatar.

    but what i really want is:

    if uploaded avatar exists then display it, else if gravatar exists then display that, but if neither exists then display the avatar upload default avatar.

    Right now it displays gravatar default instead. which isn’t my first choice since avatar upload would give me control over the default image which is better for obvious reasons.

    feelie75
    Member

    This is the code that was making the call and getting the return false returned to it, thus resulting in this error:

    if (!$bbdb->db_connect(‘SHOW TABLES;’)) {

    $this->step_status[1] = ‘incomplete’;

    $this->strings[1][] = __(‘There was a problem connecting to the database you specified.
    Please check the settings, then try again.’);

    return ‘error’;

    }

    db_connect was returning false when it detected $this->$dbhname was undef. So by removing the return false when that happened, the db_connect call then succeeded and all was happy :).

    To answer the other person, I’m hosting on localhost. I have an old PowerPC Mac running OS X 10.4.11 or something. It’s a spare computer; thought I’d stick a forum on it and learn some php.

    #64239
    arlene476
    Member

    There is an answer here, https://bbpress.org/forums/topic/require_oncepathtowp-blog-headerphp

    Saying:

    Put in the full path from the server root instead of the relative path.

    But I don’t know how to code it and what line to place it

    #64212

    this order: WP 2.3, bbpress 0.8 (no integration with plugins at that time!), WP 2.5, bbpress 0.9

    I patently waited with integration until 0.9 was out since I did not understand the whole thing before. And everything seems to work fine. Just as soon as I add the WP_ prefix setting to my bbpress config, it seems as if bbpress can only access the WP users anymore (with the correct role mapping i set up etc.).

    maybe I should just ask all registered users to reregister after integration, since the forum is pretty new anyway ;-)

    chrishajer
    Participant

    Sorry, I forgot I was talking about tags.php specifically. Here’s a tags URL.

    http://www.riversideinfo.org/forum/tags.php?tag%3Dtif

    is what’s in the sitemap.

    curl -I "http://www.riversideinfo.org/forum/tags.php?tag%3Dtif"

    returns a 302 header.

    If you unencode it, and then curl -I:

    curl -I "http://www.riversideinfo.org/forum/tags.php?tag=tif"

    returns a 200 header.

    Maybe it’s just the urlencoding of the = that causes it to redirect? That’s the only difference between the two URLs here.

    chrishajer
    Participant

    Here’s an example of a URL in the sitemap.

    http://www.riversideinfo.org/forum/topic.php?id%3D3%26page%26replies%3D1

    If you do a

    curl -I http://www.riversideinfo.org/forum/topic.php?id%3D3%26page%26replies%3D1 you get a 302 header back. If you URL unencode the URL and do a curl -I, you get back a proper 200:

    curl -I "http://www.riversideinfo.org/forum/topic.php?id=3&page&replies=1"

    I am not using permalinks or slugs, and that plugin author doesn’t seem to have updated it since I installed it long ago. I actually turned it off a while ago because of the amount of time it was taking to generate the sitemap for 5000 posts.

    http://boakes.org/talk/topic/31

    So, I guess the question is, why does that first URL trigger a 302? Maybe the sitemap plugin is creating URLs that are poorly formed?

Viewing 25 results - 27,851 through 27,875 (of 32,462 total)
Skip to toolbar