Skip to:
Content
Pages
Categories
Search
Top
Bottom

Import from Ning


  • Jonah Brown
    Member

    @fishbaitbytes

    When using the import from Ning it shows:
    Import Users from Ning
    Groups

    Import from Ning is now importing your Ning groups. Importing groups takes a lot of processing power, so you’re limited to importing 30 groups at a time. If you’ve got more than that, you will have to refresh the page in order to get them all.

    Once you’ve imported all your groups, click Continue at the bottom of the page to move on to the next step.
    0) Created group:

    I asked the plugin dev and they are too busy to fix this.

    Code:
    This is the section that start the import function bp_ning_import_get_groups() {
    $ning_id_array = get_option( ‘bp_ning_user_array’ );

    // Get list of Ning groups for cross reference
    $groups = bp_ning_import_prepare_json( ‘groups’ );

    if ( !$ning_group_id_array = get_option( ‘bp_ning_group_array’ ) )
    $ning_group_id_array = array();

    $counter = 0;
    foreach ( (array)$groups as $group_key => $group ) {

    //if ( $counter >= 30 ) {
    // update_option( ‘bp_ning_group_array’, $ning_group_id_array );

    /// echo “

    Refresh to continue

    “;
    // die();
    //}

    // Create the group
    $ning_group_creator_id = $group->contributorName;
    $creator_id = $ning_id_array[$ning_group_creator_id];

    $status = ( $group->groupPrivacy == ‘private’ ) ? ‘private’ : ‘public’;

    $ndate = strtotime( $group->createdDate );

    $date_created = date( “Y-m-d H:i:s”, $ndate );

    $slug = sanitize_title( esc_attr( $group->title ) );

    $args = array(
    ‘id’ => $creator_id,
    ‘title’ => $group->title,
    ‘description’ => $group->description,
    ‘slug’ => $slug,
    ‘status’ => $status,
    ‘enable_forum’ => 1,
    ‘date_created’ => $date_created
    );

    if ( !BP_Groups_Group::group_exists( $slug ) ) {
    if ( $group_id = groups_create_group( $args ) ) {
    groups_update_groupmeta( $group_id, ‘last_activity’, $date_created );
    groups_update_groupmeta( $group_id, ‘total_member_count’, 1 );
    groups_new_group_forum( $group_id, $group->title, $group->description );
    echo “$group_key) Created group: $group->title
    “;
    if ( !$forum_id = groups_get_groupmeta( $group_id, ‘forum_id’ ) ) {
    print_r($group);
    die();
    }

    $ngroup_id = $group->id;
    $ning_group_id_array[$ngroup_id] = $group_id;

    $counter++;
    }
    } else {
    //echo “Group $group->title already exists
    “;
    }

    if ( is_array( $group->members ) ) {
    foreach( $group->members as $member ) {
    $ning_group_member_id = $member->contributorName;
    $member_id = $ning_id_array[$ning_group_member_id];

    groups_join_group( $group_id, $member_id );
    }
    }
    }
    update_option( ‘bp_ning_group_array’, $ning_group_id_array );

    unset( $groups );
    }

    Can anyone help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Import from Ning’ is closed to new replies.
Skip to toolbar