Buddypress has the ability to have different sections of the profile.
I am currently constructing a dating site where the user can upload a video of themselves instead of answering profile questions. The video will appear in the tabs as the first tab IF they have set a video to be “Featured”.
I have set up so that the content doesn’t show up unless the user has a featured item to display.
if (!class_exists('BpMembersTab_rt_media') && function_exists('rtmedia_featured')):
My question is how to alter the tab php so that this specific tab doesn’t show without a featured media being active.
if (!class_exists('BpMembersTabs')):
class BpMembersTabs {
private static $instance;
public $tabs;
public $active_tab = false;
public $album_exists = false;
public $has_data = array();
public $fields_data = array();
public function __construct($tabs) {
self::$instance =& $this;
$this->tabs = $tabs;
$this->active_tab = apply_filters( 'kleo_bp_profile_default_top_tab',FALSE );
$this->render();
}
public static function &get_instance()
{
return self::$instance;
}
public function render()
{
if (!is_array($this->tabs)) {
return;
}
echo '<dl class="tabs pill custom">';
foreach ($this->tabs as $key => $tab)
{
if (empty($tab)) {
continue;
}
if (!isset($tab['group'])) {
$tab['group'] = $tab['name'];
$this->tabs[$key]['group'] = $tab['name'];
}
$name = 'BpMembersTab_'.$tab['type'];
if (class_exists($name)) {
$tabcls = new $name($tab);
}
else {
$tabcls = new BpMembersTab($tab);
}
if ($tabcls->has_profile_data($tab['group'])) {
echo $tabcls->title();
}
}
echo '</dl>';
echo '<ul class="tabs-content custom">';
foreach ($this->tabs as $tab)
{
if (isset($this->fields_data[$tab['group']]))
{
$active = '';
if($this->active_tab == esc_attr(str_replace("%", "", sanitize_title_with_dashes($tab['name']))) ) {
$active = 'active';
}
echo '<li '.$active.' id="'.esc_attr(str_replace("%", "", sanitize_title_with_dashes($tab['name']))).'Tab" class="'.$active." ".$tab['class'].'">';
echo $this->fields_data[$tab['group']];
echo '</li>';
}
}
echo '</ul>';
}
}
endif;