Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using a .csv-file for creating groups

  • Avatar of wwwanders
    wwwanders
    Member

    @wwwanders

    I have a .csv file with hundreds of rows.
    First column is the group name, second is the group description and last (third) the slug. I need to create groups from this .csv file. As far as I’ve been told I can use this code:

    http://pastie.org/1412075

    But I can’t get it to work. I’m getting this in return: Fatal error: Call to undefined function groups_check_slug()

    Am I missing something?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    Grab the information from the file, turn it into an array, then loop through it and call `groups_create_group()` every time. You can find that function in bp-groups.php. It tells you all the parameters you need to fill in.

    Avatar of wwwanders
    wwwanders
    Member

    @wwwanders

    Is it possible to just import the groups in the database?

    Avatar of wwwanders
    wwwanders
    Member

    @wwwanders

    Anyone?

    Avatar of techguy
    techguy
    Participant

    @crashutah

    Almost anything is possible, but creating a simple loop would be 100 times easier. Just importing to the database would be rough for creating groups.

    Avatar of wwwanders
    wwwanders
    Member

    @wwwanders

    Well, I have this file now: http://pastie.org/1430022

    I have opened it in my browser and I get a blank screen (no errors) but the groups isn’t created.
    What should I do?

    Avatar of wwwanders
    wwwanders
    Member

    @wwwanders

    I got a dump from the script and fixed some glitches:

    Hers the dump:

    ‘Array ( [0] => Array ( [group_id] => 2 [creator_id] => 1 [name] => GroupName1 [description] => Interesting description1 [slug] => groupname1 [date_created] => 2011-01-05 02:33:54 [status] => public [enable_forum] => 1 ) [1] => Array ( [group_id] => 3 [creator_id] => 1 [name] => GroupName2 [description] => Interesting description2 [slug] => groupname2 [date_created] => 2011-01-05 02:33:54 [status] => public [enable_forum] => 1 )’

    It seems fine but it doesn’t create any groups! ARG!

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.