The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
during_user_creation script problems
#1
I have been having some problems with the during_user_creation.php script.  I made an extra field in the users table called acount_id.
I tried the example code:
 $db->update('users',$theNewId,['account_id'=>Input::get('account_id')]); 

and nothing happend.

I uncommented dump($_POST); to see what was going on and after creating the user, the page did not show any dump info.
  Reply
#2
Can you paste your entire during_user_creation please?

The dumping of POST may or may not have anything, I'm not sure, but what you should do after doing an update is check for an error, I usually do this after ANY db statement:
https://pastebin.com/Xn4D6kX6

Thank you,
Brandin.
  Reply
#3
ok. What you're probably running into is that you get redirected right after going to during_user_creation so what I do there is do dnd($_POST);

If your post looks good, then get rid of that dnd statement and do your
$db->update('users',$theNewId,['account_id'=>Input::get('account_id')]);
and on the next line do
dnd($db->errorInfo());
I'm guessing that will tell you what your error is.
  Reply
#4
example url 
www.bogus_site.com/usersc/join.php?account_id=20





<?php
// This script is really useful for doing additional things when a user is created.
 
// You have access to two things that will really be helpful.
//
// You have the new user id for your new user. Comment out below to see it.
//dump($theNewId);
 
//You also have access to everything that was submitted in the form.
//dump($_POST);
 
//If you added additional fields to the join form, you can process them here.
//For example, in additional_join_form_fields.php we have a sample form field called account_id.
// You may wish to do additional validation, but we'll keep it simple. Uncomment out the code below to test it.
 
// The format of the array is ['column_name'=>Data_for_column]
 
$db->update('users',$theNewId,['account_id'=>Input::get('account_id')]);
 
// You'll notice that the account id is now in the database!
 
// Even if you do not want to add additional fields to the the join form, this is a great opportunity to add this user to another database table.
// Get creative!
 
// The script below will automatically login a user who just registered if email activation is not turned on

 
$e = $db->query("SELECT email_act FROM email")->first();
if($e->email_act != 1){
  $user = new User();
  $login = $user->loginEmail(Input::get('email'), trim(Input::get('password')), 'off');
  if(!$login){Redirect::to('login.php?err=There+was+a+problem+logging+you+in+automatically.');}
  //where the user goes just after login is in usersc/scripts/custom_login_script.php
}
  Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)