Forum Replies Created
-
In reply to: Limit tags to a pre-defined list?
@23creative maybe you can give a clue?
This works now perfect when starting a new topic.
But when I edit a topic with e.g. 3 tags, edit screen shows only 1 tag selected. After I save the edited topic, all tags are lost.
Any ideas where to search for solution?
In reply to: Limit tags to a pre-defined list?FINAL CODE HERE.
FOR CHECK BOXES.
(Difference from the upper one: fixed issue with tags with more than 1 word)function displayTagElements($selectedTags, /* $userRole, */ $task){ $html= array(); $tags = get_categories(array('hide_empty' => 0, 'taxonomy' => 'topic-tag')); $selectedTagsArray = explode(',', $selectedTags); if($userRole != 'bbp_participant' || $task != 'edit') { $html[] = ""; foreach($tags as $tag) { $selected = ''; if (in_array($tag->name, $selectedTagsArray)) { $selected = 'checked'; } $html[] = "<input type='checkbox' name='bbp_topic_tags[]'".$selected." value='". $tag->name ."'>". $tag->name ." "; } } else { $html[] = $selectedTags; } return implode('', $html);
In reply to: Limit tags to a pre-defined list?Here is a working code. Hooray!
function displayTagElements($selectedTags, /* $userRole, */ $task){ $html= array(); $tags = get_categories(array('hide_empty' => 0, 'taxonomy' => 'topic-tag')); $selectedTagsArray = explode(',', $selectedTags); if($userRole != 'bbp_participant' || $task != 'edit') { $html[] = ""; foreach($tags as $tag) { $selected = ''; if (in_array($tag->name, $selectedTagsArray)) { $selected = 'checked'; } $html[] = "<input type='checkbox' name='bbp_topic_tags[]'".$selected." value=". $tag->name .">". $tag->name; } } else { $html[] = $selectedTags; } return implode('', $html);
In reply to: Limit tags to a pre-defined list?I think that there is also a need to change the surrounding <input></input> tag to <form></form>
In reply to: Limit tags to a pre-defined list?Hi 23creative. Thank you.
It works quite well. I get checkboxes with existing tags.
The problem is that when I select some of them and create a new topic, the created topic doesn’t have these tags attached to it. Any ideas where is the problem?
In reply to: How to stop “tag” page opening in sidebar?The same happens with the profile page.
This is a similar issue: https://bbpress.org/forums/topic/user-profiles-page-have-sidebar-stacked-with-divi-theme-from-eleganttheme/
In reply to: Limit tags to a pre-defined list?Is it possible to change the multiple select form into to separate checkboxes?
I think this line (that was added in fuctions.php) should be rewritten:
$html[] = '<select class="chzn-select" multiple="multiple" name="bbp_topic_tags[]" id="bbp_topic_tags">';