Jump to content

Forums

Search In
  • More options...
Find results that contain...
Find results in...

Custom Field in Combat Roster


Recommended Posts

I know it says that it's for "advanced users", but I'm trying to understand how to show a custom field in the personnel roster. I created a new Personnel > Custom Field called "Rating" where a soldier may be given a rating (A, B, C, ...) as a radio. As a test, I configured the display as "<span>{title}: {value}</span>". When I add this field to Personnel > Settings > Customize, I get a template error that "Template perscom/front/columns/field_1 does not exist. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme."

As a bit of a Hail Mary, I tried to create this template with the same content and variables settings as perscom/front/columns/custom, but this threw a general error.

I didn't find anything when searching the forums, could someone help me, direct me to any relevant answers, or let me know what additional information I should provide?

Thanks!

Link to comment
Share on other sites

  • Administrators

Timothy, we recreated what you were talking about on our development site here: https://dev.deschutesdesigngroup.com/index.php?/perscom/personnel/. We selected the "Rating" field from the dropdown list and assigned it as the last column within the roster. Is this what you are wishing to accomplish?

Owner
Deschutes Design Group LLC
email | jon@deschutesdesigngroup.com

Link to comment
Share on other sites

Jon, yes that's pretty much it. The styling would be a bit different (use an image or CSS class) but I assume I'd be able to adjust that after I got it basically working. Our site is using IPB 4.3.6 since our theme doesn't seem to be compatible with 4.4, and Perscom 1.2.5. https://2ndrb.org/ipb/index.php?/perscom/personnel/roster/1-combat-roster/

I got it to stop showing the error by creating perscom/front/columns/field_1 and tried the contents {$soldier->personnel_field_1->_value} and variable $soldier. But I assume that's beside the point if it's supposed to work out of the box.

-Tim

Link to comment
Share on other sites

  • Administrators

Correct, you should not have to create your own templates. There is a template called “custom” within the columns group that is used for every personnel custom field. I’m not sure why it’s trying to use “field_1”.

If you submit a support request with ACP information, I can take a look to see what’s going on. 

Owner
Deschutes Design Group LLC
email | jon@deschutesdesigngroup.com

Link to comment
Share on other sites

For the small group of people (if it even exists) who might also have this problem, it was because I was still using IPB 4.3. I created the template "field_1" with variable "$soldier" and used something like the following:

{{$fields = \IPS\perscom\Personnel\CustomField::roots( 'view', NULL, array( 'field_visible=?', 1 ) );}}
{{$column = $fields[1]->column();}}
{$soldier->$column}

The index to fields will depend on which one you're trying to get.

Thanks again for the help, Jon!

-Tim

Edited by Timothy Kiselev
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.