Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2015, 11:32 AM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 07-10-2015, 02:48 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any help regarding this would still be nice . Can also be a custom PHP file with database searches.
Reply With Quote
  #3  
Old 07-11-2015, 10:58 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 07-11-2015, 01:15 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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); }]]>
If I take a look at the code and PHP, the email checks the user table on the email field and results back to the user profile.

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
^ Would be my steamID. I'd like that ID to be searchable in either a PHP file or within the adminCP that when I enter 76561197983696188 it'll go back to my profile. The |0|0 at the end should be ignored though, as in the search shouldn't take that into consideration in the results.
Reply With Quote
  #5  
Old 07-11-2015, 01:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 07-11-2015, 01:57 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']) . "%'");
Do I need to add more rows, like the print_input_row?
Reply With Quote
  #7  
Old 07-11-2015, 02:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 07-11-2015, 02:19 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.
The steam_link result itself doesn't really matter to me. What I'm aiming for is that when I search for a field entry (field: steam_link) with example entry: 76561197983696188 that it forwards me to the users profile instead .

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 .
Reply With Quote
  #9  
Old 07-11-2015, 02:24 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, it looks like the results page redirects to the user profile if there is only one result, so I think you're all set there.
Reply With Quote
Благодарность от:
Skyrider
  #10  
Old 07-11-2015, 02:29 PM
Skyrider Skyrider is offline
 
Join Date: Feb 2006
Location: Netherlands
Posts: 1,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:38 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.14150 seconds
  • Memory Usage 2,263KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete