bux23
2/28/2017 - 9:33 AM

ultimate member - mycred tabs

ultimate member - mycred tabs

<?php

/* PROFILE PAGE POINTS TAB */
add_filter('um_user_profile_tabs', 'points_tab' );
function points_tab($tabs) {
	//Add tab
	$tabs['points_tab'] = array(
		'name' => 'Punti fedeltà',
		'icon' => 'fa fa-certificate',
		'count' => 0
	);
	return $tabs;
}

add_filter('um_profile_content_points_tab', 'points_tab_content' );
function points_tab_content($args) {
    ob_start();
	?>
	
	<div class="text-center bg-success punti-wrap">
        <div class="punti-txt">Al momento hai</div>
        <?php echo do_shortcode('[mycred_my_balance]')?>
        <div class="punti-txt">Punti Fedeltà</div>
    </div>
    <!--
    <div class="text-center"><h3>Storico Accrediti</h3></div>
    <div><?php //echo do_shortcode('[mycred_history user_id="current"]')?></div>-->
    <?php
		
	$output .= ob_get_contents();
	ob_end_clean();
	echo $output;
}

/*USER ACCOUNT CUSTOM TAB */
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
	$tabs[800]['mytab']['icon'] = 'um-faicon-star';
	$tabs[800]['mytab']['title'] = 'Punti fedeltà';
	$tabs[800]['mytab']['custom'] = true;
	return $tabs;
}

add_action('um_account_tab__mytab', 'um_account_tab__mytab');
function um_account_tab__mytab( $info ) {
	global $ultimatemember;
	extract( $info );

	$output = $ultimatemember->account->get_tab_output('mytab');
	if ( $output ) { echo $output; }
}

add_filter('um_account_content_hook_mytab', 'um_account_content_hook_mytab');
function um_account_content_hook_mytab( $output ){
	ob_start();
	?>
	
	<div class="text-center bg-success punti-wrap">
        <div class="punti-txt">Al momento hai</div>
        <?php echo do_shortcode('[mycred_my_balance]')?>
        <div class="punti-txt">Punti Fedeltà</div>
    </div>
    <!--
    <div class="text-center"><h3>Storico Accrediti</h3></div>
    <div><?php //echo do_shortcode('[mycred_history user_id="current"]')?></div>-->
    <?php
		
	$output .= ob_get_contents();
	ob_end_clean();
	echo $output;
}


//////////////////////////////////////////////////////////////
///////// MYCRED
//////////////////////////////////////////////////////////////
/* ADD CUSTOM REFERENCE */
add_filter( 'mycred_all_references', 'mycredpro_add_custom_references' );
function mycredpro_add_custom_references( $list ) {
    
    $list_add = array('prima_registrazione'=>'Prima Registrazione','acquisto_e_installazione'=>'Acquisto e installazione','manutenzione'=>'Manutenzione','assistenza'=>'Assistenza','consulenza'=>'Consulenza','progettazione'=>'Progettazione','accredito_punti'=>'Accredito Punti');
    foreach($list_add as $key => $value) {
        $list[$key] = $value;
    }
    
	return $list;

}

?>