Submenu link not appearing (for Export page)

Hi all, I’ve simplified Bracken’s Thin CC export plugin and am trying to move its options page from the ‘tools’ menu to the ‘export’ menu in the dashboard. See https://github.com/SteelWagstaff/candela-thin-exports/blob/master/pb-thin-exporter.php#L31. The problem I’m having is that the submenu link is not appearing under the export menu. I think the problem is how I’m referring to the parent slug (I’m using pb-export) but I’m stuck. Any help greatly appreciated.

The current export menu item for Pressbooks appears to be loading as a child of admin.php. Don’t know if that makes any difference?

	$plugin_page = add_submenu_page(
		'pb_export',
		'Export Common Cartridge',
		'Export Common Cartridge',
		'edit_posts',
		basename( __FILE__ ),
		'thincc_manage'
	);

Slug has underscore, not hyphen.
‘export’, there is no such capability, see // see https://codex.wordpress.org/Roles_and_Capabilities

Regards.

1 Like

Thanks, Dac! I think Bracken may have defined the ‘export’ capability elsewhere (I left this arg unchanged), but I will replace with ‘edit_posts’. It looks to be working as expected now. Sorry to ask you to catch my typos for me!

Oh, and I am seeing an ‘export’ capability on the reference doc you sent me: https://codex.wordpress.org/Roles_and_Capabilities#export. Do you have an opinion about which would be more suitable in this use case?

I’d look at the menu for Pressbooks’ export page. I believe we use the manage_options capability.

1 Like

Looks like you’re using ‘edit_posts’ there currently, unless I’m looking in the wrong place: https://github.com/pressbooks/pressbooks/blob/84b697742de87dba9424fda93d27f7f3d0058347/inc/admin/laf/namespace.php#L186

Yes, that’s correct— thanks for checking!

1 Like

I am seeing an ‘export’ capability on the reference doc you sent me.

I learn something new everyday. :slight_smile:

1 Like