Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using a .csv-file for creating groups

  • @wwwanders

    Member

    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)
  • @anonymized-96400

    Inactive

    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.

    @wwwanders

    Member

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

    @wwwanders

    Member

    Anyone?

    @crashutah

    Participant

    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.

    @wwwanders

    Member

    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?

    @wwwanders

    Member

    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)
  • The topic ‘Using a .csv-file for creating groups’ is closed to new replies.
Skip to toolbar