Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 23,576 through 23,600 (of 32,481 total)
  • Author
    Search Results
  • #78976

    @grassrootspa

    I doubt that too but I am wondering if that didn’t work out :/

    #70367

    @msmeritt

    Just flush your cookies ;)

    #70366
    msmeritt
    Member

    A while back, I added bbPress to my website. I used the bbPress Integration plugin and followed the screencast instructions, but it never quite worked right. Since then, I’ve seen too little need for integration, and I’d like to just get rid of it — keeping the bbPress installation, but getting rid of integration.

    I can’t find good instructions on how to do this. Further, I can’t even properly get into my bbPress admin area. I log in, but I just get the regular bbPress screen, and when I click Admin, it just redirects me right back to the regular screen. And I do believe this is the result of things going wrong with cookies because of the integration plugin.

    Help! Thanks :)

    #78948

    In reply to: Displayname check

    <?php
    /*
    Plugin Name: No Duplicate Display Names
    Description: Prevents users from using already existing display names.
    */

    function check_display_name ( $user_id ) {

    global $bbdb, $bb_current_id, $display_name;

    $name_query = <<<EOQ
    SELECT
    user_login
    FROM
    $bbdb->users
    WHERE
    display_name = "$display_name"
    AND
    ID != "$bb_current_id"
    EOQ;

    if ( $name_clash = $bbdb->get_var( $name_query ) ) {
    wp_redirect( add_query_arg( 'nameclash', $name_clash, get_user_profile_link( $user->ID ) ) );
    exit;
    }

    }

    add_action ( 'before_profile_edited', 'check_display_name' );

    ?>

    You also need in your theme’s profile.php, before the line <?php elseif ( $user_id == bb_get_current_user_info( ‘id’ ) ) : ?>

    <?php elseif ( $_GET['nameclash'] ) : ?>
    <div class="notice error">
    <p><?php printf(__('Display name already taken by %s'), $_GET['nameclash' ]); ?>. <a href="<?php profile_tab_link( $user_id, 'edit' ); ?>"><?php _e('Edit again »'); ?></a></p>
    </div>

    Also, I just set my display name to a SQL query string, yay :D

    #79007

    <?php $last_post = bb_get_last_post(); ?><a href="<?php echo get_post_link($last_post->post_id); ?>">Latest post</a><?php unset($last_post); ?>

    Put that in your front-page.php in the parts you want the latest post link to appear. Try after <?php topic_page_links(); ?>

    #78978

    In reply to: threaded forum ?

    A threaded forum layout could be achieved using a template, you’d just have to code it yourself by loading the titles from each thread (and add titles, either yourself or with a plugin) or find someone who has already done it. Why isn’t bbPress like that? It’s made to be as simple as possible so you can build what you want from it.

    #78875

    Nope, that’s to fix your capabilities setting, without which I think it’d be impossible to access admin ever. Ah well :)

    #78810

    Hostnames will just be the public-facing DNS entry for your IP, which in my case at least is just a nice text-and-numbers version of my IP :P

    #78861
    Olaf Lederer
    Participant

    Of course it’s possible but around half the plugins will stop working.

    depends on which plugins you’re using :)

    I’m using all the plugins I have used before

    #78974
    johnhiler
    Member

    WordPress itself just underwent a pretty serious security attack:

    http://www.cmswire.com/cms/web-cms/wordpress-under-attack-upgrade-now-or-forever-live-in-fear-005489.php

    Since bbPress 1.0 shares a lot of code with WordPress (through BackPress), it may or may not be vulnerable… hopefully Sam can weigh in definitively on this one!

    #78972

    Mine was to check the bug tracker… oh dear :)

    #78971
    johnnydoe
    Member

    my first reaction was to check the sourcecode haha :D

    #78969

    The sky is falling! :)

    #78935

    That is a point. Files with . in front of them are the equivalent in Linux/Unix of hidden files under Windows.

    #78930

    You should have a line something like RewriteRule ^mlist/ /mlist.php [L,QSA] in your .htaccess. Put it after RewriteRule ^rss/view/([^/]+)/?$ /rss.php?view=$1 [L,QSA] if you don’t.

    #31699
    chubsg
    Member

    Hi,

    I have an existing phpbb2 forum and was hoping to migrate the existing data into bbPress, followed by integration to WordPress MU. Here’s the steps i’ve done so far:

    1. installed a fresh copy of bbPress 1.0.2

    2. downloaded phpbb2bbpress converter from http://www.iteisa.com/phpbb2bbpress/

    3. ammended the necessary stuff inside the file and ran the script

    4. installed WordPress MU

    I was comparing the bb_ and wp_ tables and would like to know:

    1. can i simply insert into wp_usermeta, (user_id, meta_key, meta_value) from bb_usermeta table where the meta_key = bb_capabilities because it looks safer than just replacing wp_usermeta with bb_usermeta due to the existing entries in wp_usermeta which i’m unsure of their usage?

    2. it also seems that i should insert all the necessary values from bb_users table to wp_users table because wp_users has more columns

    are there anything else database-wise i need to do?

    After the above i know i need to install a bbpress-integration.php into WordPress MU and do some settings on both bbPress and WordPress MU settings/configs. Are there any other steps i’m missing out?

    I would really appreciate any help on this :-)

    #78921

    Okay. In your stylesheet, put:

    #title { position: absolute; top: 0px; }
    #tagline { position: absolute; top: 75px; }

    I think that should work.

    #78938
    <?php
    /*
    Plugin Name: Open Links in New Window
    */

    function bb_target_blank( $text ) {
    $text = preg_replace('|<a (.+?)>|i', '<a $1 target="_blank">', $text);
    return $text;
    }
    add_filter('post_text', 'bb_target_blank',255);

    ?>

    Put the above into a file and save it as new-window-links.php or similar in your my-plugins directory. Then enable it in the plugins menu. Should work. Avoid getting any spaces around the start and end tags.

    https://bbpress.org/forums/topic/target-_blank

    #78917

    Programmer’s Notepad + Find in Files = easy finding :)

    #78915

    Apart from the template files forum.php and topic.php that use the bb_forum_bread_crumb() (which just builds the breadcrumb for forums / topics), the separator is also hardcoded into several (all?) other template files to give custom titles, which I’m afraid have to be changed by hand.

    The only central location would be the default of bb_forum_bread_crumb(), which you shouldn’t change.

    #78925

    As delayedinsanity said, check your SQL server settings, namely by looking at the wp-config.php for WordPress and checking the database, username and password match. If you have a WordPress page named ‘forums’ and a directory called ‘forums’ that contains your bbPress forum, WP’s .htaccess is set up to display the directory instead of the WP page. To make them look the same, you need to either use deep integration or modify your bbPress theme to look like WP’s.

    #78914
    kirpiit
    Member

    Very good, thank you!

    Yet there are pages where the standard separator stays untouched: see as an example the login /bb-login.php page.

    Does it mean one have to change it in every template (or so) or is there a central location for such a customization, please?

    #78696
    Mark
    Member

    “* too many plug-ins external to the core software just to get it to run normal forum functionality that comes ‘out of the box’ with most other forums, meaning too many 3rd party functions that might one day no longer be supported (like bbsync)”

    What plugins are necessary? I’m running bbpress with absolutely no plugins at the moment (though to be fair, I fully plan on adding a few), and I seem to be able to set up forums, post topics, and then reply to said topics. That seems to be the basic functionality of a forum to me?

    “* no bbsync”

    If you really need to duplicate content, you could always use cp

    “* not an easy install plug-in to wp. “

    I’ll agree, I would have jumped for joy had this been the case. Though honestly integration (shallow or deep) really doesn’t take a whole lot of effort at all.

    Have you asked the author of the plugin if s/he plans to update it? You never know, it could be in the works right now.

    #78854

    bbPress Exporter 0.1a

    exporter-bbpress.php

    <?php
    /*
    Plugin Name: Export
    Plugin URI: https://www.bbpress.org/
    Description: Allows administrators to export forum data.
    Author: Dan Larkin
    Version: 0.1 alpha
    Author URI: http://www.stealyourcarbon.net/
    */

    /**
    * Includes necessary files.
    */
    function export_init ()
    {
    require_once ('wfxp.php');
    require_once ('wfxp-bbpress.php');
    }

    /**
    * Executes all necessary functions to make the exportation happen.
    */
    function export_main ()
    {
    global $bbdb;
    export_init ();
    $bbxp = new WFXP_bbPress ($bbdb);
    $bbxp->db = $bbdb;
    $filename = 'bbpress' . date ('Y-m-d') . '.xml';

    $bbxp->write_header ($filename);
    $bbxp->write_users ();
    $bbxp->write_forums ();
    $bbxp->write_topics ();
    $bbxp->write_footer ();

    die ();

    }

    /**
    * Displays the admin export page.
    *
    * Gives a simple explanation of how the export file works and gives
    * users a nice shiny button to click.
    */
    function export_page ()
    {
    ?>

    <div class="wrap">
    <h2><?php _e ('Export') ?></h2>
    <p><?php _e ('When you click the button below, bbPress will generate an XML file for you to save to your computer.'); ?></p>
    <p><?php _e ('This file will contain data about your users, forums, topics, and posts. You can use the Import function of another bbPress installation or another compatible web forums software to import this data.'); ?></p>
    <form action="" method="get">
    <p class="submit">
    <input type="submit" name="submit" value="<?php _e ('Download Export File'); ?>" />
    <input type="hidden" name="exporting" value="true" />
    </p>
    </form>
    </div>

    <?php
    }

    /**
    * Adds export link to admin menu.
    */
    function export_add_admin ()
    {
    global $bb_submenu;
    $bb_submenu['content.php'][] = array (__('Export'), 'use_keys', 'export_page', 'exporter-bbpress.php');
    }

    if ('true' == $_GET['exporting'] )
    {
    add_action ('bb_init', 'export_main');
    }

    add_action ('bb_admin_menu_generator', 'export_add_admin');

    ?>

    wfxp.php

    <?php
    /**
    * Web Forums Data Export Class
    *
    * This class contains a number of functions used to take formatted
    * input and output it into a standard XML file for use in transporting
    * data between installations. Class extensions and plugins can be found
    * for various software.
    */
    class WFXP
    {

    /**
    * Instance of BPDB.
    */
    var $db;

    /**
    * Pseudonym for BPDB's get_results.
    *
    * This is a renaming of BPDB's get_results method to eliminate the need
    * for the second parameter by always returning an associative array.
    */
    function fetch ($query)
    {
    return $this->db->get_results ($query, 'ARRAY_A');
    }

    /**
    * Adds formatted user data to the output.
    */
    function add_user ($user)
    {
    ?>
    <user id="<?php echo $user['id']; ?>">
    <login><?php echo $user['login']; ?></login>
    <pass type="<?php echo $user['pass']['type']; ?>"><?php echo $user['pass']['pass'] ?></pass>
    <incept><?php echo $user['incept']; ?></incept>
    <status><?php echo $user['status']; ?></status>
    <?php
    if ($user['meta'])
    {
    foreach ($user['meta'] as $meta)
    {
    $this->add_meta ($meta, 'user');
    }
    }
    ?>
    </user>

    <?php
    }

    /**
    * Adds formatted forum data to the output.
    */
    function add_forum ($forum)
    {
    ?>
    <forum id="<?php echo $forum['id']; ?>" in="<?php echo $forum['in']; ?>">
    <title><![CDATA[<?php echo $forum['title']; ?>]]></title>
    <content><![CDATA[<?php echo $forum['content']; ?>]]></content>
    <?php
    if ($forum['meta'])
    {
    foreach ($forum['meta'] as $meta)
    {
    $this->add_meta ($meta, 'forum');
    }
    }
    ?>
    </forum>

    <?php
    }

    /**
    * Adds formatted topic data to the output
    */
    function add_topic ($topic)
    {
    ?>
    <topic id="<?php echo $topic['id']; ?>" author="<?php echo $topic['author']; ?>" in="<?php echo $topic['in']; ?>">
    <title><![CDATA[<?php echo $topic['title']; ?>]]></title>
    <incept><?php echo $topic['incept']; ?></incept>
    <status><?php echo $topic['status']; ?></status>
    <?php
    if ($topic['meta'])
    {
    foreach ($topic['meta'] as $meta)
    {
    $this->add_meta ($meta, 'topic');
    }
    }
    if ($topic['tags'])
    {
    foreach ($topic['tags'] as $tag)
    {
    $this->add_tag ($tag);
    }
    }
    ?>

    <?php
    foreach ($topic['posts'] as $post)
    {
    $this->add_post ($post);
    }
    ?>
    </topic>

    <?php
    }

    /**
    * Adds formatted post data to the output.
    */
    function add_post ($post)
    {
    ?>
    <post id="<?php echo $post['id']; ?>" author="<?php echo $post['author']; ?>">
    <title><![CDATA[<?php echo $post['title']; ?>]]></title>
    <content><![CDATA[<?php echo $post['content']; ?>]]></content>
    <incept><?php echo $post['incept']; ?></incept>
    <status><?php echo $post['status']; ?></status>
    <?php
    if ($post['meta'])
    {
    foreach ($post['meta'] as $meta)
    {
    $this->add_meta ($meta, 'post');
    }
    }
    ?>
    </post>

    <?php
    }

    /**
    * Adds formatted tag data to the output.
    */
    function add_tag ($tag)
    {
    ?>
    <tag><![CDATA[<?php echo $tag; ?>]]></tag>
    <?php
    }

    /**
    * Adds formatted meta data to the output.
    *
    * Indentation varies depending on what type of element the meta data
    * is being added to so as to make the output pretty.
    */
    function add_meta ($meta, $type)
    {
    if ('post' == $type)
    {
    ?>
    <meta key="<?php echo $meta['key']; ?>"><![CDATA[<?php echo $meta['value']; ?>]]></meta>
    <?php

    }
    else
    {
    ?>
    <meta key="<?php echo $meta['key']; ?>"><![CDATA[<?php echo $meta['value']; ?>]]></meta>
    <?php

    }
    }

    /**
    * Writes file headers.
    *
    * Writes HTTP headers and adds the XML declaration as well as
    * the top level container to the output.
    */
    function write_header ($filename)
    {
    header ('Content-Description: File Transfer');
    header ('Content-Dispositon: attachment; filename=' . $filename);
    header ('Content-Type: text/xml');

    echo '<?xml version="1.0" encoding="UTF-8" ?>';
    ?>

    <forums_data>

    <?php
    }

    /**
    * Adds the closing tag for the top level container to the output.
    */
    function write_footer ()
    {
    ?>
    </forums_data>
    <?php
    }

    }
    ?>

    wfxp-bbpress.php

    <?php
    /**
    * bbPress WFXP Extension
    *
    * This class includes functions necessary for bbPress to interface
    * with the WFXP class, allowing for exportation of bbPress data to
    * a standard XML file.
    */
    class WFXP_bbPress extends WFXP
    {
    /**
    * Fetches users from the database.
    */
    function fetch_users ()
    {
    return $this->fetch ('SELECT * FROM ' . $this->db->users . ' WHERE 1');
    }

    /**
    * Fetches forums from the database.
    */
    function fetch_forums ()
    {
    return $this->fetch ('SELECT * FROM ' . $this->db->forums . ' WHERE 1');
    }

    /**
    * Fetches topics from the database.
    */
    function fetch_topics ()
    {
    return $this->fetch ('SELECT * FROM ' . $this->db->topics . ' WHERE 1');
    }

    /**
    * Fetches posts from the database.
    */
    function fetch_posts ($topic_id)
    {
    return $this->fetch ('SELECT * FROM ' . $this->db->posts . ' WHERE topic_id="' . $topic_id . '"');
    }

    /**
    * Fetches user meta data from the database.
    */
    function fetch_user_meta ($user_id)
    {
    return $this->fetch ('SELECT meta_key, meta_value FROM ' . $this->db->usermeta . ' WHERE user_id="' . $user_id . '"');
    }

    /**
    * Fetches topic meta data from the database.
    */
    function fetch_topic_meta ($topic_id)
    {
    return $this->fetch ('SELECT meta_key, meta_value FROM ' . $this->db->meta . ' WHERE object_type="bb_topic" AND object_id="' . $topic_id . '"');
    }

    /**
    * Fetches topic tags from the database.
    *
    * Fetching topic tags requires multiple queries to
    * determine the relationships between terms and IDs.
    */
    function fetch_topic_tags ($topic_id)
    {
    $taxonomy_ids = $this->fetch ('SELECT term_taxonomy_id FROM ' . $this->db->term_relationships . ' WHERE object_id="' . $topic_id . '"');
    if ($taxonomy_ids)
    {
    foreach ($taxonomy_ids as $taxonomy_id)
    {
    $term_id = $this->fetch ('SELECT term_id FROM ' . $this->db->term_taxonomy . ' WHERE term_taxonomy_id="' . $taxonomy_id['term_taxonomy_id'] . '"');
    $tag = $this->fetch ('SELECT name FROM ' . $this->db->terms . ' WHERE term_id="' . $term_id[0]['term_id'] . '"');
    $tags[] = $tag[0];
    }
    }
    return $tags;
    }

    /**
    * Prepares retrieved user data for output.
    */
    function prep_user_data ($raw_user, $raw_meta)
    {
    $user['id'] = $raw_user['ID'];
    $user['login'] = $raw_user['user_login'];
    if (32 < strlen ($raw_user['user_pass']))
    {
    if (!strcmp (substr ($raw_user['user_pass'], 0, 4), '$P$B'))
    {
    $user['pass']['type'] = 'phpass';
    }
    else
    {
    $user['pass']['type'] = 'unknown';
    }
    }
    else
    {
    $user['pass']['type'] = 'md5';
    }
    $user['pass']['pass'] = $raw_user['user_pass'];
    $user['incept'] = $raw_user['user_registered'];
    $user['status'] = $raw_user['user_status'];
    $user['meta'][] = array ('key' => 'nicename', 'value' => $raw_user['user_nicename']);
    $user['meta'][] = array ('key' => 'email', 'value' => $raw_user['user_email']);
    $user['meta'][] = array ('key' => 'url', 'value' => $raw_user['user_url']);
    $user['meta'][] = array ('key' => 'display_name', 'value' => $raw_user['display_name']);
    if ($raw_meta)
    {
    foreach ($raw_meta as $raw_meta_entry)
    {
    $user['meta'][] = $this->prep_meta_data ($raw_meta_entry);
    }
    }
    return $user;
    }

    /**
    * Prepares retrieved forum data for output.
    */
    function prep_forum_data ($raw_forum)
    {
    $forum['id'] = $raw_forum['forum_id'];
    $forum['in'] = $raw_forum['forum_parent'];
    $forum['title'] = $raw_forum['forum_name'];
    $forum['content'] = $raw_forum['forum_desc'];
    $forum['meta'][] = array ('key' => 'slug', 'value' => $raw_forum['forum_slug']);
    $forum['meta'][] = array ('key' => 'order', 'value' => $raw_forum['forum_order']);
    return $forum;
    }

    /**
    * Prepares retrieved topic data for output.
    */
    function prep_topic_data ($raw_topic, $raw_meta, $raw_tags, $raw_posts)
    {
    $topic['id'] = $raw_topic['topic_id'];
    $topic['author'] = $raw_topic['topic_poster'];
    $topic['in'] = $raw_topic['forum_id'];
    $topic['title'] = $raw_topic['topic_title'];
    $topic['incept'] = $raw_topic['topic_start_time'];
    $topic['status'] = $raw_topic['topic_status'];
    $topic['meta'][] = array ('key' => 'slug', 'value' => $raw_topic['topic_slug']);
    $topic['meta'][] = array ('key' => 'open', 'value' => $raw_topic['topic_open']);
    $topic['meta'][] = array ('key' => 'sticky', 'value' => $raw_topic['topic_sticky']);
    if ($raw_meta)
    {
    foreach ($raw_meta as $raw_meta_entry)
    {
    $topic['meta'][] = $this->prep_meta_data ($raw_meta_entry);
    }
    }
    if ($raw_tags)
    {
    foreach ($raw_tags as $raw_tag)
    {
    $topic['tags'][] = $this->prep_tag_data ($raw_tag);
    }
    }
    foreach ($raw_posts as $raw_post)
    {
    $topic['posts'][] = $this->prep_post_data ($raw_post);
    }
    return $topic;
    }

    /**
    * Prepares retrieved post data for output.
    */
    function prep_post_data ($raw_post)
    {
    $post['id'] = $raw_post['post_id'];
    $post['author'] = $raw_post['poster_id'];
    $post['title'] = '';
    $post['content'] = $raw_post['post_text'];
    $post['incept'] = $raw_post['post_time'];
    $post['status'] = $raw_post['post_status'];
    $post['meta'][] = array ('key' => 'ip_address', 'value' => $raw_post['poster_ip']);
    return $post;
    }

    /**
    * Prepares retrieved tag data for output.
    */
    function prep_tag_data ($raw_tag)
    {
    return $raw_tag['name'];
    }

    /**
    * Prepares retrieved meta data for output.
    */
    function prep_meta_data ($raw_meta)
    {
    return array ('key' => $raw_meta['meta_key'], 'value' => $raw_meta['meta_value']);
    }

    /**
    * Fetches, prepares, and outputs user data using subroutines.
    */
    function write_users ()
    {
    $users = $this->fetch_users ();
    foreach ($users as $user)
    {
    $user_meta = $this->fetch_user_meta ($user['ID']);
    $user = $this->prep_user_data ($user, $user_meta);
    $this->add_user ($user);
    }
    }

    /**
    * Fetches, prepares, and outputs forum data using subroutines.
    */
    function write_forums ()
    {
    $forums = $this->fetch_forums ();
    foreach ($forums as $forum)
    {
    $forum = $this->prep_forum_data ($forum, $forum_meta);
    $this->add_forum ($forum);
    }
    }

    /**
    * Fetches, prepares, and outputs topic data using subroutines.
    */
    function write_topics ()
    {
    $topics = $this->fetch_topics ();
    foreach ($topics as $topic)
    {
    $topic_meta = $this->fetch_topic_meta ($topic['topic_id']);
    $topic_tags = $this->fetch_topic_tags ($topic['topic_id']);
    $topic_posts = $this->fetch_posts ($topic['topic_id']);
    $topic = $this->prep_topic_data ($topic, $topic_meta, $topic_tags, $topic_posts);
    $this->add_topic ($topic);
    }
    }

    }
    ?>

    It also has the Web Forum Export/Import Standard Validator, but I think this post is long enough already :P

    #78853

    @Olaf: it’s a set of PHP scripts in zip archives, don’t freak. Just badly formatted is all. And yes, I just checked that under Windows with an up-to-date anti-virus running. Haven’t got the time to check the PHP code itself mind you ;)

    @gerikg: it’s a plugin, which I think is intended to be a relatively universal data exporter between forums. How you import is a good question though.

Viewing 25 results - 23,576 through 23,600 (of 32,481 total)
Skip to toolbar