Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 12-13-2011, 12:04 AM
leoglobant leoglobant is offline
 
Join Date: Nov 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom error messages when register

Hello.

I was wondering if you could guide me on this.

I need to know how can I show a custom error message when the user is registering. As I need to check the user existence in other system before registering, and that system is going to provide me an error message, I need to show that error as if it was from vBulletin (wrong username, wrong email and that sort of thing)

Where should I look at?

Thanks a lot in advance.
Reply With Quote
  #2  
Old 12-13-2011, 12:54 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the username, you could create a plugin using hook location register_addmember_process and code something like this:

Code:
if ($vbulletin->GPC['username'] is taken)
{
    $userdata->error('usernametaken', htmlspecialchars_uni($vbulletin->GPC['username']), $vbulletin->session->vars['sessionurl']);
}

and you can probably do something similar for email or other fields.

Also, the username is checked on the registration form page via a call to ajax.php, so you could create another plugin using hook ajax_start and code similar to the section that starts with
Code:
if ($_POST['do'] == 'verifyusername')
{
Reply With Quote
  #3  
Old 12-13-2011, 10:51 PM
leoglobant leoglobant is offline
 
Join Date: Nov 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks kh99.

Is there a way to disable the ajax user check?

Regards.
Reply With Quote
  #4  
Old 12-13-2011, 10:59 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, edit the register template and search for vbulletin_ajax_nameverif.js. That should make it easy to find the block of code below and add the <vb:comment>...</vb:comment> tags around it:

Code:
<vb:comment>
	<script type="text/javascript" src="clientscript/vbulletin_ajax_nameverif.js?v={vb:raw vboptions.simpleversion}"></script>
	<script type="text/javascript">
	<!--
		regname_verif = new vB_AJAX_NameVerify('regname_verif', 'regusername');
	//-->
	</script>
</vb:comment>
Reply With Quote
  #5  
Old 12-13-2011, 11:17 PM
leoglobant leoglobant is offline
 
Join Date: Nov 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot!
Regards.

--------------- Added [DATE]1323879434[/DATE] at [TIME]1323879434[/TIME] ---------------

The last one about registration

How can I get the password without md5 applied? I see the $vbulletin->GPC['password'] but that is with md5 like $vbulletin->GPC['password_md5'].

Thanks in advance!
Reply With Quote
  #6  
Old 12-14-2011, 03:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to define DISABLE_PASSWORD_CLEARING, like:

Code:
define('DISABLE_PASSWORD_CLEARING', true);

You could try putting it in a plugin, maybe using init_start. Or you could edit register.php and put it at the top.
Reply With Quote
  #7  
Old 12-14-2011, 07:23 PM
leoglobant leoglobant is offline
 
Join Date: Nov 2011
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I define that constant but I can get the password without md5 applied neither on the login nor registration. Maybe I'm using the wrong variable to get the clean password, I use the $vbulletin->GPC['vb_login_password'] variable in login and $vbulletin->GPC['password'] on registration.

--------------- Added [DATE]1323896650[/DATE] at [TIME]1323896650[/TIME] ---------------

I found out that the:

Code:
define('DISABLE_PASSWORD_CLEARING', true);
should be in the config.php file.

Thanks a lot for your help kh99!
Reply With Quote
  #8  
Old 12-14-2011, 09:23 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, config.php - that's brilliant. I'm so used to thinking about how to do things without editing files that that never would have occurred to me.
Reply With Quote
  #9  
Old 11-12-2013, 03:09 PM
induslady induslady is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello kh99,

I have a similar requirement where in I want to customize the phrase - "usernametaken".

1)For an already existing user name the error should be -
That username is already in use. If you are {1} and you have forgotten your password, click <a href="login.php?{2}do=lostpw">here</a>.

2)For special characters and space the error should be -
That username does not meet the administrator's standards.

Any idea how I do it? Have also raised it here -
https://vborg.vbsupport.ru/showthread.php?t=304430

Thanks in advance.
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05956 seconds
  • Memory Usage 2,225KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete