Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Using a .csv-file for creating groups (7 posts)

Started 1 year, 4 months ago by: wwwanders

  • Profile picture of wwwanders wwwanders said 1 year, 4 months ago:

    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?

  • Profile picture of Travel-Junkie Travel-Junkie said 1 year, 4 months ago:

    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.

  • Profile picture of wwwanders wwwanders said 1 year, 4 months ago:

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

  • Profile picture of wwwanders wwwanders said 1 year, 4 months ago:

    Anyone?

  • Profile picture of techguy techguy said 1 year, 4 months ago:

    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.

  • Profile picture of wwwanders wwwanders said 1 year, 4 months ago:

    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?

  • Profile picture of wwwanders wwwanders said 1 year, 4 months ago:

    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!