![]() |
register.php
Please forgive me if this post is in the wrong place. Mods, please move to the appropriate forum. Thanks!
I want to display these variables in the error_moderateuser template. - custom user field # 5 - custom user field # 6 - the user's email address By doing a lot of searching and reading, I now understand that I must edit one of my php files. Specifically, I need to change the register.php file, according to the "vBulletin 2.0 Template Reference" in the members area. Question is... exactly what changes do I make to register.php? Thanks for any help! |
Just clarifying... the only change I need to make to register.php is just so I can access those particular variables from within the error_moderateuser template. I'm guessing this is something really simple, like from a "php 101" class... LOL... but I'm truly a newbie. So, thanks for any help! :)
|
You can edit the template and use variables like:
$bbuserinfo[email] for the email address. $bbuserinfo[field5] for the field 5 $bbuserinfo[field6] for the field 6. Is that what you want? |
Julian, thanks for your response! :) I tried putting the following code into the error_moderateuser template, to see what would happen...
field 5 = $bbuserinfo[field5] < br> field 6 = $bbuserinfo[field6] < br> email = $bbuserinfo[email] < br> But, it didn't work. The following output was displayed on the screen... field 5 = field 6 = email = The variables didn't work. Anyone know how to hack the register.php file, in order to make those variables accessible in the error_moderateuser template? Thanks again for any help! |
Oh. Now I understand.
It doesn't work with the above variables because those variables aren't created when the user signup. Instead, you must use the variables submitted by the registration form... Like this Field 5 = $field5 Field 6 = $field6 email = $email Hope this helps. |
1 Attachment(s)
Nope, still didn't work. :(
Here's the code I put into the error_moderateuser template... Field 5 = $field5 < br> Field 6 = $field6 < br> email = $email < br> And, I'm attaching a photo of what the output looks like. Please keep the ideas coming, though! Thanks! |
OK. Let's take a look:
Do you have email verification activated? |
Sorry, I was out doing chores, and I have to run out again. Do you mean you want to try registering on my board? It's a private board, so I can't post the URL.
Can you try putting that code in your error_moderateuser template? Or is there another way I can help you troubleshoot? |
No, I don't want to register on your board.
The problem is that the solution above won't work if you have email verification activated. To get the custom profile fields in error_moderateuser, you will have to hack register.php a little. Try this: Find this: PHP Code:
PHP Code:
Tell me if it works. |
Here's the new code in the register.php file.
PHP Code:
PHP Code:
[color=sky blue] field 5 = Jane Doe field 6 = 123 username = test email = my-email-address@my-domain.com ================== field 5 = field 6 = email = ================== field 5 = field 6 = email = my-email-address@my-domain.com ================== Thank you for registering, test. [/color] In summary, these variables worked.
As long as the data is being displayed correctly, does it matter which variables I use? BTW, thanks for all your help. It's such a great feeling to be making progress! :) |
I'm a little bit confused here. In my first post in this thread, I told you to use the $bbuserinfo[] array, but you told me that it didn't work. And now, you say it's working?
The fields displayed by $bbuserinfo are correct? If so, you don't need to hack register.php, leave the file unchanged. |
That's correct. Before I inserted the php code you gave me, into the register.php file, the $bbuserinfo[] array didn't work! See my post # 4 above, to see that the variables didn't display any data.
After I inserted the php code you gave me, the $bbuserinfo[] array works. Doesn't this count as a "hack" to the register.php file? Or is this called something else? |
Strange... The modifications I told you doesn't modify the $bbuserinfo array...
Try to undo the changes I told you, and see if it still works. |
Okay... on my way to revert the register.php file. :)
|
Okay, I deleted that one line of php code, from the register.php file.
I kept the error_moderateuser template code the way it was. PHP Code:
[color=sky blue]field 5 = field 6 = username = Unregistered email = ================== field 5 = field 6 = email = ================== field 5 = field 6 = email = my-email-address@my-domain.com ================== Thank you for registering, test.[/color] The only variables that work now, are these... - email = $userinfo[email] - username = $username |
Julian, you're not giving up, are you? :cry:
|
No, I'm not giving up... hehe.. :)
Well... I did some modifications to my register.php and it should work now. I had to add an extra query to the database to get the user information from the database... I hope you don't mind :) In register.php find: PHP Code:
PHP Code:
In the same file, find: PHP Code:
PHP Code:
And now, in error_moderateuser you can use: $userdata[username] to get the user name $userdata[email] to get the email $userdata[field5] to get userfield 5, etc... Tell me if it works. |
BTW, nice avatar :p
|
Thank you for sticking with me. I really appreciate your help. :)
Okay, should I also put the code back in, that you gave me in post # 9? I have to get off the computer now, but I'll try all your suggestions tomorrow! I'll let you know right away how it goes. And thanks for the compliment on my avatar. Yours is great too. It looks like it should be in a museum! ;) |
No, don't use the old code I gave you. You only have to follow the instructions in my last post :)
|
I reverted the register.php file and made the new changes.
Then I changed the code in the error_moderateuser template, as follows. PHP Code:
[color=sky blue] ================== field 5 = field 6 = username = Unregistered email = ================== field 5 = field 6 = username = test email = ================== field 5 = field 6 = username = test email = my-email@my-domain.com ================== field 5 = Jane Doe field 6 = 123 username = test email = my-email@my-domain.com ================== [/color] So, the $userdata[] array definitely works. :) :) :) Quick question. In post # 9, you gave me a code change that made the $bbuserinfo[] array work correctly. Why didn't you want me to stick with that? Is the $userdata[] array better or more secure than the $bbuserinfo[] array? :paranoid: Thanks again! :cool: |
Yes.... bbuserinfo only works when you're logged in, but the new array $userdata[] always works when error_moderateuser is displayed.
|
Hi Julian :),
Do you think the variables in the $userdata[] array can be passed into html form variables? I'd like to add a FormMail script to the error_moderateuser template. The idea is that, when the user loads that template into their browser, an email containing that user's data gets sent to their group leader. BTW, in case you need to know, group leaders don't have moderator access. They're just people who help keep thread discussions on track, for their group. Thanks again for all your help! And I hope you're enjoying the holiday season. :) |
you can use the $userdata array anywhere in error_moderateuser. I don't know how you're planning to use formmail to send the email to the group leader, but I'd rather use PHP to send the email.
|
Well, I would have the FormMail script uploaded to my cgi bin. And then there would be an HTML form on error_moderateuser, which would hopefully pass the variable data to the script.
Would that work? Do I have to do anything special to make the HTML form recognize the $userdata array as variables? Thanks. :) |
OK, now I get it.. but AFAIK, you need that the user press a submit button to send the information to the FormMail script.
It would be more easy if you use PHP to send the email. But if you still want to use the FormMail method, you can use those variables in error_moderateuser anywhere you want :) |
Yeah, I would rather use the HTML form --- with a submit button, thank you! :p --- than do more php coding. At least I feel somewhat familiar with HTML, but I know nothing about php. When I have some time, I'll try this out and I'll let you know what happened. :)
|
Hiya Julian,
Just wanted to follow up and let you know how it went. Everything is working great. I'm using an html form on error_moderateuser to collect the variable data, and I'm using the FormMail script to process the email. By the way, I'm using the FormMail script from the NMS Project --- http://nms-cgi.sourceforge.net/ --- so it's more secure. Thanks again for all your help! Enjoy the holidays! :) |
I'm glad to hear that! :)
Happy holidays too! |
All times are GMT. The time now is 11:31 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|