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
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
custom fields - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: General (https://userspice.com/forums/forumdisplay.php?fid=20)
+--- Forum: UserSpice 5 - Roadmapping the Future (https://userspice.com/forums/forumdisplay.php?fid=31)
+--- Thread: custom fields (/showthread.php?tid=949)

Pages: 1 2 3 4


custom fields - Busy Tech - 02-13-2018

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


custom fields - mudmin - 02-13-2018

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.



custom fields - Busy Tech - 02-14-2018

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


custom fields - Brandin - 02-14-2018

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.


custom fields - mudmin - 02-14-2018

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.


custom fields - mleary2001 - 03-08-2018

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




custom fields - Brandin - 03-08-2018

Thanks for posting that @mleary2001 - I knew we had done it!!


custom fields - famproent - 05-21-2018

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


custom fields - Brandin - 05-21-2018

Those files are within usersc/ either in includes or scripts.


custom fields - famproent - 05-21-2018

Thanks Guys I just figured it out. Sorry I'm a novice.