The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (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
Adding inputs to join.php
#8
@dan I hope the move is going well, If you can help me when you can with the check boxes that would be great.


@snifer999

To add inputs you open join.php under users.

Look for $lname = Input::get('lname'); and under the list there you add your own so E.G
$age = Input::get('age');

under that you will see
'lname' => array(
'display' => 'Last Name',
'required' => true,
'min' => 2,
'max' => 35,
),
You add your own E.G
'age' => array(
'display' => 'Age',
'required' => true, (remove this line if it isn't required)
'min' => 2,
'max' => 3,
),

Near the bottom you should see
try {
// echo "Trying to create user";
$user->create(array(
'username' => Input::get('username'),
'fname' => Input::get('fname'),
'lname' => Input::get('lname'),
'email' => Input::get('email'),
'password' =>
password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)),
'permissions' => 1,
'account_owner' => 1,
'stripe_cust_id' => '',
'join_date' => $join_date,
'company' => Input::get('company'),
'email_verified' => $pre,
'active' => 1,
'vericode' => $vericode,
));
I be-leave there you add 'age' => Input::get('age') under fname or email etc..

then under views/ you click open _join.php and add your input
<label>Age</label>
<input id="age" name="age" type="text" />

To display the field under the user profile you open admin_user.php and add
<?=$userdetails->age?>

If you want to make it editable you do the following
<input class='form-control' type='text' name='age' value='<?=$userdetails->age?>' />

and if you go up the page you will see
if ($userdetails->lname != $_POST['lname']){
$lname = Input::get("lname");

$fields=array('lname'=>$lname);
$validation->check($_POST,array(
'lname' => array(
'display' => 'Last Name',
'required' => true,
'min' => 1,
'max' => 25
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "Last Name Updated";
}else{
?><div id="form-errors">
<?=$validation->display_errors();?></div>
<?php
}

Just add the following under it

if ($userdetails->age!= $_POST['age']){
$age = Input::get("age");

$fields=array('age'=>$age);
$validation->check($_POST,array(
'age' => array(
'display' => 'Age',
'required' => true, (Delete if not required input)
'min' => 1,
'max' => 3
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "AgeUpdated";
}else{
?><div id="form-errors">
<?=$validation->display_errors();?></div>
<?php
}
}
  Reply


Messages In This Thread
Adding inputs to join.php - by Disruptionz - 08-02-2016, 03:17 PM
Adding inputs to join.php - by Disruptionz - 08-02-2016, 04:09 PM
Adding inputs to join.php - by dan - 08-02-2016, 05:12 PM
Adding inputs to join.php - by Disruptionz - 08-03-2016, 02:28 PM
Adding inputs to join.php - by snifer999 - 08-03-2016, 09:36 PM
Adding inputs to join.php - by dan - 08-04-2016, 01:45 AM
Adding inputs to join.php - by dan - 08-05-2016, 12:44 AM
Adding inputs to join.php - by Disruptionz - 08-05-2016, 09:10 AM
Adding inputs to join.php - by Kighlander - 10-29-2016, 10:51 AM
Adding inputs to join.php - by mudmin - 10-29-2016, 11:58 AM
Adding inputs to join.php - by Kighlander - 10-29-2016, 05:41 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)