Skip to content

Commit

Permalink
v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
slaFFik committed Aug 17, 2014
1 parent 9d33f5b commit 74a313b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions bp-default-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ function bpdd_admin_page() {
);
}

function bpdd_admin_page_content() {
?>
function bpdd_admin_page_content() { ?>
<div class="wrap">
<?php screen_icon( 'buddypress' ); ?>

Expand All @@ -53,6 +52,7 @@ function bpdd_admin_page_content() {
if ( isset( $_POST['bpdd-admin-submit'] ) ) {
// default values
$users = false;
$imported = array();
$profile = false;
$messages = false;
$activity = false;
Expand Down Expand Up @@ -283,8 +283,11 @@ function bpdd_import_users_profile() {
function bpdd_import_users_messages() {
$messages = array();

/** @var $messages_subjects Array */
/** @var $messages_content Array */
require( dirname( __FILE__ ) . '/data/messages.php' );


// first level messages
for ( $i = 0; $i < 33; $i++ ) {
$messages[] = messages_new_message( array(
Expand Down Expand Up @@ -330,6 +333,7 @@ function bpdd_import_users_messages() {
function bpdd_import_users_activity() {
$users = bpdd_get_random_users_ids( 0 );

/** @var $activity Array */
require( dirname( __FILE__ ) . '/data/activity.php' );

for( $i = 0, $count = 0; $i < 75; $i++ ) {
Expand Down Expand Up @@ -406,6 +410,7 @@ function bpdd_import_groups_activity() {
$users = bpdd_get_random_users_ids( 0 );
$groups = bpdd_get_random_groups_ids( 0 );

/** @var $activity Array */
require( dirname( __FILE__ ) . '/data/activity.php' );

for ( $i = 0, $count = 0; $i < 150; $i++ ) {
Expand Down Expand Up @@ -489,6 +494,7 @@ function bpdd_import_groups_forums() {
* Helpers
*/
function bpdd_clear_db() {
/** @var $wpdb WPDB */
global $wpdb;

$prefix = bp_core_get_table_prefix();
Expand Down Expand Up @@ -530,8 +536,8 @@ function bpdd_clear_db() {
}

function bpdd_get_random_groups_ids( $count = 1, $output = 'array' ) {
/** @var $wpdb WPDB */
global $wpdb;
$groups = array();
$data = array();
$limit = '';

Expand All @@ -552,6 +558,7 @@ function bpdd_get_random_groups_ids( $count = 1, $output = 'array' ) {
}

function bpdd_get_random_users_ids( $count = 1, $output = 'array' ) {
/** @var $wpdb WPDB */
global $wpdb;
$limit = '';
$data = array();
Expand All @@ -566,10 +573,11 @@ function bpdd_get_random_users_ids( $count = 1, $output = 'array' ) {
foreach( $users as $user )
$data[] = $user->ID;

if ( $output == 'array' )
if ( $output == 'array' ) {
return $data;
elseif ( $output == 'string' )
return implode( ',', $data );
} elseif ( $output == 'string' ) {
return implode(',', $data);
}
}

function bpdd_get_random_date( $days_from = 30, $days_to = 0 ) {
Expand Down

0 comments on commit 74a313b

Please sign in to comment.