query_vars['uwp_tab']) && !empty($wp_query->query_vars['uwp_tab'])) {
if ($wp_query->query_vars['uwp_tab'] == $tab) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
/**
* Checks the current page is a UsersWP profile subtab page.
*
* @since 1.0.0
* @package userswp
* @param string|bool $subtab Subtab slug.
* @return bool True when success. False when failure.
*/
function is_uwp_profile_subtab($subtab = false) {
global $wp_query;
if (is_uwp_profile_page()) {
if (isset($wp_query->query_vars['uwp_subtab']) && !empty($wp_query->query_vars['uwp_subtab'])) {
if ($wp_query->query_vars['uwp_subtab'] == $subtab) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
/**
* Prints the tab content based on post type.
*
* @since 1.0.0
* @package userswp
*
* @param object $user User object.
* @param bool $post_type Post type.
* @param string $title Tab title
* @param array|bool $post_ids Post ids for post__in. Optional
*
* @return void
*/
function uwp_generic_tab_content($user, $post_type = false, $title, $post_ids = false) {
?>
'publish',
'posts_per_page' => uwp_get_option('profile_no_of_items', 10),
'author' => $user->ID,
'paged' => $paged,
);
if ($post_type) {
$args['post_type'] = $post_type;
}
if (is_array($post_ids)) {
if (!empty($post_ids)) {
$args['post__in'] = $post_ids;
} else {
// no posts found
echo "
".__('No '.$title.' Found', 'userswp')."
";
return;
}
}
// The Query
$the_query = new WP_Query($args);
// The Loop
if ($the_query->have_posts()) {
echo '
';
while ($the_query->have_posts()) {
$the_query->the_post();
?>
-
';
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
echo "".__('No '.$title.' Found', 'userswp')."
";
}
do_action('uwp_profile_pagination', $the_query->max_num_pages);
?>
__( 'Edit Account', 'userswp' ),
'icon' => 'fas fa-user',
);
}
if('notifications' != $type){
$tabs['notifications'] = array(
'title' => __( 'Notifications', 'userswp' ),
'icon' => 'fas fa-bell',
);
}
if('privacy' != $type) {
$tabs['privacy'] = array(
'title' => __('Privacy', 'userswp'),
'icon' => 'fas fa-lock',
);
}
return apply_filters( 'uwp_account_available_tabs', $tabs );
}
/**
* Returns the setting page tab list for each page.
*
* @since 1.0.0
* @package userswp
*
* @return array Tabs list.
*/
function uwp_get_settings_tabs() {
$tabs = array();
// wp-admin/admin.php?page=uwp
$tabs['userswp'] = array(
'main' => __( 'General', 'userswp' ),
'register' => __( 'Register', 'userswp' ),
'login' => __( 'Login', 'userswp' ),
'change' => __( 'Change Password', 'userswp' ),
'profile' => __( 'Profile', 'userswp' ),
'users' => __( 'Users', 'userswp' ),
'import-export' => __( 'Import/Export', 'userswp' ),
'uninstall' => __( 'Uninstall', 'userswp' ),
);
// wp-admin/admin.php?page=uwp_form_builder
$tabs['uwp_form_builder'] = array(
'main' => __( 'Form Builder', 'userswp' ),
);
// wp-admin/admin.php?page=uwp_notifications
$tabs['uwp_notifications'] = array(
'main' => __( 'Users', 'userswp' ),
'admin' => __( 'Admin', 'userswp' )
);
return apply_filters( 'uwp_settings_tabs', $tabs );
}