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.

Advanced search for roles (and, not etc.)

edited May 2012 in Vanilla 2.0 - 2.8

Good Day

I was trying to search for user which have NOT assigned a certain role. I tried different programming operators, but I didn't manage to find anything that worked.

Is there the possibility to have advanced searches when you look for roles (and, or, not etc.) ?

Tagged:

Best Answer

  • x00x00 MVP
    Answer ✓

    You mean in /user/browse ? it is absolute match only

    grep is your friend.

Answers

  • $RoleModel = new RoleMode();
    $UserRoles = $RoleModel->GetByUserID(Gdn::Session()->UserID);
    
    $HasRoles=array();
    
    foreach ($UserRoles => $UserRole)
          $HasRoles[]=$UserRole->Name;
    
    

    grep is your friend.

  • @Aranir you can also do that in phpMyAdmin if you like...
    Or you can try the way x00 showed.
    If you want to do it in phpMyAdmin, see if you have the tab 'Query' (so Browse, Structure, SQL, Search Query) and there you can make some filters.

    There was an error rendering this rich post.

  • Thank you, that is alright if I want to change it from my mysql interface, but i was wondering if the dashboard search would as well allow for such advanced search features (as it is implemented in google).

    Or is a mysql query the only way to get these results out?

    Thank you both for the answers (and the speed)!

  • x00x00 MVP
    Answer ✓

    You mean in /user/browse ? it is absolute match only

    grep is your friend.

  • Aranir said:
    but i was wondering if the dashboard search would as well allow for such advanced search
    Or is a mysql query the only way to get these results out?

    Like my neighbour above me ^^ says : You only see the actual users, no real search filters, etc. Do it with a pure MySQL query or a special file, see x00's first post in this topic :-)

    There was an error rendering this rich post.

  • Shame that it only works for exact matches... a not option would be really handy ^^

    Thank you for the clarification :)

  • like I said you could always develop a plugin.

    It would be impossible to carry out every possible idea or need that people want and vanilla wouldn't be vanilla if that was the case, it would be a bloated forum software.

    grep is your friend.

  • everybody who is not a member (roleid=8) in default setup.

    SELECT UserID FROM GDN_UserRole WHERE RoleID NOT LIKE '8';

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thank you for all the responses, and i think a plugin would be a great solution for this.
    And i agree that not every little wish can be implemented ^^

    But i was just asking to know if that functionality already existed, and i may just had missed it.

    thank you all again.

Sign In or Register to comment.