The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom value search in userDB back to profile for adminCP like (Quick Email Finder)
I was wondering if there's an easy way for me to add a code into the admin_index_xx hook to search inside a specific field and result to the users profile in admincp? Much like the Quick Email Finder, but rather than the email, searching another field inside the user table. I attempted to replicate the code of Quick Email Finder and try to make it work, but thus far not working.
Not referring specific which field, as I have multiple fields in mind in the end. I was just hoping someone could push me into the right direction. For what it's worth, these fields inside the user table is not default from a vB installation. --------------- Added [DATE]1433074760[/DATE] at [TIME]1433074760[/TIME] --------------- For those who are confused. I merely wish to create a custom MySQL field search, in a specific table resulting in the username as a result from the AdminCP. Exactly like the Quick Email Finder, or the username finder, etc. |
#2
|
|||
|
|||
Any help regarding this would still be nice . Can also be a custom PHP file with database searches.
|
#3
|
|||
|
|||
Hmm, I'm not sure why it would be a problem to seach the profile fields the same way as emails, except for the fact that the added profile fields are in the userfield table instead of the user table. But you could do a JOIN to add those fields on.
|
#4
|
|||
|
|||
What exactly do you mean with userfield?
If I would take an example here: https://vborg.vbsupport.ru/showthread.php?t=228667 Code:
<![CDATA[if (can_administer('canadminusers')) { print_table_start(); print_table_header($vbphrase['quick_email_finder']); print_label_row($vbphrase['quick_email_finder'], ' <form action="user.php?do=find" method="post" style="display:inline"> <input type="hidden" name="s" value="' . $vbulletin->session->vars['sessionhash'] . '" /> <input type="hidden" name="adminhash" value="' . ADMINHASH . '" /> <input type="hidden" name="do" value="find" /> <input type="text" class="bginput" name="user[email]" size="30" tabindex="1" /> <input type="submit" value=" ' . $vbphrase['find'] . ' " class="button" tabindex="1" /> </form> ', '', 'top', NULL, false ); print_table_footer(2, '', '', false); }]]> Do you happen to have an example? I might as well show which field I'm trying to search. Within the USER table there's a "steam_link" field. With example of how it looks like: Code:
76561197983696188|0|0 |
#5
|
|||
|
|||
OK, I think I misunderstood you. I thought you said you tried to take existing code from the admincp and change it to search for other fields. But you were talking about a mod that uses admicp/user.php to do a specific search. Anyway, the do='find' section of user.php looks like it should be able to do a search for any field in any of the existing columns of the user tables, or in custom profile fields. But if I understand you, you're saying you've added a column to the user table and now you want to be able to search it? Then if you want to do it the way that mod does it (using user.php), I think you'd need to modify the fetch_user_search_sql() function in adminfunctions_user.php to be able to add the condition to search your field.
|
#6
|
|||
|
|||
Thanks, checking out that PHP file right now. From the looks of it, I assume I need to add a row like this:
Code:
$condition .= iif($user['email'], " AND {$prefix}email LIKE '%" . $vbulletin->db->escape_string_like($user['email']) . "%'"); |
#7
|
|||
|
|||
Oh right. I guess you'd at least want to display that field on the results page. It looks like that's in the do = 'find2' section. Maybe you just need to add ifs for your field and add it to the $header and $cell arrays like the others are doing, but I don't know. You might also want it on the standard user edit page.
From your other posts here I'm guessing you're capable of figuring it out, probably even faster than I could Or maybe someone else already knows. |
#8
|
|||
|
|||
Quote:
So in short: AdminCP -> Search for 76561197983696188 -> ID found on a users profile -> Redirects the users VBulletin Profile Not sure if this'll work though: Code:
$condition .= iif($user['steam_link'], " AND {$prefix}steam_link LIKE '%" . $vbulletin->db->escape_string_like($user['steam_link']) . "%'"); I don't mind if it's a separated custom PHP file (like creating your own PHP page on vBulletin) that gives the same result. As long it does what I'm aiming for . |
#10
|
|||
|
|||
Indeed I am, thanks . It's working perfectly. Thanks for the tip where to look for. Really appreciate it.
Now I have to figure out how to create a secondary row within the adminCP so below the "quick email finder" there's "quick ID finder". EDIT, found it.. thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|