× 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
custom fields
#1
it is a question asked alot "how do i create a custom field"
why not allow people to create custom fields in the admin dashboard.
i really hope to see this in 5.0
Busy Tech
Common sense is not common
http://busy.eu.org
  Reply
#2
You can. We have that already.

If you want to add custom fields to the tabbed section at the top, that is in
Code:
usersc/includes/admin_panel_custom_settings.php

And if those are form fields that need to be posted, you can put that code in...
Code:
usersc/includes/admin_panel_custom_settings_post.php

If you want to add your own buttons at the top of the admin panel, you can do that in
Code:
usersc/includes/admin_panel_buttons.php

If you want something to show up between the admin buttons and the tabbed thing at the bottom, you can do that by creating the file
Code:
usersc/includes/admin_panels.php

and it will appear in that space between.

I hope this helps.
  Reply
#3
sorry i don't think i worded that right.
what i mean is to add a custom feild to the registration and accout settings at the moment is very hard. im thinking that it would be good to have something in the admin dashboard that would allow you to create custom registration feilds eg phone
Busy Tech
Common sense is not common
http://busy.eu.org
  Reply
#4
I'm almost positive we either did, or were working on it...and it isn't overly complicated.

You simply add it to /views/_join.php and copy join.php over to your usersc folder.

That being said if we didn't do this already, we will work on it as it is highly requested.
  Reply
#5
Not as elegant, but you can create a column called second_form in the users table and basically create a second page with all the info you want to collect on there. Then put something in usersc/includes/head_tags.php that says

Code:
if($user->data()->second_form != 1){Redirect::to('second_form.php');}

Then on successful submission of that form, it just sets that to a 1 in their user table and they'll never see that form again.

We do need to update that, but that's a quick and solid fix.
  Reply
#6
For what it is worth, this is how I added some custom fields to the registration page, join.php:

additional_join_form_fields.php
<pre>
Code:
<label for="phone_number">Phone Number*</label>
<input type="text" class="form-control" id="phone_number" name="phone_number" placeholder="Phone Number" value="<?php if (!$form_valid && !empty($_POST)){ echo $phone_number;} ?>" required>

<br>

<label for="most_recent_employer"> Current or Most Recent Employer*</label>
<input type="text" class="form-control" id="most_recent_employer" name="most_recent_employer" placeholder="Most Recent Employer" value="<?php if (!$form_valid && !empty($_POST)){ echo $most_recent_employer;} ?>" required>

<br>

<label for="certifications">List all Relevant Certifications*</label>
<input type="textarea" class="form-control" id="certifications" name="certifications" placeholder="Certifications" value="<?php if (!$form_valid && !empty($_POST)){ echo $certifications;} ?>" required>
</pre>


during_user_creation.php
<pre>
Code:
// update text fields for last registered user.  Uses associative array
$id = $theNewId;
$table = 'users';
$fields_array = [];
$fields_array += ['phone_number'=>Input::get('phone_number')];
$fields_array += ['most_recent_employer'=>Input::get('most_recent_employer')];
$fields_array += ['certifications'=>Input::get('certifications')];
</pre>


- Mike
$db->update( $table, $id, $fields_array );

  Reply
#7
Thanks for posting that @mleary2001 - I knew we had done it!!
  Reply
#8
@Brandin, @mleary2001 can you explain a little further. Am I suppose to create both files and place them in usersc? Also where am I suppose to add

– Mike
$db->update( $table, $id, $fields_array );
  Reply
#9
Those files are within usersc/ either in includes or scripts.
  Reply
#10
Thanks Guys I just figured it out. Sorry I'm a novice.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)