예제 #1
0
function bb_export()
{
    global $bb;
    define('BB_EXPORTING', true);
    do_action('bb_pre_export');
    $bb->use_cache = false;
    // Turn off hard cache
    $bb->page_topics = 100;
    echo "<forums-data version='0.75'>\n";
    if (BB_EXPORT_LEVEL & BB_EXPORT_USERS) {
        $page = 1;
        while (($users = bb_user_search(array('page' => $page++))) && !is_nxt_error($users)) {
            foreach ($users as $user) {
                echo bb_export_user($user->ID);
            }
        }
        unset($users, $user, $page);
    }
    if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
        $forums = bb_get_forums();
        foreach ($forums as $forum) {
            echo bb_export_forum($forum->forum_id);
        }
        unset($forums, $forum);
    }
    if (BB_EXPORT_LEVEL & BB_EXPORT_TOPICS) {
        $page = 1;
        while ($topics = get_latest_topics(0, $page++)) {
            foreach ($topics as $topic) {
                echo bb_export_topic($topic->topic_id);
            }
        }
        unset($topics, $topic, $page);
    }
    do_action('bb_export');
    echo '</forums-data>';
}
 function query()
 {
     $users = bb_user_search(array('query' => $this->search_term, 'user_email' => true, 'users_per_page' => $this->users_per_page, 'page' => $this->page, 'roles' => $this->roles));
     if (is_nxt_error($users)) {
         $this->search_errors = $users;
     } else {
         if ($users) {
             $this->results = $users;
         }
     }
     //	foreach ( (array) $users as $user )
     //		$this->results[] = $user->ID;
     if ($this->results) {
         $this->total_users_for_query = bb_count_last_query();
     } elseif (!is_nxt_error($this->search_errors)) {
         $this->search_errors = new nxt_Error('no_matching_users_found', __('<strong>No matching users were found!</strong>'));
     }
     if (is_nxt_error($this->search_errors)) {
         bb_admin_notice($this->search_errors);
     }
 }
예제 #3
0
        // Set the wp table prefix for sometime
        bb_update_option('wp_table_prefix', $wpdb->prefix);
        // Why don't people follow docs
        // Map the user roles, only admin = keymaster, rest = members
        if (!bb_get_option('wp_roles_map')) {
            bb_update_option('wp_roles_map', array('administrator' => 'keymaster', 'editor' => 'member', 'author' => 'member', 'contributor' => 'member', 'subscriber' => 'member'));
            ?>

                <li>User role mapping options have been automatically set. The WordPress administrator is now the keymaster, rest all WordPress roles are bbPress members.</li>

            <?php 
        }
        // Apply the bbPress roles to the new users based on their WordPress roles
        bb_apply_wp_role_map_to_orphans();
        // Get a keymaster
        $users = bb_user_search(array('roles' => 'keymaster', 'users_per_page' => 1));
        $user = $users[0];
        if (defined('W2BC_DEBUG') && W2BC_DEBUG == true) {
            ?>
                <li>Logging in as the following user:
                    <pre><?php 
            print_r($user);
            ?>
</pre>
                </li>
            <?php 
        }
        if (empty($user) || is_wp_error($user)) {
            /* I ask why */
            ?>