Support Forum
Hi,
I want to use this function and I need to want what it returns.
spa_get_usergroups_all();
Is it an array? or multi-dimensional array?
Also, to call this from a 3rd party plugin's admin panel in the WordPress admin, do I need to instantiate anything or refer to any global objects?
Thanks for your help!
before calling the function, you might need to add:
sp_forum_api_support();
which will make sure forum api is fully loaded...
the function will return a php object... the members are the columns of the sfusergroups table in the db...
Visit Cruise Talk Central and Mr Papa's World
HI Mr Papa - thank you for your help.
One last part I'm stuck with, if spa_get_usergroups_all() returns an object, is it of a particular class?
What I am expecting is some kind of list of all of the usergroups in the table.
so if I have:
$usergrps = spa_get_usergroups_all();
I can't do:
$usergrps->usergroup_name;
because I need to iterate the rows of the table some how.
I'm sure I'm just not seeing the obvious with this, but any light you can shed on this would be greatly appreciated.
Thanks!
You must extract the data in the
$usergrps->usergroup_name
form. It returns a class of the WP database OBJECT type. As, by default and if no user group ID is passed, it returns all user groups in the table - then you will need to iterate through them using a foreach loop.
So - something along the lines of:
$userGroups = spa_get_usergroups_all(); if($usergGroups) { foreach($userGroups as $group) { $group_name = $group->usergroup_name; // etc... } }
is what you need...
YELLOW
SWORDFISH
|
is "SFUSERGROUPS" a constant defined somewhere?
as it is written: $swl_ugroups = return spdb_table(SFUSERGROUPS);
doesn't work either.
Is there something I'm missing with this entire setup?
Right now I have the Simple Press plugin installed. Is anything else needed for this to work?
I really don't want to get to the point of writing a direct database call to the table myself
Sounds good. The main problem is one of scope. Any decent plugin will try and only load the components that are absolutely necessary on page loads where the plugin is not the actual focus. We actually take some pride in this respect and this function you were chasing (and I know we suggested it!) is not really a part of our API that is easier to expose.
Let us know how it goes...
YELLOW
SWORDFISH
|
1 Guest(s)