Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'bbpress'

Viewing 25 results - 61,476 through 61,500 (of 64,414 total)
  • Author
    Search Results
  • #56961
    Vili
    Participant

    Ok, here’s what I have, commented. The comments that start with “VILI” are mine.

    Please keep in mind two things:

    a) This is strictly speaking a WordPress plugin, not a bbPress one. The functionality is simply extended to also cover an integrated bbPress installation. (And yes, this means that you need to install this in your WordPress, not your bbPress.)

    b) I hacked this for my own purposes, so it may not be pretty, and it certainly won’t be ready for use without you reading through the code. If someone is interested in working to make it functional as an “out of the box” solution, then by all means go ahead.

    Finally, the original Dan’s Avatar Thingy can be found here.

    <?php
    /*
    Plugin Name: Vili's Avatar Thingy
    Plugin URI: http://www.vertebratesilence.com/
    Description: Displays an avatar next to posts or comments based on username. Based on Dan's Avatar Thingy (http://www.cheesemasterdan.com/).
    Version: 0.1
    Author: Vili Maunula
    Author URI: http://www.vertebratesilence.com/
    */

    // Variable declarations
    // VILI: These were changed from Dan's Avatar Thingy, in which you only had default
    // size settings into which all avatars were resized.

    $avatar_max_width = 100; // Max avatar width
    $avatar_max_height = 100; // Max avatar height
    $avatar_max_upload_size = 15360; // Max file size in bytes
    $avatars_path = ABSPATH."wp-content/avatars";

    function cmd_show_avatar()
    {
    global $wpdb;
    global $avatars_path;

    // VILI: The following is a boolean setting I use to detect whether the page
    // being served is a forum page. In practice, I have
    // <?php global $forumpage;
    // $forumpage = TRUE; ?>
    // at the beginning of each forum page (I use WordPress headers in my integrated
    // setup, but if your bbPress uses its own headers, just stick it there). If
    // anyone knows a more cost-efficient way of detecting whether a page shown is
    // a forum page, let me know.
    global $forumpage;

    if ($forumpage == FALSE) {
    $the_author_name = get_comment_author();
    if($the_author_name == "" or $the_author_name == __('Anonymous'))
    { // Avatar for posts
    $the_author = get_the_author_id();
    $the_author_name = get_the_author();
    } else { // Avatar for comments - only for registered users
    $the_comment_ID = get_comment_ID();
    $the_author = $wpdb->get_var("SELECT user_ID FROM $wpdb->comments WHERE comment_ID='$the_comment_ID'");
    }
    } else {
    $the_author_name = get_post_author();
    $the_author = get_post_author_id();
    }

    $image_path = get_bloginfo('wpurl')."/wp-content/avatars/";
    $the_avatar = $image_path.$the_author.".jpg";
    if(file_exists("$avatars_path/$the_author.jpg"))
    {
    echo '<img src="' . $the_avatar. '" alt="' . $the_author_name . '" class="cmd-avatar" />';
    } elseif(file_exists("$avatars_path/default.jpg")) {
    echo '<img src="' . $image_path . 'default.jpg" alt="Unregistered" class="cmd-avatar" />';
    }
    // If the file doesn't exist then return nothing...
    }

    add_action ('admin_menu', 'cmd_avatar_menu');

    function cmd_avatar_menu()
    {
    add_submenu_page('profile.php', '', 'Your Avatar', 0, __FILE__, 'cmd_avatar_profile');
    }

    function cmd_avatar_profile()
    {
    global $userdata;
    global $avatar_max_width;
    global $avatar_max_height;
    global $avatar_max_upload_size;
    global $avatars_path;
    get_currentuserinfo();

    if(!file_exists($avatars_path))
    {
    $mkdir_result = @mkdir($avatars_path, "0755");
    if(!$mkdir_result)
    {
    echo '<div id="message" class="error fade">The folder' . $avatars_path . ' does not exist and could not be created automatically. Please create it and assign 0755 permissions then try using this plugin again.
    </div>';
    die();
    }
    }

    if ($_POST['cmd_action'] == 'upload_avatar')
    {
    if ($_FILES['cmd_avatar_file']['size'] > 0 && $_FILES['cmd_avatar_file']['size'] < $_POST['MAX_FILE_SIZE'])
    {
    $uploaddir = ABSPATH."wp-content/avatars/";
    $uploadfile = $uploaddir . $userdata->ID . '.jpg';
    list($width, $height, $type, $attr) = getimagesize($_FILES['cmd_avatar_file']['tmp_name']);

    // VILI: The following calculates the size into which the
    // image needs to be put. If it's under the MAX limits, nothing
    // is done, otherwise resizing takes place. This probably
    // could be written more elegantly.

    $widthratio = $width / $avatar_max_width;
    $heightratio = $height / $avatar_max_height;
    if ($widthratio > 1 && $heightratio > 1 && $widthratio > $heightratio) {
    $usewidth = $width / $widthratio;
    $useheight = $height / $widthratio;
    } elseif ($widthratio > 1 && $heightratio > 1 && $widthratio < $heightratio) {
    $useheight = $height / $heightratio;
    $usewidth = $width / $heightratio;
    } elseif ($widthratio > 1) {
    $usewidth = $width / $widthratio;
    $useheight = $height / $widthratio;
    } elseif ($heightratio > 1) {
    $useheight = $height / $heightratio;
    $usewidth = $width / $heightratio;
    } else {
    $usewidth = $width;
    $useheight = $height;
    }

    $cmd_avatar_image = imagecreatetruecolor ($usewidth, $useheight);
    switch ($type)
    {
    case 1: // GIF
    $image = imagecreatefromgif($_FILES['cmd_avatar_file']['tmp_name']);
    imagecopyresampled($cmd_avatar_image, $image, 0, 0, 0, 0, $usewidth, $useheight, $width, $height);
    $avatar_created = (imagejpeg($cmd_avatar_image, $uploadfile, 100) ? TRUE : FALSE);
    imagedestroy($image);
    imagedestroy($cmd_avatar_image);
    break;
    case 2: // JPEG
    $image = imagecreatefromjpeg($_FILES['cmd_avatar_file']['tmp_name']);
    imagecopyresampled($cmd_avatar_image, $image, 0, 0, 0, 0, $usewidth, $useheight, $width, $height);
    $avatar_created = (imagejpeg($cmd_avatar_image, $uploadfile, 100) ? TRUE : FALSE);
    imagedestroy($image);
    imagedestroy($cmd_avatar_image);
    break;
    case 3: // PNG
    $image = imagecreatefrompng($_FILES['cmd_avatar_file']['tmp_name']);
    imagecopyresampled($cmd_avatar_image, $image, 0, 0, 0, 0, $usewidth, $useheight, $width, $height);
    $avatar_created = (imagejpeg($cmd_avatar_image, $uploadfile, 100) ? TRUE : FALSE);
    imagedestroy($image);
    imagedestroy($cmd_avatar_image);
    break;
    default:
    $avatar_created = FALSE;
    break;
    }
    if ($avatar_created) {
    echo '<div id="message" class="updated fade">File uploaded successfully.
    </div>';
    } else {
    echo '<div id="message" class="error fade">File upload failed.
    </div>';
    }
    }
    }
    echo '
    <div class="wrap">
    <h2>Your Avatar</h2>
    <form name="cmd_avatar" id="your-profile" action="' . $PHP_SELF . '" method="post" enctype="multipart/form-data">
    <fieldset>
    <legend>Avatar</legend>';

    $the_user = $userdata->ID;

    $avatars_path = ABSPATH."wp-content/avatars";
    $image_path = get_bloginfo('wpurl')."/wp-content/avatars/";
    $the_avatar = $image_path.$the_user.".jpg";

    if(file_exists("$avatars_path/$the_user.jpg")){
    echo '
    <img src="' . $the_avatar . '" alt="' . $userdata->user_login . '" class="cmd-avatar">';
    } else {
    echo 'No avatar found...';
    }
    echo '

    <label>Filename: </label>
    <input type="file" accept="Pictures" name="cmd_avatar_file" />

    <input type="hidden" name="MAX_FILE_SIZE" value="' . $avatar_max_upload_size . '" />
    <input type="hidden" name="cmd_action" value="upload_avatar" />
    Click browse to find your avatar image. It can be JPG, GIF or PNG and should be ' . $avatar_max_width . ' x ' . $avatar_max_height . ' pixels or less (if bigger, it will be resized).Images should also be no larger than ' . $avatar_max_upload_size / 1024 . 'KBCurrently animated GIFs are not supported.
    </fieldset>
    <br clear="all" />
    <p class="submit">
    <input type="submit" name="cmd_avatar_update" value="Update Profile &raquo;" />

    </form>
    </div>';
    }

    ?>

    #51032

    In reply to: Topic views

    wittmania
    Member

    Your wish is my command…

    https://bbpress.org/forums/topic/1121

    #57223
    wittmania
    Member

    Got it figured out! I studied up on how to use session variables, and that gave me the answer I was looking for. By passing the “last topic ID” variable, I could check to see if it matched the “current topic ID” variable. If it matches, it leaves the record alone. If it’s different, it adds a tick to the counter.

    The post for the completed plugin is here:

    https://bbpress.org/forums/topic/1121

    #1805
    wittmania
    Member

    bb-Topic-Views keeps track of how many times each topic has been viewed, and then displays the count alongside the title of the topic on the front page, on forums pages, and on tags pages.

    The plugin is written in such a way that it does not double-count views when a visitor browses to a different page in the same topic. If no view count record exists for a specific topic, the plugin will create a record for it. Rather than setting the initial view count to zero, the plugin sets it to the number of posts in the topic, because it has obviously been viewed at least as many times as people have posted in it! This is especially nice for adding the plugin to existing bbpress forums so the view count isn’t zero for every single topic.

    You can download it here: http://blog.wittmania.com/bb-topic-views

    You can see it in action here: http://blog.wittmania.com/bbpress

    By the way, I’ve only tested this plugin in browser environments where cookies were enabled. This plugin doesn’t set any cookies (directly, anyway), but it does use session variables which are usually passed as cookies. So, if anyone runs into any bugs, please let me know!

    I’m also very open to suggestions as to how I could streamline or improve the code. Thanks!

    #1804
    smurfdude
    Member

    Does anyone know of a way to include wordpress profile data (posts for example) into the bbpress profile page?

    #1793
    wittmania
    Member

    I am working on a “Topic Views Count” plugin, and I’m just about finished with it. You can see a working version of it here: http://blog.wittmania.com/bbpress/, and see the source code as it is right now here: http://blog.wittmania.com/files/bb-topic-views.txt

    The only thing holding me up is this; I can’t figure out a way to keep the views count from including page views. For example, when page one of a topic loads, the view count will go up by one. But, when page two loads it will also go up by one. So, a visitor has only viewed the topic once (albeit they’ve viewed more than one page), but the counter has registered two views).

    I know this isn’t a huge deal, and a counter that over-counts is better than no counter at all. Still, I was wondering if anyone would have any ideas. I’d like to avoid using cookies, if possible, because I have no experience with them at all to even know where to start.

    Any ideas? I’m also open to any other ideas or suggestions for the rest of the code.

    Thanks!

    #57248
    Trent Adams
    Member
    #57229
    Trent Adams
    Member
    #57256
    lokem001
    Member

    After hours of troubleshooting I finally got to the problem, by luck!

    While going through the extensions in php.ini, I noticed the php_mysql.dll was disabled. So I enabled it, and bbpress started to work out great!

    So it didn’t really have anything to do with gettext, but without that tip I guess I wouldn’t have checked the extensions at all!

    Thanks for the help, all of you!

    #57228
    fel64
    Member

    Cheers!

    Further hack here, to migrate any comments made to WP posts that have a corresponding bb topic (via the bbPress Post plugin again) as replies to the thread. Unfortunately the date/time won’t be right, it’ll be like a new post just made.

    This needs to be installed/activated as a plugin to work, and to prevent it somehow accidentally happening again I suggest you immediately uninstall it. To run it, simply append “?lulz=p” to a URL and it’ll get to work – make sure you only do this once! An interface would be a lot neater, but, well, meh.

    At your own risk.

    <?php
    /*
    Plugin Name: Comments migrate
    Plugin URI:
    Description: moves wp comments into bb posts.
    Author: fel64
    Version: 0.7
    Author URI: http://www.loinhead.net/
    */
    function felmigrate()
    {
    global $bbdb, $bb_table_prefix;
    //foreach blogpost/topic in wp_bbpress_post_posts
    $bridge = $bbdb->get_results( ' SELECT post_id, topic_id
    FROM wp_bbpress_post_posts', ARRAY_A );
    foreach( $bridge as $sumthing => $link )
    {
    //foreach comment
    $wppost = $link['post_id'];
    $bbtopic = $link['topic_id'];
    $felcoms = $bbdb->get_results( " SELECT comment_author, comment_date, comment_content, comment_author_IP
    FROM wp_comments
    WHERE comment_post_ID = $wppost" );
    if( $felcoms )
    {
    foreach( $felcoms as $sumthing => $felcom )
    {
    //if valid user
    $felu = bb_get_user_by_name( $felcom->comment_author );
    if( $felu )
    {
    //create new post in that thread with said details
    fel_new_post( $bbtopic, $felcom, $felu->ID );
    }
    }
    }
    }
    //party
    }
    function fel_new_post( $topic_id, $post_details, $felID ) {
    global $bbdb, $bb_cache, $bb_table_prefix, $thread_ids_cache;
    $topic_id = (int) $topic_id;

    $bb_post = $post_details->comment_content;
    //$bb_post = apply_filters('pre_post', $bb_post, false, $topic_id);
    $bb_post = htmlspecialchars( $bb_post, ENT_QUOTES );
    $post_status = 0;
    $now = bb_current_time('mysql');
    //$now = $post_details->comment_date;
    $uid = $felID;
    $uname = $post_details->comment_author;
    $ip = $post_details->comment_author_IP;

    $topic = get_topic( $topic_id );
    $forum_id = $topic->forum_id;

    if ( $bb_post && $topic ) {
    $topic_posts = ( 0 == $post_status ) ? $topic->topic_posts + 1 : $topic->topic_posts;
    $bbdb->query("INSERT INTO $bbdb->posts
    (forum_id, topic_id, poster_id, post_text, post_time, poster_ip, post_status, post_position)
    VALUES
    ('$forum_id', '$topic_id', '$uid', '$bb_post','$now', '$ip', '$post_status', $topic_posts)");
    $post_id = $bbdb->insert_id;
    if ( 0 == $post_status ) {
    $bbdb->query("UPDATE $bbdb->forums SET posts = posts + 1 WHERE forum_id = $topic->forum_id");

    /* if( $now < $topic->topic_time )
    {
    $now = $topic->topic_time;
    $uid = $topic->topic_last_poster;
    $uname = $topic->topic_last_poster_name;
    $post_id = $topic->topic_last_post_id;
    }
    */ $bbdb->query("UPDATE $bbdb->topics SET topic_time = '$now', topic_last_poster = '$uid', topic_last_poster_name = '$uname',
    topic_last_post_id = '$post_id', topic_posts = '$topic_posts' WHERE topic_id = '$topic_id'");
    if ( isset($thread_ids_cache[$topic_id]) ) {
    $thread_ids_cache[$topic_id]['post'][] = $post_id;
    $thread_ids_cache[$topic_id]['poster'][] = $uid;
    }
    $post_ids = get_thread_post_ids( $topic_id );
    if ( !in_array($uid, array_slice($post_ids['poster'], 0, -1)) )
    bb_update_usermeta( $uid, $bb_table_prefix . 'topics_replied', $bb_current_user->data->topics_replied + 1 );
    } else
    bb_update_topicmeta( $topic->topic_id, 'deleted_posts', isset($topic->deleted_posts) ? $topic->deleted_posts + 1 : 1 );
    if ( !bb_current_user_can('throttle') )
    bb_update_usermeta( $uid, 'last_posted', time() );
    $bb_cache->flush_one( 'topic', $topic_id );
    $bb_cache->flush_many( 'thread', $topic_id );
    $bb_cache->flush_many( 'forum', $forum_id );
    do_action('bb_new_post', $post_id);
    return $post_id;
    } else {
    return false;
    }
    }

    //plunge
    if( $_GET['lulz'] = 'p' )
    felmigrate();
    ?>

    #57293

    In reply to: MathML and BBpress

    dprice
    Member

    I’ve found a way around this finally, and will be posting up a ‘math-pack’ version of BBpress. I did have to edit /bb-includes/formattingfunctions.php (2 lines – commented out a regular expression).

    Basically, the way I came up with was using ASCIIMath.js to replace stuff in backticks. I’ll get a zip up when I have the time (actually hacing to do the maths uses up most of my time)

    #57292

    In reply to: MathML and BBpress

    Trent Adams
    Member

    My guess would be that it would be in /bb-includes/formatingfunctions.php somewhere, but I am not sure….

    Trent

    #57286

    In reply to: LaTex support

    Trent Adams
    Member

    Mdawaffe actually added the support for this in wordpress.com recently and should be able to fire something up for bbPress. Maybe he will see this forum post and do something on it!

    Trent

    #1803

    Topic: MathML and BBpress

    in forum Plugins
    dprice
    Member

    Ok, I’ve been poking around the forums, found out how to get new allowed tags (thanks to Louise Dade + others) and now want to add MathML tag support, so users can post MathML.

    A big problem is that the editor box seems to add line break <br /> tags to every line – how do you turn this off?

    The array I’m using in the plugin is:

    `$tags = array(

    // XHTML elements:

    'a' => array(

    'href' => array(),

    'hreflang' => array(),

    'title' => array(),

    'rel' => array(),

    'xml:lang' => array()),

    'abbr' => array('title' => array()),

    'acronym' => array('title' => array()),

    'b' => array(),

    'bdo' => array(

    'dir' => array(),

    'xml:lang' => array()),

    'blockquote' => array('cite' => array()),

    'br' => array(),

    'code' => array(),

    // 'del' => array('datetime' => array()),

    'dd' => array(),

    'dl' => array(),

    'div' => array(

    'dir' => array(),

    'xml:lang' => array()),

    'dt' => array(),

    'em' => array(),

    'i' => array(

    'dir' => array(),

    'xml:lang' => array()),

    // 'ins' => array('datetime' => array(), 'cite' => array()),

    'li' => array(),

    'ol' => array(),

    'p' => array(),

    'pre' => array(),

    // 'q' => array(),

    // 'strike' => array(),

    'span' => array(

    'dir' => array(),

    'xml:lang' => array()),

    'strong' => array(),

    'sub' => array(),

    'sup' => array(),

    'u' => array(),

    'ul' => array(),

    // MathML elements:

    'math' => array(

    'xmlns' => array(),

    'mode' => array()),

    'mo' => array(

    'lspace' => array(),

    'rspace' => array(),

    'fence' => array(),

    'separator' => array()),

    'mi' => array('mathvariant' => array()),

    'msub' => array(),

    'msup' => array(),

    'msubsup' => array(),

    'mfrac' => array('linethickness' => array()),

    'mn' => array(),

    'mstyle' => array(

    'scriptlevel' => array(),

    'fontstyle' => array(),

    'fontweight' => array(),

    'mathvariant' => array(),

    'displaystyle' => array()),

    'mtext' => array(),

    'mspace' => array(

    'width' => array(),

    'height' => array(),

    'depth' => array()),

    'msqrt' => array(),

    'mmultiscripts' => array(),

    'mprescripts' => array(),

    'none' => array(),

    'mroot' => array(),

    'mphantom' => array(),

    'merror' => array(),

    'mover' => array(),

    'munder' => array(),

    'munderover' => array(),

    'maction' => array(

    'actiontype' => array(),

    'other' => array(),

    'selection' => array()),

    'mtable' => array(

    'align' => array(),

    'columnalign' => array(),

    'rowalign' => array(),

    'equalrows' => array(),

    'equalcolumns' => array(),

    'columnspacing' => array(),

    'rowspacing' => array(),

    'columnlines' => array(),

    'rowlines' => array(),

    'frame' => array()),

    'mrow' => array(

    'xlink:type' => array(),

    'xlink:show' => array(),

    'xlink:href' => array()),

    'mtr' => array(

    'rowalign' => array(),

    'columnalign' => array()),

    'mtd' => array(

    'rowspan' => array(),

    'columnspan' => array(),

    'rowalign' => array(),

    'columnalign' => array()),

    'mpadded' => array('width' => array())

    );

    return $tags;

    }`

    If anyone’s interested, you can find install at http://www.thetelegraphic.com/bbpress/bbpress/ (for now, once it’s fully working it’ll go to a dedicated domain).

    #1802
    dprice
    Member

    I’d like to see LaTex support implemented (in a plugin I guess), so people can post LaTex comments (eg for physics/maths forums). How hard would this be to implement in BBpress?

    #57253
    lokem001
    Member

    Thanks Trent, but that link gave me nothing :(

    Fel64, I don’t really get what you mean with “live Windows server”… anyhow it’s a WindowsXP server, Apache 2.2, PHP5, latest MySQL – all installed on a personal LAN server.

    And the Apache/PHP installation works fine with some other simple PHP applications.

    I also tried to copy an older installation of bbpress that worked fine on a previous WinXP/Apache server, but due to a disk failure I had to format the drive and re-install everything.

    However, that older bbpress turned out with the exact problem (blank page) and the same line Apache’s error.log…

    My guess is something’s wrong with my Apache/PHP installation.

    Thx,

    lokem

    #57252
    Trent Adams
    Member

    It seems that you install isn’t liking the syntax of your install. Maybe check out this thread on localhost installs for ideas?

    Trent

    #55004
    Trent Adams
    Member

    I will take a look and play around to have it working with the default install again, np!

    Trent

    #55003
    spencerp
    Member

    YES! Awesome! Thanks a million Trent! :D You’re awesome! ;) :D I gotta find it now, I think it’s on a CD some where LOL. When I find it, I’ll send it your way. :) ;)

    Side note: It was coded with the Forum Category hack/adjustments made though.. so.. just a for-warning. ;) It shouldn’t be that hard to start on fresh bbPress code though. :) I just don’t have the time to do it sigh. :(

    And maybe even some “plugin code” are in it as well lol! I think your’s and Josh’s. Hmm.. You’ll see what I mean then. ;)

    spencerp

    #55002
    Trent Adams
    Member

    If you want to email me the theme Spencerp that would work and I will just re-release it for you and host it ;)

    Trent

    #1797
    lokem001
    Member

    Hi!

    I did the installation as guided… created a config file…

    So after the creation of a config file, and I reload the page, nothing shows but blank… a big white blank page.

    I get this messege in my apache error log:

    [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function __() in C:\wow1.11\www\bbpress\bb-settings.php on line 7

    Thx for all the help I can get! :)

    #55001
    spencerp
    Member

    Yeah, sigh. A little bit frustrated when a guy rips you off for a 112.00 USD on a custom WP theme! In which he don’t give you after A MONTH! When originally said 3 to 5 days max!

    (NSFW Links – Contain swear words of course! :D )

    http://www.vindictivebastard.net/id/433

    http://www.vindictivebastard.net/id/435

    And besides all that crap, I have many many other things that need done. But, is on hold because of the first initial crap that I’m dealing with sigh. :(

    spencerp

    #1796
    Sam Bauers
    Participant

    I informally announced this in another post, but it kind of got buried.

    bbPulp is a wiki I have started for the purpose of creating some coherent documentation of the bbPress API for plugin and theme developers. There seemed to be enough people interested in having one now to start it. Hopefully it can form the foundation of the official wiki when it is created, and in the meantime we have some where to collect our knowledge of the API.

    Already documented are all the pluggable functions. I need help with all the hooks (due to sheer volume), both filters and actions. If you are inclined to help, please use the hooks already documented as examples for others.

    All submissions are released under the terms of the GNU Free Documentation License.

    #57243

    In reply to: tuzhak == bozo

    chrishajer
    Participant

    Did what? Still need to get rid of tuzhak and all their posts need to be purged from the database.

    https://bbpress.org/forums/profile/179439

    #56642

    In reply to: Plugin: BB-Ads

    wittmania
    Member

    I have launched an “Area 51” forum to test and display the effects of my plugins. You can see bb-Ads in action here:

    http://blog.wittmania.com/bbpress/

    Also, I have now tested this plugin with pretty links, and it does work. The only changes to be made in the coding as given in ad1.php is that you have to delete the .php from the strpos check. This will just look for the words in the link instead of the actual .php file names.

Viewing 25 results - 61,476 through 61,500 (of 64,414 total)
Skip to toolbar