


Tags
Nova 2
Display Name
Version
Reviews
0.0 out of 5 stars
Allows characters to use a Display Name as an alternative to the First Name, Last Name, Suffix which is the default in Nova.
Compatibility
- Nova 2.7
- This add-on may work with Nova 2.7, but members of the community haven’t confirmed
- Nova 2.6
- This add-on may work with Nova 2.6, but members of the community haven’t confirmed
Version Info
1.0.1
Last updated
Install instructions
Display Name - A Nova Extension
This extension allows characters to use a Display Name as an alternative to the First Name, Last Name, Suffix which is default in Nova. If Display Name is blank the default method will be displayed.
This extension requires:
- Nova 2.6+
Installation
- Copy the entire directory into
applications/extensions/nova_ext_display_name
. - Add the following to
application/config/extensions.php
:
$config['extensions']['enabled'][] = 'nova_ext_display_name';
Setup Using Admin Panel - Preferred
- Navigate to your Admin Control Panel
- Choose Display Name under Manage Extensions
- Create Database Columns by clicking "Create Column" for each column. Once all columns are added the message "All expected columns found in the database" will appear.
- Click Update Controller Information to add the
get_character_name
function to yourapplication/models/characters_model.php
file.
Installation is now complete!
Manual Setup - If not using the method above.
- Run the following commands on your MySQL database:
ALTER TABLE nova_characters ADD COLUMN display_name VARCHAR(255) DEFAULT NULL;
- Add the following function in your
applications/models/characters_model.php
file to overwriteget_character_name
function.
public function get_character_name($character = '', $showRank = false, $showShortRank = false, $showBioLink = false)
{
$this->db->from('characters');
if ($showRank === true)
{
$this->db->join('ranks_'.GENRE, 'ranks_'.GENRE .'.rank_id = characters.rank');
}
$this->db->where('charid', $character);
$query = $this->db->get();
if ($query->num_rows() > 0)
{
$item = $query->row();
$array['rank'] = ($showRank === true) ? $item->rank_name : false;
$array['rank'] = ($showShortRank === true) ? $item->rank_short_name : $array['rank'];
if(!empty($item->display_name))
{
$array['display_name'] = $item->display_name;
}else {
$array['first_name'] = $item->first_name;
$array['last_name'] = $item->last_name;
$array['suffix'] = $item->suffix;
}
foreach ($array as $key => $value)
{
if (empty($value))
{
unset($array[$key]);
}
}
$string = implode(' ', $array);
if ($showBioLink === true)
{
return anchor('personnel/character/'.$item->charid, $string);
}
return $string;
}
return false;
}
}
Installation is now complete!
Usage
- Create or Edit a character.
- Enter a Display Name.
- Enter other values as normal.
- Save or Submit
- If Display Name is present the value will be displayed on the Manifest.
Issues
If you encounter a bug or have a feature request, please report it on GitHub in the issue tracker here: https://github.com/reecesavage/nova-ext-display-name/issues
License
Copyright (c) 2021 Reece Savage.
This module is open-source software licensed under the MIT License. The full text of the license may be found in the LICENSE
file.
Release notes
- v1.0.0 - Initial Release
- v1.0.1 - Fixed issue with custom table prefixes.
Links
- Website URL
- https://simcentral.org