- Moderated by:
- Support
-
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 28.11.08
- Posts:
- 13417
Mark's comment here tells you the functionality will be in .8:
http://forums.postnuke.com/index.php?name=PNphpBB2&file=viewtopic&t=39347
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Professional
- registered:
- December 1969
- Status:
- offline
- last visit:
- 10.01.08
- Posts:
- 1631
-
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 28.11.08
- Posts:
- 13417
Quote
In fact I said it's in .760
oops ;)
Presumably the function returns an array of group ids rather than group names - so you couldnt echo it out.
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Professional
- registered:
- December 1969
- Status:
- offline
- last visit:
- 10.01.08
- Posts:
- 1631
Would be nice to know how to use it in templates too.
For example, I would like to be able to show what groups the user is in in the member list, or using advprofile and its templates.
How would i do it to show their group name instead of just their group ID, without doing an "if" statement, etc. -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 28.11.08
- Posts:
- 13417
Groups_userapi_get()
Returns an array of group name, id and member ids - if you want to find the groups of lots of users you might be better off doing it through that API...
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Professional
- registered:
- December 1969
- Status:
- offline
- last visit:
- 10.01.08
- Posts:
- 1631
what if its just for that specific user. Sry, just trying to get some better examples as thats how I learn best. Partial code doesnt help me to much, and as its looking, it doesnt look like its really that much easier than it was before. -
- rank:
-
Professional
- registered:
- December 2002
- Status:
- offline
- last visit:
- 24.08.08
- Posts:
- 1588
I'm guessing that you would set the $userid variable for this - ie $userid = 10; (put this before the function) you would then display the groups with a and array loop I suppose...put this after the fucntion call: print_r($usersgroups); you will then see output of what the function is returning.
-Lobos
--
-Lobos
Professional PHP Framework Services: Concept, Development and Deployment -
- rank:
-
Steering Committee
- registered:
- August 2002
- Status:
- offline
- last visit:
- 03.03.08
- Posts:
- 1221
The advProfile plugin would probably be something like this on a pn0.760 install...
Code
<?php
function advProfile_userapi_usergroups($args)
{
extract($args);
unset($args);
if (!isset($uid)) {
return false;
}
if (!pnModAPILoad('Groups', 'user')) {
return false;
}
$usergroups = array();
$usergroups = pnModAPIFunc('Groups',
'user',
'getusergroups',
array('uid' => $uid));
return $usergroups;
}
?>
The template, something like this :
Code
<!--[section name="usergroups" loop=$usergroups]-->
<!--[$usergroups[usergroups].name]--><br />
<!--[/section]-->
This is done reallllly fast and I don't have time to check it......... I'm REAAAALLLY LATE....
Cya ! :wink:
--
Chestnut !
Support via Private message won't be answered...
http://dev.pnconcept.com
http://www.postnuke-france.org -
- rank:
-
Professional
- registered:
- December 1969
- Status:
- offline
- last visit:
- 10.01.08
- Posts:
- 1631
Thanks Chestnut, thats exactly the type of example i was looking for. I will definately try it out when i get home. Would it be possible to use that same type of logic in any module? -
- rank:
-
Steering Committee
- registered:
- August 2002
- Status:
- offline
- last visit:
- 03.03.08
- Posts:
- 1221
The Plugin way......
usergroups.php
advProfile_plugin_usergroups.tpl
And in the main tpl :
Code
<!--[$plugins.usergroups]-->
Still untested and not much time to test anything until later though...
--
Chestnut !
Support via Private message won't be answered...
http://dev.pnconcept.com
http://www.postnuke-france.org
