Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
How to grab group id?
  • Posted: 28.07.2005, 00:41
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    I'm using pnUserGetVars(pnSessionGetVar('uid')); and it's returning a good deal of info, but not the user's group id number...?

    Any idea'rs ....?

    :)

    --
    Photography | PHP | Other
  • Posted: 28.07.2005, 01:31
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    If pn0.760, Groups API function "getusergroups" might help...

    If not 0.760... then, it is the old way. :wink:

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 28.07.2005, 01:47
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    Ok...so what's the old way?

    ;)

    --
    Photography | PHP | Other
  • Posted: 28.07.2005, 01:55
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    offline
    last visit:
    28.11.08
    Posts:
    13417
    Hack, hack, hack!

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 28.07.2005, 01:55
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    Well... you know... the good old SQL...

    Code

    $uid = pnUserGetVar('uid');

    $dbconn  =& pnDBGetConn(true);
    $pntable =& pnDBGetTables()

    $tbl = &$pntable['group_membership'];
    $col = &$pntable['group_membership_column'];
       
    $sql = "SELECT $col[gid]
            FROM   $tbl
            WHERE  $col[uid] = '"
    .pnVarPrepForStore($uid)."'"
           
    $result =& $dbconn->Execute($sql);

    // We are looping in the rows because a user can be a member of many groups.
    for (; !$result->EOF; $result->MoveNext()) {
        list($gid) = $result->fields;
     
        echo $gid.'<br />';
     
    }

    $result->Close();


    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org
  • Posted: 28.07.2005, 02:02
     
    alarconcepts
    rank:
    Professional Professional
    registered:
     April 2004
    Status:
    offline
    last visit:
    21.01.08
    Posts:
    2723
    OH! I thought there might be a slimmer trick up your sleeve... :)

    --
    Photography | PHP | Other
  • Posted: 28.07.2005, 02:04
     
    Chestnut
    rank:
    Steering Committee Steering Committee
    registered:
     August 2002
    Status:
    offline
    last visit:
    03.03.08
    Posts:
    1221
    Well... you could always shout at your screen : "GIMME GROUP ID...".......

    But very few of us has the brain damaged enough to hear an answer.
    :wink:

    --
    Chestnut !
    Support via Private message won't be answered...
    http://dev.pnconcept.com
    http://www.postnuke-france.org

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula