Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Can you hide the admin from appearing?

Is it possible to apply an argument that hides the admin from showing in the member list?


  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Good suggestion. I think that if you are an admin you can see everybody, but if you are a simple user you can view only other members.

    I'll release a new version soon, stay tuned.

    There was an error rendering this rich post.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    In the meanwhile you can edit the php plugin class
    changing line 116 from

    $Sender->UserData = Gdn::SQL()->Select('User.*')->From('User')->OrderBy('User.Name')->Where('Deleted',false)->Get();

    to something like

    $Sender->UserData = Gdn::SQL()->Select('User.*')->From('User')->OrderBy('User.Name')->Where('Deleted',false)->WhereNotIn( 'User.Name', array('admin') )->Get();

    There was an error rendering this rich post.

  • Thanks for that, that worked like a charm! I'm trying to come up with another kind of statement, but I'm not sure you'd be willing to help on that as it's manipulating the final layout of your plugin so I don't want to offend at all!

  • If you wouldn't mind taking a look and hearing me out though, I'd really appreciate it and it may be something you could put into the next update!

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    If you have a clean, concrete and editable (via settings) function you can fork the plugin on github, commit your changes and then make a pull request.

    Otherwise you can share here your hacks and I'll try to transform it in a function reusable by every plugin's user.

    There was an error rendering this rich post.

  • I certainly don't have that, I'm just trying to seperate one big user list into several user lists grouped by a custom dropdown box value they selected on the registration form. But I can't figure out how to incorporate that into the foreach line in the code.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    If you explain better probably I can help you.

    There was an error rendering this rich post.

  • OKay, well in a really basic sense I've edited the registration form with some extra fields such as address and phone etc. But I've also included a dropdown box asking the user for their region, allowing them to select from:
    South Africa
    South America
    United Kingdom
    United States.

    So far this works fine and stores the information in a database. I can even recall some of the other items back out when listing the members names (such as their company name).

    But I just cant my head around compiling an if statement within or before your 'foreach' statement that generates the list of users that basically states 'if the $User->Region == 'uk'.. then perform your foreeach line.

    That way I can have each region layed out as a separately looking list with the respective users from that region, all displayed on one page.

  • For example, I've split each region block into divs.

    <div class="memberRegion"> <h3>Asia</h3> <?php if ($User->Region = 'uk') { foreach ($this->UserData->Result() as $User) { ?> <li class="memberlist"> <strong><?php echo UserAnchor($User); ?></strong>, <?php echo $User->Company; ?> </li> <?php }} ?> </div>

    But whenever I change the region values to each region, i still get just a list of all members. So although it doesn't produce any errors, it's not properly written, obviously. But no matter what I try, I still can't seem to get it working. Would you prefer to talk via email?

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    The if statement should be placed inside the foreach

    foreach(...){ if( strcmp($User->Region, 'uk') != 0 ){ // If he isn't from uk continue; // Skip this user (this element of the foreach) } .... }

    Also a custom sql query can return only certain users (better performance).


    There was an error rendering this rich post.

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    @lcollings the new version is out and natively support hiding some users

    There was an error rendering this rich post.

Sign In or Register to comment.