So I’ve created an extension that allows you to hide weblogs from the publish tab. But I’ve done it in a way which feels very hackish, and doesn’t seem like a good long-term solution.
All I really need to do is to insert 2 lines of code in $DSP->page_navigation(), but the only way I can see to do it is to use the “cp_display_page_navigation” extension hook, and so I need to replace that entire function.
To do that I’ve just taken that entire function and put it into my extension, and added my 2 lines of code.
It works like a champ, but like I said this doesn’t seem like a viable long-term strategy for doing this. At any time the official page_navigation() function could be updated, but my extension won’t reflect this and will be using the old code since it’s now in my extension. So then I would need to keep multiple versions of my extension - have a new one for each version that has a change in the page_navigation function - and I would need to make sure to keep each of these available for myself or others who are running different versions of EE.
What is good practice here? Like I said, all I need to do is add 2 lines of code to a function that is about 500 lines long.
Thoughts?
Hi Brian,
If you do a print_r($SESS->userdata[‘assigned_weblogs’]) you’ll see that the weblogs you have access to are stored in that array. You could use the same hook you’re using now to just unset() the elements of the array that correspond to the weblogs you want to hide.
This may have the side effect of also hiding entries in those weblogs from the edit page also, but thats a bonus right? :D
EDIT: Just tried it and no, they will still show on the edit page.
If you click on the publish link in the CP page, you’re taken to a page that shows a list of weblogs you can publish to. Where is this page located - and can I use an extension hook to modify it or do I need to hack it if I don’t want these weblogs to show there either?
Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.