vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   register.php (https://vborg.vbsupport.ru/showthread.php?t=46058)

mishkan 11-24-2002 06:15 AM

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!

mishkan 11-24-2002 02:54 PM

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! :)

JulianD 11-24-2002 03:02 PM

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?

mishkan 11-24-2002 03:25 PM

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!

JulianD 11-24-2002 03:49 PM

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.

mishkan 11-24-2002 04:09 PM

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!

JulianD 11-24-2002 04:52 PM

OK. Let's take a look:

Do you have email verification activated?

mishkan 11-24-2002 07:51 PM

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?

JulianD 11-24-2002 10:06 PM

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:

            $DB_site->query("UPDATE user SET usergroupid=4$dotitle WHERE userid='$u'"); 

After it, add:

PHP Code:

            $userprofile $DB_site->query_first("SELECT * FROM useractivation WHERE userid='$u'"); 

Now in error_moderateuser, to display the email you can use $userinfo[email] and for the custom profile fields, use $userprofile[field6], $userprofile[field7], etc....

Tell me if it works.

mishkan 11-25-2002 01:14 AM

Here's the new code in the register.php file.
PHP Code:

 $username $userinfo['username'];
$DB_site->query("UPDATE user SET usergroupid=4$dotitle WHERE userid='$u'");
$userprofile $DB_site->query_first("SELECT * FROM useractivation WHERE userid='$u'");
eval(
"standarderror(\"".gettemplate("error_moderateuser")."\");"); 

Here's the code I put into the error_moderateuser template.
PHP Code:

 field 5 $bbuserinfo[field5] <br>
field 6 $bbuserinfo[field6] <br>
username $bbuserinfo[username] <br>
email $bbuserinfo[email] <br>
================== <
br>
field 5 $field5 <br>
field 6 $field6 <br>
email $email <br>
================== <
br>
field 5 $userprofile[field5] <br>
field 6 $userprofile[field6] <br>
email $userinfo[email] <br>
================== <
br
<
br>
Thank you for registering$username

And here's what was displayed by the error_moderateuser template.

[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.
  • field 5 = $bbuserinfo[field5]
  • field 6 = $bbuserinfo[field6]
  • username = $bbuserinfo[username]
    username = $username
  • email = $bbuserinfo[email]
    email = $userinfo[email]

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! :)

JulianD 11-25-2002 01:38 AM

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.

mishkan 11-25-2002 01:56 AM

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?

JulianD 11-25-2002 02:02 AM

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.

mishkan 11-25-2002 02:11 AM

Okay... on my way to revert the register.php file. :)

mishkan 11-25-2002 02:19 AM

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:

 field 5 $bbuserinfo[field5] <br>
field 6 $bbuserinfo[field6] <br>
username $bbuserinfo[username] <br>
email $bbuserinfo[email] <br>
================== <
br>
field 5 $field5 <br>
field 6 $field6 <br>
email $email <br>
================== <
br>
field 5 $userprofile[field5] <br>
field 6 $userprofile[field6] <br>
email $userinfo[email] <br>
================== <
br
<
br>
Thank you for registering$username

And here's what was displayed by the error_moderateuser template.

[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

mishkan 11-25-2002 10:00 PM

Julian, you're not giving up, are you? :cry:

JulianD 11-25-2002 11:22 PM

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:

if ($moderatenewmembers) { 

After it, add:

PHP Code:

        $userdata getuserinfo($userid); 


In the same file, find:

PHP Code:

            $DB_site->query("UPDATE user SET usergroupid=4$dotitle WHERE userid='$u'"); 

after it, add:

PHP Code:

      $userdata getuserinfo($u); 


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.

JulianD 11-25-2002 11:25 PM

BTW, nice avatar :p

mishkan 11-25-2002 11:41 PM

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! ;)

JulianD 11-25-2002 11:45 PM

No, don't use the old code I gave you. You only have to follow the instructions in my last post :)

mishkan 11-26-2002 09:49 PM

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:

================== <br>
field 5 $bbuserinfo[field5] <br>
field 6 $bbuserinfo[field6] <br>
username $bbuserinfo[username] <br>
email $bbuserinfo[email] <br>
================== <
br>
field 5 $field5 <br>
field 6 $field6 <br>
username $username <br>
email $email <br>
================== <
br>
field 5 $userprofile[field5] <br>
field 6 $userprofile[field6] <br>
username $userinfo[username] <br>
email $userinfo[email] <br>
================== <
br>
field 5 $userdata[field5] <br>
field 6 $userdata[field6] <br>
username $userdata[username] <br>
email $userdata[email] <br>
================== <
br

Here's what got displayed by the error_moderateuser template.

[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:

JulianD 11-26-2002 10:51 PM

Yes.... bbuserinfo only works when you're logged in, but the new array $userdata[] always works when error_moderateuser is displayed.

mishkan 12-04-2002 03:33 AM

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. :)

JulianD 12-04-2002 05:05 AM

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.

mishkan 12-04-2002 01:52 PM

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. :)

JulianD 12-04-2002 02:24 PM

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 :)

mishkan 12-04-2002 04:12 PM

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. :)

mishkan 12-13-2002 05:59 PM

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! :)

JulianD 12-16-2002 11:47 PM

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
  • Page Generation 0.01831 seconds
  • Memory Usage 1,841KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete