04/05/2018 at 9:28 am
#457975
Keymaster
@ Robert
RE: On Forms, Add New Contact, is there a way to auto-populate the category?
Only if you edit the PHP file for it. Locate these lines (1846–1860) in the connections_form.php file.
$out = cnTemplatePart::category(
array(
'name' => 'entry_category',
'style' => array( 'width' => '100%' ),
'type' => 'multiselect',
'return' => TRUE,
'select_all' => '',
'exclude' => $metabox['atts']['exclude'],
'include' => $metabox['atts']['include'],
'group' => $metabox['atts']['group'],
'child_of' => $metabox['atts']['child_of'],
'hide_empty' => $metabox['atts']['hide_empty'],
'show_count' => $metabox['atts']['show_count'],
)
);
Change them to:
$out = cnTemplatePart::category(
array(
'name' => 'entry_category',
'style' => array( 'width' => '100%' ),
'type' => 'multiselect',
'return' => TRUE,
'select_all' => '',
'exclude' => $metabox['atts']['exclude'],
'include' => $metabox['atts']['include'],
'group' => $metabox['atts']['group'],
'child_of' => $metabox['atts']['child_of'],
'hide_empty' => $metabox['atts']['hide_empty'],
'show_count' => $metabox['atts']['show_count'],
),
'X,Y,Z'
);
Where X,Y,Z is change it to the category IDs (their number) that you want preselected.
RE: is there a hook to change the name/title of Category to some unique to our operation?
You can hook into the cn_pre_insert_term filter. It provides the term name that will be added. YOu will need to return your altered string after your operation.
Hope this helps!
