Untitled
unknown
plain_text
2 years ago
1.8 kB
31
Indexable
add_filter('job_manager_get_dashboard_jobs_args', function($job_dashboard_args){
$user_id = get_current_user_id();
$account_type = get_user_meta($user_id, 'b2bking_account_type', true);
if ($account_type === 'subaccount'){
// get parent
$parent_account_id = get_user_meta($user_id, 'b2bking_account_parent', true);
$job_dashboard_args['author'] = array($user_id, $parent_account_id);
}
return $job_dashboard_args;
}, 10, 1);
add_filter('job_manager_get_user_bookmarks', function($bookmarks, $bookmarksplugin, $postperpage, $orderby, $order){
$user_id = get_current_user_id();
$account_type = get_user_meta($user_id, 'b2bking_account_type', true);
if ($account_type === 'subaccount'){
// get parent
$parent_account_id = get_user_meta($user_id, 'b2bking_account_parent', true);
if ($postperpage >= 0){
$parent_bookmarks = $bookmarksplugin->get_user_bookmarks( $parent_account_id, $postperpage, ( max( 1, get_query_var( 'paged' ) ) - 1 ) * $postperpage, $orderby, $order );
} else {
$parent_bookmarks = $bookmarksplugin->get_user_bookmarks( $parent_account_id, 0, 0, $orderby, $order );
}
$parent_bookmarks->results = array_merge($parent_bookmarks->results, $bookmarks->results);
$bookmarks = $parent_bookmarks;
}
return $bookmarks;
}, 10, 5);
add_filter('job_manager_get_packages', function($packages, $query, $user_id){
$account_type = get_user_meta($user_id, 'b2bking_account_type', true);
if ($account_type === 'subaccount'){
// get parent
$parent_account_id = get_user_meta($user_id, 'b2bking_account_parent', true);
global $wpdb;
$parent_packages = $wpdb->get_results( $wpdb->prepare( $query, $parent_account_id ), OBJECT_K );
$packages = $parent_packages;
}
return $packages;
}, 10, 3);Editor is loading...
Leave a Comment