"Unable to get permission key for view_tree_node" after adding Topic Nodes programatically

I’m adding Pages with a bulk page creator and add topics as well, all fed by a excel file.
front end filtering with the created topics works great, but when I edit the page Attributes I get “Unable to get permission key for view_tree_node”.

$newtopic = TopicTreeNode::add(trim($xlsxrow[$fieldtouse]), $topicCategory[$fieldtouse]);
$topicsToAdd[$newtopic->treeNodeID] = $newtopic;

$page->setAttribute(strtolower($treename), $topicsToAdd);

what am I missing?

Hi @Stephan_UKF -

Just a quick note, but I’d recommend consistent camelCase there because that could get you into trouble ($fieldtouse vs. $topicsToAdd)

That said, can you give us a bit more info about the environment? E.g. the Concrete version and the PHP version? Thanks!

Hi Evan,

Here are the Environment Info

# Concrete Version
Core Version - 9.2.4
Version Installed - 9.2.4
Database Version - 20231207100748

# Database Information
Version: 10.10.3-MariaDB-1:10.10.3+maria~ubu2204-log

# Concrete Packages
Atomik Clone (1.0), Bulk Page Creator (1.0)

# Concrete Overrides
blocks/page_attribute_display/controller.php, blocks/page_attribute_display

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software

# Server API

# PHP Version

Thanks for the CamelCase hint, I’ll change that right now.

Thanks @Stephan_UKF - can you let me know where the Bulk Page Creator addon came from? Is that something you made custom or is that a core team addon? Or from the marketplace? I was having trouble finding it in the marketplace or the Concrete CMS Github.

Hi @EvanCooper
it’s my own addon. Do you want me to send it to you?

Hi @Stephan_UKF hmm in that case I’m wondering if it might be possible to boil this down to a more simple example of trying to add topic nodes programatically. If somehow that isn’t working on a basic level, it might be a core bug.

You might also double check how your addon is adding topics and make sure it’s not missing any arguments or anything.

Okay, found it: It was the Attribute itself and not the Topics with an error.

1 Like