WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using User Search (23 posts)

  1. letsserveit
    Member
    Posted 3 years ago #

    Just updated to the latest version of wordpress, and not too happy with the results.

    I use the search function on the users superadmin tab a few times a week, to search for email domains such as 163.com who has signed up, as these users are generally spam, i look for domains that has come up a few times, and then search for the domain name in search users - the previously version used to bring up the results of any users using a email address matching the search string, and then I would just select all and mark as spam.

    This no longer works!

    does anyone have any ideas?

  2. Wildcard in the front of the string will not work. niether will partials, actually.

    Myna* will work.

  3. letsserveit
    Member
    Posted 3 years ago #

    This is not good, particles worked before and dealt with the situation fine for me!

    How can I change this back??!

    it was really handy when I had loads of signups from the same spammy domain to find them all in a search to group them, and then mark as spam!!

    If i had known the search function had changed in 3.1, I wouldn't have bothered upgrading!!

  4. it was really handy when I had loads of signups from the same spammy domain to find them all in a search to group them, and then mark as spam!!

    Then go BLOCK THEM in the moderation list. Save yourself some work, you;re doing this the long way around.

    Did the search change? Yes.
    Is it different? Yep
    Does it still work? Yes, but differently than you are used to.

    the point is - rather than downgrading (which you can do) I'm suggesting you fix the other issue. You won't *have to* keep searching like that if you were blocking them properly in the first place.

    Also, you can zip to the end of the list without searching.

    (Yes, I run my own networks. I rarely have to search for spam signup and when I do, I don;t do it like that.)

  5. letsserveit
    Member
    Posted 3 years ago #

    Then go BLOCK THEM in the moderation list. Save yourself some work, you;re doing this the long way around.

    i DO block the domains in the moderation list, I just had to search for domains again when a new domain gets added with loads of spam blogs, hence why I have to do another user search, and they're not always on the very last page.

    Did the search change? Yes.
    Is it different? Yep
    Does it still work? Yes, but differently than you are used to.

    No it doesn't work - not in the way that I preferred/wanted it to work in the past

    the point is - rather than downgrading (which you can do) I'm suggesting you fix the other issue. You won't *have to* keep searching like that if you were blocking them properly in the first place.

    As mentioned before, I do add domains to the blocked domains list, but when new domain have come through the net, they are added as I go along.

    Also, you can zip to the end of the list without searching.

    Yes, fair enough you can, but I want to use the search to bring up all the same signup email domain so that i can do the click all, and mark as spam - simples.

    (Yes, I run my own networks. I rarely have to search for spam signup and when I do, I don;t do it like that.)

    Whats your secret to a no spam signup, everything I have tried has slipped throuh the net and spam signups still exists. yesterday alone, I got 100 spam signups!!

  6. The change was made to match the STANDARD way searches work in most apps, actually. Sorry you don't like it, but don't expect it to change. It was done to meet web standards.

    I get next to no spam sign ups as well:
    I use Akismet, Bad Behavior, Cookies for Comments (with the .htaccess tweak for blocking users from my signup page) and this: http://wpmututorials.com/how-to/spam-blogs-and-buddypress/

  7. Pete Mall
    Moderator
    Posted 3 years ago #

    Search was changed because it doesn't scale well.

    With regards to leading wildcards, that is something we considered, but decided against straight-up implementing it. Trailing wildcards are okay on performance cause it can search the start of the field, but leading definitely hurt the DB. (I actually think that leading is just as bad as both leading and trailing, but I haven't confirmed.)

    --Andrew Nacin

    If you understand the performance impact and want to change this then you can write a plugin and hook into WP_User_Query to change the behavior.

  8. Whats your secret to a no spam signup, everything I have tried has slipped throuh the net and spam signups still exists. yesterday alone, I got 100 spam signups!!

    I've covered it literally hundreds of times here in the forums and in the old mu forums and in my blog (wpmututorials,com)

    Biggest thing you can do: go to Network Admin -> Options. UNCHECK the box that says "Allow users to add other users"

    that means spammers let their spammy little friends in.

  9. wphreditor
    Member
    Posted 3 years ago #

    Does anyone know of a plugin that can do the search like letsserveit described?

    In my case, I use my WP for a class I help staff and we have hundreds of students that sign up for user accounts, I need to be able to search based on their email address so I can give them the access they need and put them in the right user group.

    This is really bad. I too would have skipped the upgrade had I known. At this point, if the students don't use their real name as part of their user account, I have no way to find them.

    Does anyone have any ideas on how I can get back the "search for users by email domain/whatever" functionality?

    Thank you,
    Markus

  10. letsserveit
    Member
    Posted 3 years ago #

    Maybe not a true secure solution, but what I did was just uploaded the old wp-admin/ms-users.php file and directly call it in the browser, You get the search option back to how it was before, but you will need to go to the address manually each time that you want to do a search.

    You'll also need to upload the old wp-admin/ms-edit.php, as it calls onto this if you edit/change anything

  11. I need to be able to search based on their email address so I can give them the access they need and put them in the right user group.

    This is really bad. I too would have skipped the upgrade had I known. At this point, if the students don't use their real name as part of their user account, I have no way to find them.

    if you know their full email address, it shoudl still find them.

  12. wphreditor
    Member
    Posted 3 years ago #

    Yes that worked(searching by full email) - thank you all very much!

  13. ivantus
    Member
    Posted 3 years ago #

    I've read the whole discussion and I do not agree with some comments here. Someone want to tell me that excluding the option to search the users table by email is a step forward? Come on - I have 90k users, almost NO spam registrations, but many many dumb users who doesn't know how to behave or who can't learn how to use the option to reset their password and I need to find them by email address since they contact us via the contact form, using some other name and their active email address. I tried to search for myself using the full email address but with no success so it doesn't work - definitely. Yes, I'm used to the way that I used for many years, I liked the way better and the most important thing - it was MUCH MUCH easier before the new option. Using wildcards is ok, but together with the option to search the users by email.
    And now - how shell I find the users that forgot their username AND password?
    Definitely a step backwards!

  14. FYI, posting the same question multiple times does not endear you to the mods :)

    As I said http://wordpress.org/support/topic/31-upgrade-now-user-and-site-search-not-working?replies=24#post-2098845

    You CAN search by email@domain.com - I do it every day for the exact same reason (I have a numbnut user who is incapable of remembering her password). And you know what? I was wrong about something. You can search for *@domain.com too!

    You can't do wildcards in front from the network admin, but it works fine from the per-site users, and you CAN search for the full email address on the network admin.

  15. ivantus
    Member
    Posted 3 years ago #

    i do not have the intention to draw attention of the mods but since there are two similar topics, i wanted to share my opinion on both. Unfortunately in my wp installation 3.1.1 search using users emails doesn't return any results even when i type my own email address.

  16. Upgrade to 3.1.2 - Works perfectly for me so either it was fixed in the latest version, or you have a plugin conflict.

  17. Gonçalo Peres
    Member
    Posted 3 years ago #

    For those still wanting to search in the email field, like before, you can add these lines of code to your theme "functions.php" file:

    if(is_admin()) {
      add_action( 'pre_user_query', 'user_search_by_email' );
      function user_search_by_email($wp_user_query) {
        if(false === strpos($wp_user_query->query_where, '@')) {
          $wp_user_query->query_where = substr(trim($wp_user_query->query_where), 0, -1 )." OR user_email LIKE '%".mysql_real_escape_string($_GET["s"])."%')";
        }
        return $wp_user_query;
      }
    }

    It's so small, that i don't think i needed a plugin just for this.

    I had to come up with this, because people were used to search users for parts of the the email (ex: "abc" to match "abcde@email.com").

    Hope this helps.
    Cheers!

  18. you can add these lines of code to your theme "functions.php" file:

    It woudl be better for something like this to go in the mu-plugins folder. This is exactly the kind of code you would place there and you don't need a plugin header nor does it need to be activated.

    It is not as appropriate to place it in theme files, as it's not theme dependent.

  19. Gonçalo Peres
    Member
    Posted 3 years ago #

    I understand that Andrea. Since i'm using a regular WordPress 3.x installation (not the MU), is there an "equivalent folder" where i can store this lines of code?
    TIA.

  20. Same folder. It's not even mu anymore in the code, and as the codex page I linked to explains, this folder has been in WordPress single since 2.8.

    mu-plugins is a backronym. Doesn't mean it's for multisite only.

  21. ivantus
    Member
    Posted 3 years ago #

    For those still wanting to search in the email field, like before, you can add these lines of code to your theme "functions.php" file:

    if(is_admin()) {
    add_action( 'pre_user_query', 'user_search_by_email' );
    function user_search_by_email($wp_user_query) {
    if(false === strpos($wp_user_query->query_where, '@')) {
    $wp_user_query->query_where = substr(trim($wp_user_query->query_where), 0, -1 )." OR user_email LIKE '%".mysql_real_escape_string($_GET["s"])."%')";
    }
    return $wp_user_query;
    }
    }

    Definitely a great alternative. Many of those who participate in this discussions play smart but only the rare ones give really a smart solution to solve a issue. Congratulations and many thanks!

  22. Gonçalo Peres
    Member
    Posted 3 years ago #

    Please correct the above code with this instead:

    if(is_admin()) {
      add_action( 'pre_user_query', 'user_search_by_email' );
      function user_search_by_email($wp_user_query) {
        if(false === strpos($wp_user_query->query_where, '@') && !empty($_GET["s"])) {
          $wp_user_query->query_where = str_replace(
                  "user_nicename LIKE '%".mysql_real_escape_string($_GET["s"])."%'",
                  "user_nicename LIKE '%".mysql_real_escape_string($_GET["s"])."%' OR user_email LIKE '%".mysql_real_escape_string($_GET["s"])."%'",
                  $wp_user_query->query_where);
        }
        return $wp_user_query;
      }
    }

    Sorry folks, but the previous code prevented from searching users by role. This approach is better and corrects that.

  23. Brayne
    Member
    Posted 2 years ago #

    @Gonçalo Thanks for the code.

Topic Closed

This topic has been closed to new replies.

About this Topic