I am attempting to use Groups_User_Group::create. But it is not working.
So, I added some debug messages to this function to see what is going on.
I have a group called ‘2014Q3-DC0’ and it is visible in the admin panel. When I entered create my error_log message printed the user id and group id correctly, however results of Group_Group::read($group_id) was empty.
Do you have any suggestions for further analysis?
Thanks!
I was skimming through your code and found another function called read_by_name.
I used this to convert the group name into a group id.
Then (after fixing a couple more bugs) everything magically worked!
Thanks
Hi there,
First thank you and congratulations for the great Groups plugin!
I have enjoyed using it to protect pages “by hand” for some users through the ultra-simple UI you provide in the WP backend. But I have now to go a step further by doing things programmatically in php templates (at beginner level).
What I was conveniently doing by hand was, for a set of manually create pages :
- define both a capability and a group to protect thes pages and assign them to the pages
- assign users to the group for them (only) being able to read the page
I now have to do the same in php for a set of page created programmatically. I have seen the code snippets you give in your doc to do the second step (assign users to group), no problem. But I am lost in your API for achieving the first step, which I understand is a list of several API calls that I can’t figure out.
Would you have some code examples on how to do that, or more precise advices for me to use the API (I’m a php beginner but I can understand things).
Many thanks in advance!
Yves.