将电子表格转换为数组并循环并调用函数
这与在 BuddyPress 中生成组有关。
我有一个电子表格,其中包含(在本例中)组名称、组描述和别名。
我需要从文件中获取信息,将其转换为数组,然后循环遍历它并每次调用 groups_create_group() 。
我可以在 bp-groups.php (http://www.nomorepasting.com/getpaste.php?pasteid=35217) 中找到该函数。它告诉我您需要填写的所有参数。
我对此很陌生,正在寻找如何做到这一点。你知道我如何获取这些信息并将其转换为数组吗?循环遍历并每次调用 groups_create_group() ?
如果您也有任何与此相关的方便链接,我将不胜感激。
This is related to generate groups in BuddyPress.
I have a spreadsheet with (in this case) a group name, group description and slug.
I need to grab the information from the file, turn it into an array, then loop through it and call groups_create_group() every time.
I can find that function in bp-groups.php (http://www.nomorepasting.com/getpaste.php?pasteid=35217). It tells me all the parameters you need to fill in.
I'm quite new to this and looking for how I can do this. Do you know how I can grab this information and turn it into an array? An loop it through and call groups_create_group() every time?
If you have any handy links regarding this as well I'll appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您具有可用的 groups_create_group 函数(即已包含所需的文件),您应该能够执行类似以下
操作注意,您提供的粘贴代码中对 groups_create_group 的调用是显式调用另一个方法来清理之前的 slug将其传递给函数。因此,您可能需要将对
$group
变量的赋值更改为:As long as you have the function groups_create_group available (ie. The required file has been included) you should be able to do something like this
Note, the call to groups_create_group in the pasted code you provided was explicitly calling another method to sanitize the slug before passing it to the function. So you may want to change the assignment to the
$group
variable to this: