ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Help with ac_memberlist

March 08, 2012 7:18am

Subscribe [2]
  • #1 / Mar 08, 2012 7:18am

    UKFreelancer

    49 posts

    Hi,

    I am trying to list all the members of the member_group of the currently logged in user.

    Using the following:

    {exp:ac_memberlist group_id="{member_group}”}
    {username}
    {/exp:ac_memberlist}

    It doesn’t appear to be working, nothing gets output.

    If however I swap {member_group} with it’s value e.g.
    {exp:ac_memberlist group_id="1"}
    {username}
    {/exp:ac_memberlist}

    Then the correct output is displayed.

    Is this something that could be done with some PHP processing?
    If so how would I do that.

    Any help much appreciated,

    UKFreelancer.

  • #2 / Mar 08, 2012 7:35am

    John St-Amand

    865 posts

    I think what you want to use is the EE global variable {group_id}, for the ID of the logged in member’s group.

  • #3 / Mar 08, 2012 7:49am

    UKFreelancer

    49 posts

    Thanks, but I’ve tried that, didn’t work either.

    I even ouput the values of both {member_group} and {group_id} before the {exp:ac_memberlist} code to check their values.

  • #4 / Mar 08, 2012 8:19am

    Bhashkar Yadav

    727 posts

    I looked into “AC Member list” plugin. it seems, showing all the members of specified member group (group_id) rather than currently logged in members.

  • #5 / Mar 08, 2012 8:30am

    UKFreelancer

    49 posts

    That’s is what I want it to do, but it’s not allowing variables to be passed in.

    It works if I specifically put the id in eg {exp:ac_memberlist group_id=”1”}

  • #6 / Mar 08, 2012 8:59am

    UKFreelancer

    49 posts

    I can’t seem to pass variables into the Query module either :-(
    e.g.

    {exp:query sql="SELECT username FROM exp_members WHERE group_id = {group_id}”}

    {username}

    {/exp:query}

  • #7 / Mar 08, 2012 9:34am

    Bhashkar Yadav

    727 posts

    well, you can do it easily by checking member’s session.

  • #8 / Mar 08, 2012 10:06am

    UKFreelancer

    49 posts

    Cheers,

    I’ve fixed it using some PHP (Shouldn’t really have to though!)

    <?php $groupId = $this->EE->session->userdata(‘group_id’); ?>
    {exp:ac_memberlist group_id="<?php echo $groupId; ?>"}
      {username}
    {/exp:ac_memberlist}

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases