Log in

View Full Version : (Easy enough) What is the right code, to get username in plugin


basketmen
04-14-2009, 08:45 PM
i have a custom plugin, here is below the content


if ($_POST['do'] == 'addmember')
{
if (empty($_POST['email']))
{
$_POST['emailconfirm'] = $_POST['email'] = 'username@mydomain.com';
}
else
{
$_POST['emailconfirm'] = $_POST['email'];
}
}





i want code in bold above to get member username




i had try put these code there

$username
$bbuserinfo[username]
$userinfo[username]
$userinfo['username']
$vbulletin->userinfo[username]
$vbulletin->userinfo['username']



but no one works, please help guys what is the right code to get member username in plugin

Dismounted
04-15-2009, 05:20 AM
And the plugin is hooked at?

basketmen
04-15-2009, 06:43 PM
And the plugin is hooked at?
the Hook is register_start


how is it guys, who know the right code to get member username in that plugin?

BBR-APBT
04-15-2009, 07:18 PM
the Hook is register_start


how is it guys, who know the right code to get member username in that plugin?

If you are doing that in register_start you wont be able to pull a username I don't think. Since they are just registering they don't have a username yet. When you are logged in it will not even let you go to the register page.

What exactly are you trying to do maybe we can help another way.

basketmen
04-15-2009, 10:29 PM
If you are doing that in register_start you wont be able to pull a username I don't think. Since they are just registering they don't have a username yet. When you are logged in it will not even let you go to the register page.

What exactly are you trying to do maybe we can help another way.
i want to make member email when registering to username@myforumdomain.com


and this plugin almost working like that, just how to change username to each member real username


if ($_POST['do'] == 'addmember')
{
if (empty($_POST['email']))
{
$_POST['emailconfirm'] = $_POST['email'] = 'username@mydomain.com';
}
else
{
$_POST['emailconfirm'] = $_POST['email'];
}
}





btw when people registering in domain.com/register.php and they wrong to type captcha, the username field is still already filled with they username (the registering proccess is not finishing yet), so maybe i can get that username in email field like that



if you know please let me know what is the code to get member username in plugin

BBR-APBT
04-15-2009, 10:40 PM
$_POST['emailconfirm'] = $_POST['email'] = '$_POST['username']@mydomain.com';

Did you try the above code? Try it and let me know how it works for you.

Dismounted
04-16-2009, 01:31 AM
$customemail = $vbulletin->GPC['username'] . '@mydomain.com';
BTW, you should really do is at _complete, or _process, as vBulletin still does checks before registering the user. Also, at _complete, you will have the full user details.

basketmen
04-21-2009, 11:31 PM
$customemail = $vbulletin->GPC['username'] . '@mydomain.com';
BTW, you should really do is at _complete, or _process, as vBulletin still does checks before registering the user. Also, at _complete, you will have the full user details.
many thanks this is works

thank you for BBR-APBT too


regrads for both of you, GBU