The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Make guests give a name when posting or replying Details »» | |||||||||||||||||||||||||||
Make guests give a name when posting or replying
Developer Last Online: Jul 2023
One of the big problems with guest postings is the majority of them show up as "Unregistered" due to the user's laziness.
With a little checking you can 'make' them give a name. Simply put when the user submits the form, it checks the username field (which only shows when you're not logged in) for 'Unregistered' or emptyness, and if it's either, shows an alert to the user. There are two usable methods: 1. Javascript based. This checks the username as soon as you click submit and pops up a dialog if it's 'Unregistered' or blank. This method is more instant but screws up wysiwyg input. If you use or plan to use wysiwyg, go the second option. 2. vB checking based. This allows the submit (or preview) to go and produces an error in the same way as 'post too short' or similar. For 1, see post 2. For 2, see post 3. Click install if you like. Don't if you don't want to. I don't really care Show Your Support
|
Comments |
#2
|
|||
|
|||
Javascript version:
Open newpost_usernamecode Find (near the bottom) Code:
<td class="smallfont" colspan="2"><input type="text" class="bginput" name="username" value="$bbuserinfo[username]" size="50" style="margin-top:1px" /></td> Code:
<td class="smallfont" colspan="2"><input type="text" class="bginput" name="username" value="$bbuserinfo[username]" size="50" style="margin-top:1px" onfocus="javascript: if (this.value == 'Unregistered') { this.value = ''; }" /></td> Open newthread Find (almost at the top) Code:
<form action="newthread.php" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="return validatePost(this, this.subject.value, $vboptions[postminchars], $vboptions[postmaxchars]);" onreset="vB_RESET(this);"</if>> Code:
<form action="newthread.php" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="javascript:if ((document.vbform.username.value == 'Unregistered') || (document.vbform.username.value == '')) { alert('Please insert a nickname or an online name you use, so that you can be identified from other unregistered users'); document.vbform.username.focus(); return false; } return validatePost(this, this.subject.value, $vboptions[postminchars], $vboptions[postmaxchars]);" onreset="vB_RESET(this);"</if>> Open newreply Find (again, near the top) Code:
<form action="newreply.php" name="vbform" method="post"<if condition="!is_browser('webtv')"> onsubmit="return validatePost(this, 0, $vboptions[postminchars], $vboptions[postmaxchars]);" onreset="vB_RESET(this);"</if>> Code:
<form action="newreply.php" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="javascript:if ((document.vbform.username.value == 'Unregistered') || (document.vbform.username.value == '')) { alert('Please insert a nickname or an online name you use, so that you can be identified from other unregistered users'); document.vbform.username.focus(); return false; } return validatePost(this, this.subject.value, $vboptions[postminchars], $vboptions[postmaxchars]);" onreset="vB_RESET(this);"</if>> |
#3
|
|||
|
|||
vB checking version:
Step 1. Add phrase Phrase Type: Front-End Error Messages Varname: notuniqueusername Text: Using the "Your username" input box just below, please insert a nickname or an online name you use, so that you can be identified from other unregistered users. (The Text can be whatever you like) Step 2. Open includes/functions_newpost.php Find (around line 767): Code:
if (empty($post['username'])) { eval('$errors[] = "' . fetch_phrase('nousername', PHRASETYPEID_ERROR) . '";'); } Code:
else if ($post['username'] == 'Unregistered' OR $post['username'] == '') { eval('$errors[] = "'. fetch_phrase('notuniqueusername', PHRASETYPEID_ERROR) . '";'); } Step 3 - optional. It simply clears the "Your username" box if it's clicked on and says 'Unregistered' Open template newpost_usernamecode Find (near the bottom) Code:
<td class="smallfont" colspan="2"><input type="text" class="bginput" name="username" value="$bbuserinfo[username]" size="50" style="margin-top:1px" /></td> Code:
<td class="smallfont" colspan="2"><input type="text" class="bginput" name="username" value="$bbuserinfo[username]" size="50" style="margin-top:1px" onfocus="javascript: if (this.value == 'Unregistered') { this.value = ''; }" /></td> |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|