for what i can see is that wen i use
function add_custom_profile_tab3( $downloadtab )
it register the tab
but if i use the code to show only for user doctor
if($role=='doctor'){
function add_custom_profile_tab3( $downloadtab ) {
$downloadtab['download'] = array(
'name' => 'Downloads',
'icon' => 'um-faicon-bookmark',
);
return $downloadtab;
}
}
on the doctor profile i can see the tab and is content
and the error message only shows if im login with user client
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'add_custom_profile_tab3' not found or invalid function name in /home/sites/rmmedics.com/public_html/wp-includes/plugin.php on line 213
and the complete code of this php file is
<?php
/***
*** @Main tabs
***/
add_filter('um_profile_tabs', 'um_profile_tabs', 1 );
function um_profile_tabs( $tabs ) {
$tabs['main'] = array(
'name' => __('About','ultimatemember'),
'icon' => 'um-faicon-user'
);
return $tabs;
}
// Submit Job Tab
add_filter('um_profile_tabs', 'add_custom_profile_tab', 2 );
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if($role=='client'){
function add_custom_profile_tab( $historytab ) {
$historytab['history'] = array(
'name' => 'Submit Job',
'icon' => 'um-faicon-bookmark'
);
return $historytab;
}
}
else{
function add_custom_profile_tab( $historytab ) {
$historytab['history'] = array(
'name' => 'Jobs',
'icon' => 'um-faicon-bookmark'
);
return $historytab;
}
}
add_action('um_profile_content_history_default', 'um_profile_content_history_default');
function um_profile_content_history_default( $args ) {
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if ($role == 'client' ){
echo do_shortcode('[br]');
echo do_shortcode('[submit_job_form]');
}
else {
echo do_shortcode('[br]');
echo do_shortcode('[jobs]');
}
}
// Job Dashboard Tab
add_filter('um_profile_tabs', 'add_custom_profile_tab2', 3 );
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if($role=='client'){
function add_custom_profile_tab2( $bookmarktab ) {
$bookmarktab['lineage'] = array(
'name' => 'Job Dashboard',
'icon' => 'um-faicon-bookmark',
);
return $bookmarktab;
}
}
else{
function add_custom_profile_tab2( $bookmarktab ) {
$bookmarktab['lineage'] = array(
'name' => 'Upload Timesheet',
'icon' => 'um-faicon-bookmark',
);
return $bookmarktab;
}
}
add_action('um_profile_content_lineage_default', 'um_profile_content_lineage_default');
function um_profile_content_lineage_default( $args ) {
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if ($role == 'client' ){
echo do_shortcode('[br]');
echo do_shortcode('[job_dashboard]');
}
else {
echo do_shortcode('[br]');
echo do_shortcode('[wtf_fu_upload deny_public_uploads="1" accept_file_types="jpg|jpeg|png|pdf|JPG|JPEG|PNG|PDF" deny_file_types="htaccess|php|php3|php4|php5|cgi|aspx|asp|aspx|sh|phtml|shtml|pl|py|pyc|pyo" inline_file_types="jpg|jpeg|png|pdf|JPG|JPEG|PNG|PDF" image_file_types="jpg|jpeg|png|pdf|JPG|JPEG|PNG|PDF" max_file_size="5" max_number_of_files="30" auto_orient="1" create_medium_images="0" medium_width="800" medium_height="600" thumbnail_crop="1" thumbnail_width="50" thumbnail_height="50"]');
}
}
// Download Tab
add_filter('um_profile_tabs', 'add_custom_profile_tab3', 4 );
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if($role=='doctor'){
function add_custom_profile_tab3( $downloadtab ) {
$downloadtab['download'] = array(
'name' => 'Downloads',
'icon' => 'um-faicon-bookmark',
);
return $downloadtab;
}
}
else {
function add_custom_profile_tab3( $downloadtab ) {
$downloadtab['download'] = array(
'name' => 'Downloads',
'icon' => 'um-faicon-bookmark',
);
return $downloadtab;
}
}
add_action('um_profile_content_download_default', 'um_profile_content_download_default');
function um_profile_content_download_default( $args ) {
$current_user = wp_get_current_user()->id;
$key = 'role';
$single = true;
//print_r($current_user);
$role = get_user_meta( $current_user, $key,$single );
//print_r($role);
if ($role == 'doctor' ){
echo do_shortcode('[br]');
echo do_shortcode('[job_dashboard]');
}
}
/***
*** @dynamic profile page title
***/
add_filter('wp_title', 'um_dynamic_user_profile_pagetitle', 100000, 2 );
function um_dynamic_user_profile_pagetitle( $title, $sep = '' ) {
global $paged, $page, $ultimatemember;
$profile_title = um_get_option('profile_title');
if ( um_is_core_page('user') && um_get_requested_user() ) {
um_fetch_user( um_get_requested_user() );
$profile_title = $ultimatemember->mail->convert_tags( $profile_title );
$title = $profile_title;
um_reset_user();
}
return $title;
}
/***
*** @try and modify the page title in page
***/
add_filter('the_title', 'um_dynamic_user_profile_title', 100000, 2 );
function um_dynamic_user_profile_title( $title, $id = '' ) {
global $ultimatemember;
if( is_admin() )
return $title;
if ( $id == $ultimatemember->permalinks->core['user'] ) {
if ( um_is_core_page('user') && um_get_requested_user() ) {
$title = um_get_display_name( um_get_requested_user() );
} else if ( um_is_core_page('user') && is_user_logged_in() ) {
$title = um_get_display_name( get_current_user_id() );
}
}
return (strlen($title)!==strlen(utf8_decode($title))) ? $title : utf8_encode($title);
}