Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 21,751 through 21,775 (of 32,481 total)
  • Author
    Search Results
  • #33856
    zaerl
    Participant

    Hi there. I’m writing a small plugin and I need to check if the actual page is the last page of a topic. I’ve seen that this is the standard way:

    if(bb_current_user_can('write_posts') && bb_is_topic())
    {
    global $topic, $page;
    $add = topic_pages_add();
    $last_page = get_page_number( $topic->topic_posts + $add );

    if($last_page == $page) do whatever you want
    }

    but I want to use this code during the bb_init callback. It doesn’t work and after some simple tests I’ve seen that $topic isn’t defined (yet). Is there a way to get last page during this callback?

    Thanks in advance.

    #85701

    This is fairly simple to do, but you have to define exactly what you want it to do.

    i.e. Are you looking for forum topics that include any of the Tags in the blog post? This means that there will be no ordering or weighting on relavancy.

    This line of WP code will help you on your way too:

    $tags = wp_get_post_tags($post->ID);

    #86105

    In reply to: https problem?

    royho
    Participant

    Although this is the code for WordPress it might be universal to BB Press as well. Open up your bb-config.php and add this line:

    define('FORCE_SSL_ADMIN', true);

    #86247
    absolutex
    Member

    simple

    —> how to increase topic length bbpress (2 posts) (2 voices)

    Topic title length :D

    #85911
    Kevin Ryman
    Participant

    Something people always seem to be asking around here… Integrating bbPress to an existing overall page design. In other words, how to create a matching bbPress theme for your site. :)

    #86123
    Gautam Gupta
    Participant

    Or you may use this, if the above doesn’t work for you:

    <?php
    function unset_arel( $tags ) {
    unset( $tags['a']['rel'] );
    return $tags;
    }
    add_filter( 'bb_allowed_tags', 'unset_arel', -1 );
    ?>

    #86122
    Gautam Gupta
    Participant

    Put this in your theme’s function.php (create one if it is not there):

    <?php
    function change_dofollow_to_nofollow( $content ) {
    return str_replace( array( ' rel="dofollow"', " rel='dofollow'" ), ' rel="nofollow"', $content );
    }
    add_filter( 'post_text', 'change_dofollow_to_nofollow', -1 );
    ?>

    #86214

    In reply to: IRC Chats

    Kevin Ryman
    Participant

    You probably haven’t miss anything… :/

    #86199
    royho
    Participant

    Try this, in your CSS, put a statement like this.

    table#forumlist tr.bb-child {
    text-indent:50px !important;
    }

    That will indent out the sub-forums…

    #65338
    Kevin Ryman
    Participant

    I know this is an old topic but this theme is available for download at http://www.bbpressthemes.net/genealogias/ :)

    #76031
    juboe
    Member

    Okay, so I found it. I opened it in WordPad, added my link code after this:

    <div id=”header” role=”banner”>

    saved it, and closed WordPad.

    I then browsed back to the forum and nothing has changed. Can someone shed some light on this?

    Thanks,

    juboe

    #85766
    zaerl
    Participant

    Hi Tom, thank for your answer. Unfortunately I cannot took out the display name feature because my mother language isn’t english and in my idiom it’s impossible to write significant portion of text without using characters outside the ASCII base and as far as I know unicode characters can’t be used in login names.

    Anyway I think that I will hack the core even if I know that this isn’t a good thing. I think that I will add an extra check in $wp_users_object->update_user() which in turn call _put_user.

    #85765
    deadlyhifi
    Participant

    I was having this problem on my forum so I took out the display name feature.

    See https://bbpress.org/forums/topic/help-with-basic-command-to-add-new-profile-fields#post-65468

    And delete 'display_name' => array(1, __('Display name as')),

    #86187
    absolutex
    Member

    ok i get it to work :D

    find in meta database and change this table

    meta key

    user_bbdb_name

    and

    user_bbdb_user

    :D

    #86084

    In reply to: Umlaut in member name

    Dailytalker
    Member

    I solved the problem by adding the following additional code to the plugin:

    add_filter( 'get_user_display_name', 'rk_display_name' );

    function rk_display_name($name, $ID = 0) {

    if ( !seems_utf8( $name ) )

    return utf8_encode( $name );

    return $name;

    }

    #86168
    radovanx
    Member

    0.9 yes i use template where i can put le code for this ? thanks

    #54441

    In reply to: Add nofollow to links

    Hi,

    since i have the forum in a different frame of my page, i’d have to add the attribute “target_top” to every link.

    The code below is only for target_blank, or would it be possible to replace every “blank” with “top” and have it working?


    https://bbpress.org/forums/topic/add-nofollow-to-links#post-17523&#8243;


    And how do you make the code into a plugin? you copy and paste into a text file, save it as *.php and upload the file in the bbpress plugins folder?

    Thank you very much, every help is very appreciated!

    The Process

    #86128
    gerikg
    Member

    “manage the bbpress forum via the same admin login as the primary WP install.”

    https://wordpress.org/extend/plugins/bbpress-admin/

    “…main wp widgetized sidebar”

    If you did the deep integration you just have to stick <?php getsidebar() ?;> somewhere in you bbpress theme file then mess with you bbpress css to make it fit.

    “..same sort of functionality with editing php and css templates, etc. in bbpress as with WP”

    no such thing

    #86120
    fifthhouse
    Member

    Thanks everyone! I should be able to work this out with these plugins and guidelines. Cheers :)

    #85909
    Kevin Ryman
    Participant

    Once again, nice video tutorial. Keep them coming! :)

    #86118
    johnhiler
    Member

    There’s a nice Mass Delete Users plugin that lets you batch delete members:

    https://bbpress.org/plugins/topic/mass-delete-users/

    I’ve used it before, and it’s great!

    Just make sure to backup your data first, just to be on the safe side. :-)

    I think there are also plugins you can install to disable registration. Let me know if you are interested, and I can try to track one down!

    Kevin Ryman
    Participant

    Even though you changed your mind, this question of yours may come in handy to someone else. Thank you for asking. :)

    #85880
    Gautam Gupta
    Participant

    @Steven

    In the bb Attachments FAQ, it is written:

    if you get error: denied mime on every upload, mime_content_type function or shell access must exist to verify mime types – otherwise you can force all types to be allowed by editing bb-attachments.php and adding 'application/octet-stream' to each of the $bb_attachments['allowed']['mime_types']

    And as I can see in the dump you pasted, neither mime_content_type is enabled, nor shell access, so you would need to add 'application/octet-stream' to each of the $bb_attachments['allowed']['mime_types'] in bb-attachments.php.

    #86080

    In reply to: Umlaut in member name

    Dailytalker
    Member

    I looked a bit around and found a peace of code with which I was able to create a plugin.

    <?php

    /*

    Plugin Name: UTF-8 usernames

    Description: This plugin enables utf-8 characters in usernames. Mbstring must be enabled in the php.ini.

    */

    function sanitize_user_mbstring( $raw_username, $username, $strict = false ) {

    $raw_username = $username;

    $username = strip_tags($username);

    // Kill octets

    $username = preg_replace(‘|%([a-fA-F0-9][a-fA-F0-9])|’, ”, $username);

    $username = preg_replace(‘/&.+?;/’, ”, $username); // Kill entities

    // Usage of ‘mb_ereg_replace’ instead of ‘preg_replace’ to preserve accents.

    if ( $strict )

    $username = mb_ereg_replace(‘|[^a-z0-9 _.-@]|i’, ”, $username);

    return apply_filters(‘sanitize_user_mbstring’, $username, $raw_username, $strict);

    }

    add_action(‘sanitize_user’, ‘sanitize_user_mbstring’, 0, 3);

    ?>

    Unfortunately it doesn’t work properly. When it displays correctly in bbpress it doesn’t in wordpress and reverse. I don’t have access to the php.ini. Could it be, that the thing with “mbstring” is the problem?

    #77528

    In reply to: All RSS Feeds Broken?

    Dailytalker
    Member

    I solved the problem!

    I removed all “»” in the rss.php

    Replace the code of your rss.php with the following code and it should work:

    <?php<br />
    require('./bb-load.php');</p>
    <p>// Determine the type of feed and the id of the object<br />
    if ( isset($_GET['view']) || bb_get_path() == 'view' ) {</p>
    <p> // View<br />
    $feed = 'view';<br />
    $feed_id = isset($_GET['view']) ? $_GET['view'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['topic']) || bb_get_path() == 'topic' ) {</p>
    <p> // Topic<br />
    $feed = 'topic';<br />
    $topic = get_topic(isset($_GET['topic']) ? $_GET['topic'] : bb_get_path(2));<br />
    $feed_id = $topic->topic_id;</p>
    <p>} elseif ( isset($_GET['profile']) || bb_get_path() == 'profile' ) {</p>
    <p> // Profile<br />
    $feed = 'profile';<br />
    $feed_id = isset($_GET['profile']) ? $_GET['profile'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['tag']) || bb_get_path() == 'tags' ) {</p>
    <p> if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
    // Tag recent topics<br />
    $feed = 'tag-topics';<br />
    } else {<br />
    // Tag recent posts<br />
    $feed = 'tag-posts';<br />
    }<br />
    $feed_id = isset($_GET['tag']) ? $_GET['tag'] : bb_get_path(2);</p>
    <p>} elseif ( isset($_GET['forum']) || bb_get_path() == 'forum' ) {</p>
    <p> if ( isset($_GET['topics']) || bb_get_path(3) == 'topics' ) {<br />
    // Forum recent topics<br />
    $feed = 'forum-topics';<br />
    } else {<br />
    // Forum recent posts<br />
    $feed = 'forum-posts';<br />
    }<br />
    $forum = bb_get_forum(isset($_GET['forum']) ? $_GET['forum'] : bb_get_path(2));<br />
    $feed_id = $forum->forum_id;</p>
    <p>} elseif ( isset($_GET['topics']) || bb_get_path() == 'topics' ) {</p>
    <p> // Recent topics<br />
    $feed = 'all-topics';</p>
    <p>} else {</p>
    <p> // Recent posts<br />
    $feed = 'all-posts';</p>
    <p>}</p>
    <p>// Initialise the override variable<br />
    $bb_db_override = false;<br />
    do_action( 'bb_rss.php_pre_db' );</p>
    <p>if ( !$bb_db_override ) {</p>
    <p> // Get the posts and the title for the given feed<br />
    switch ($feed) {<br />
    case 'view':<br />
    if ( !isset($bb_views[$feed_id]) )<br />
    die();<br />
    if ( !$bb_views[$feed_id]['feed'] )<br />
    die();<br />
    if ( !$topics_object = new BB_Query( 'topic', $bb_views[$feed_id]['query'], "bb_view_$feed_id" ) )<br />
    die();</p>
    <p> $topics = $topics_object->results;<br />
    if ( !$topics || !is_array($topics) )<br />
    die();</p>
    <p> $posts = array();<br />
    foreach ($topics as $topic) {<br />
    $posts[] = bb_get_first_post($topic->topic_id);<br />
    }</p>
    <p> $title = esc_html( sprintf( __( '%1$s View: %2$s' ), bb_get_option( 'name' ), $bb_views[$feed_id]['title'] ) );<br />
    $link = get_view_link($feed_id);<br />
    $link_self = bb_get_view_rss_link($feed_id);<br />
    break;</p>
    <p> case 'topic':<br />
    if ( !$topic = get_topic ( $feed_id ) )<br />
    die();<br />
    if ( !$posts = get_thread( $feed_id, 0, 1 ) )<br />
    die();<br />
    $title = esc_html( sprintf( __( '%1$s Topic: %2$s' ), bb_get_option( 'name' ), get_topic_title() ) );<br />
    $link = get_topic_link($feed_id);<br />
    $link_self = get_topic_rss_link($feed_id);<br />
    break;</p>
    <p> case 'profile':<br />
    if ( bb_get_option( 'mod_rewrite' ) === 'slugs' ) {<br />
    $user = bb_get_user_by_nicename( $feed_id );<br />
    } else {<br />
    $user = bb_get_user( $feed_id );<br />
    }<br />
    if ( !$user ) {<br />
    die();<br />
    }<br />
    if ( !$posts = get_user_favorites( $user->ID ) ) {<br />
    die();<br />
    }<br />
    $title = esc_html( sprintf( __( '%1$s User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_login ) );<br />
    $link = bb_get_profile_link($feed_id);<br />
    $link_self = get_favorites_rss_link($feed_id);<br />
    break;</p>
    <p> case 'tag-topics':<br />
    if ( !$tag = bb_get_tag( $feed_id ) )<br />
    die();<br />
    if ( !$topics = get_tagged_topics( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
    die();</p>
    <p> $posts = array();<br />
    foreach ($topics as $topic) {<br />
    $posts[] = bb_get_first_post($topic->topic_id);<br />
    }</p>
    <p> $title = esc_html( sprintf( __( '%1$s Tag: %2$s - Recent Topics' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
    $link = bb_get_tag_link($feed_id);<br />
    $link_self = bb_get_tag_topics_rss_link($feed_id);<br />
    break;</p>
    <p> case 'tag-posts':<br />
    if ( !$tag = bb_get_tag( $feed_id ) )<br />
    die();<br />
    if ( !$posts = get_tagged_topic_posts( array( 'tag_id' => $tag->tag_id, 'page' => 0 ) ) )<br />
    die();<br />
    $title = esc_html( sprintf( __( '%1$s Tag: %2$s - Recent Posts' ), bb_get_option( 'name' ), bb_get_tag_name() ) );<br />
    $link = bb_get_tag_link($feed_id);<br />
    $link_self = bb_get_tag_posts_rss_link($feed_id);<br />
    break;</p>
    <p> case 'forum-topics':<br />
    if ( !$topics = get_latest_topics( $feed_id ) )<br />
    die();</p>
    <p> $posts = array();<br />
    foreach ($topics as $topic) {<br />
    $posts[] = bb_get_first_post($topic->topic_id);<br />
    }</p>
    <p> $title = esc_html( sprintf( __( '%1$s Forum: %2$s - Recent Topics' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
    $link = get_forum_link($feed_id);<br />
    $link_self = bb_get_forum_topics_rss_link($feed_id);<br />
    break;</p>
    <p> case 'forum-posts':<br />
    if ( !$posts = bb_get_latest_forum_posts( $feed_id ) )<br />
    die();<br />
    $title = esc_html( sprintf( __( '%1$s Forum: %2$s - Recent Posts' ), bb_get_option( 'name' ), get_forum_name( $feed_id ) ) );<br />
    $link = get_forum_link($feed_id);<br />
    $link_self = bb_get_forum_posts_rss_link($feed_id);<br />
    break;</p>
    <p> // Get just the first post from the latest topics<br />
    case 'all-topics':<br />
    if ( !$topics = get_latest_topics() )<br />
    die();</p>
    <p> $posts = array();<br />
    foreach ($topics as $topic) {<br />
    $posts[] = bb_get_first_post($topic->topic_id);<br />
    }</p>
    <p> $title = esc_html( sprintf( __( '%1$s Recent Topics' ), bb_get_option( 'name' ) ) );<br />
    $link = bb_get_uri();<br />
    $link_self = bb_get_topics_rss_link();<br />
    break;</p>
    <p> // Get latest posts by default<br />
    case 'all-posts':<br />
    default:<br />
    if ( !$posts = bb_get_latest_posts( 35 ) )<br />
    die();<br />
    $title = esc_html( sprintf( __( '%1$s Recent Posts' ), bb_get_option( 'name' ) ) );<br />
    $link = bb_get_uri();<br />
    $link_self = bb_get_posts_rss_link();<br />
    break;<br />
    }<br />
    }</p>
    <p>bb_send_304( $posts[0]->post_time );</p>
    <p>if (!$description = esc_html( bb_get_option('description') )) {<br />
    $description = $title;<br />
    }<br />
    $title = apply_filters( 'bb_title_rss', $title, $feed );<br />
    $description = apply_filters( 'bb_description_rss', $description, $feed );<br />
    $posts = apply_filters( 'bb_posts_rss', $posts, $feed );<br />
    $link_self = apply_filters( 'bb_link_self_rss', $link_self, $feed );</p>
    <p>bb_load_template( 'rss2.php', array('bb_db_override', 'title', 'description', 'link', 'link_self'), $feed );</p>
    <p>?>

Viewing 25 results - 21,751 through 21,775 (of 32,481 total)
Skip to toolbar