A question probably for the dev's here: What's the preferred way to make a tab which displays on the users public profile switchable between visible and hidden?
Two ideas spring to mind:
1. Create two tabs in the plugin parameters - one used for registration / editing which should remain published, the second one for public display which can be published/unpublished as required.
2. Create an option in the single tab which allows you to turn the public display on or off.
I haven't actually tried to implement either of these methods yet so I may be missing something simple about the way this process is handled by CB, but thought I'd ask first and see if there's any useful advice!
I would go for option 2. You need to write a plugin that creates a tab and a field in the tab when installed. When the tab is drawn, the plugin checks wether the field is checked and if not, it returns empty string.
See plugin api document. ListTab plugin is a good example for extending default tab behavior.
If you manage to do this, please post the code here.
Ok this worked for me - I added an option in the tabs->tab->params section of the xml file like this:
[code:1]<param name="hidePublic"
label="Hide this tab on the public profile?"
type="list"
default="0"
description="Hide this tab on the public 'view profile' page?"
>
<option value="0">No</option>
<option value="1">Yes</option>
</param>[/code:1]
Then in the php file in getDisplayTab I do this check:
[code:1]function getDisplayTab($tab,$user,$ui) {
$hidePublic=$this->params->get('hidePublic');
if ( !$hidePublic ) {
// code here
}
}[/code:1]
And it only shows if the value is set to 1 in the parameters..
I put the xml code in cb.menu.xml in the <tabs> section ... but when I tried to add the code for the getDisplayTab section of cb.menu.php ... I got errors.
Could you show me a snippet of how that code should look in the file? Do I have to replace the existing code or am I adding code? Sorry for the newbie questions.