08-05-2016, 09:10 AM
@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
}
}
@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
}
}