| @@ -6,20 +6,45 @@ | ||
| 6 | 6 | |
| 7 | 7 | require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-dependfields.php'; |
| 8 | 8 | new \Wdk\Extensions\WdkDependfields(); |
| 9 | 9 | |
| 10 | -//home, results page, dash/login, menu for hamburger | |
| 10 | + | |
| 11 | +if(file_exists(WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-users.php')) { | |
| 12 | + require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-users.php'; | |
| 13 | + new \Wdk\Extensions\WdkCachedUsers(); | |
| 14 | +} | |
| 15 | + | |
| 16 | +if(file_exists(WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-user-editor.php')) { | |
| 17 | + require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-user-editor.php'; | |
| 18 | + new \Wdk\Extensions\WdkCachedUserEditor(); | |
| 19 | +} | |
| 20 | + | |
| 21 | +if(file_exists(WPDIRECTORYKIT_PATH . 'extensions/wdk-autosuggestion-fields.php')) { | |
| 22 | + require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-autosuggestion-fields.php'; | |
| 23 | + new \Wdk\Extensions\WdkAutosuggestionFields(); | |
| 24 | +} | |
| 25 | + | |
| 26 | +/* remove wdk data on remove user */ | |
| 27 | +add_action('delete_user', function($user_id ){ | |
| 28 | + if(!empty($user_id)) { | |
| 29 | + global $Winter_MVC_WDK; | |
| 30 | + $Winter_MVC_WDK->model('user_m'); | |
| 31 | + $Winter_MVC_WDK->user_m->remove_user_data(intval($user_id)); | |
| 32 | + } | |
| 33 | +}); | |
| 34 | + | |
| 35 | +/* home, results page, dash/login, menu for hamburger */ | |
| 11 | 36 | add_action('wp_footer', function(){ |
| 12 | 37 | if(wdk_get_option('wdk_mobile_bottom_navbar_enable')) { |
| 13 | 38 | wp_enqueue_style( 'dashicons' ); |
| 14 | 39 | ?> |
| 15 | 40 | <div class="wdk_mobile_footer_menu"> |
| 16 | - <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr__('Home','nexproperty' ); ?>"><span class="dashicons dashicons-admin-home"></span></a> | |
| 41 | + <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr__('Home','wpdirectorykit' ); ?>"><span class="dashicons dashicons-admin-home"></span></a> | |
| 17 | 42 | <?php if(wdk_get_option('wdk_results_page')):?> |
| 18 | - <a href="<?php echo esc_url(get_permalink(wdk_get_option('wdk_results_page'))); ?>" title="<?php echo esc_attr__('Search','nexproperty' ); ?>"><span class="dashicons dashicons-search"></span></a> | |
| 43 | + <a href="<?php echo esc_url(get_permalink(wdk_get_option('wdk_results_page'))); ?>" title="<?php echo esc_attr__('Search','wpdirectorykit' ); ?>"><span class="dashicons dashicons-search"></span></a> | |
| 19 | 44 | <?php endif;?> |
| 20 | 45 | <?php if (!is_user_logged_in()): ?> |
| 21 | - <a href="<?php echo (get_option('wdk_membership_login_page')) ? esc_url(get_permalink(wdk_get_option('wdk_membership_login_page'))) : esc_url(wp_login_url());?>" class="sign_in"><i class="fas fa-user" aria-hidden="true"></i></a> | |
| 46 | + <a href="<?php echo (get_option('wdk_membership_login_page')) ? esc_url(get_permalink(wdk_get_option('wdk_membership_login_page'))) : esc_url(wp_login_url());?>" class="sign_in sign-btn"><i class="fas fa-user" aria-hidden="true"></i></a> | |
| 22 | 47 | <?php else:?> |
| 23 | 48 | <?php |
| 24 | 49 | $dash_url = get_admin_url() . "admin.php?page=wdk"; |
| 25 | 50 | if(function_exists('wdk_dash_url') && get_option('wdk_membership_dash_page') && wdk_dash_url()){ |
| @@ -25,14 +50,16 @@ | ||
| 25 | 50 | if(function_exists('wdk_dash_url') && get_option('wdk_membership_dash_page') && wdk_dash_url()){ |
| 26 | 51 | $dash_url = wdk_dash_url(); |
| 27 | 52 | } |
| 28 | 53 | ?> |
| 29 | - <a href="<?php echo esc_url($dash_url);?>" class="sign_in" title="<?php echo esc_attr__('Dash','nexproperty' ); ?>" class="wdk-element-button logout"> | |
| 54 | + <a href="<?php echo esc_url($dash_url);?>" class="sign_in dash-btn" title="<?php echo esc_attr__('Dash','wpdirectorykit' ); ?>" class="wdk-element-button logout"> | |
| 30 | 55 | <i aria-hidden="true" class="fas fa-tachometer-alt"></i> |
| 31 | 56 | </a> |
| 32 | - <a href="<?php echo esc_url(wp_logout_url( get_permalink() )); ?>" class="sign_in" title="<?php echo esc_attr__('Log Out','nexproperty' ); ?>"><i class="fas fa-user-times" aria-hidden="true"></i></a> | |
| 57 | + <a href="<?php echo esc_url(wp_logout_url( get_permalink() )); ?>" class="sign_in sign-btn" title="<?php echo esc_attr__('Log Out','wpdirectorykit' ); ?>"><i class="fas fa-user-times" aria-hidden="true"></i></a> | |
| 33 | 58 | <?php endif;?> |
| 34 | 59 | |
| 60 | + | |
| 61 | + <?php if(!wdk_get_option('wdk_mobile_bottom_show_menu_disable')):?> | |
| 35 | 62 | <div class="wdk-footer-menu"> |
| 36 | 63 | <?php |
| 37 | 64 | $menus = wp_get_nav_menus(); |
| 38 | 65 | |
| @@ -59,10 +86,50 @@ | ||
| 59 | 86 | 'fallback_cb' => '__return_empty_string', |
| 60 | 87 | ));?> |
| 61 | 88 | </div> |
| 62 | 89 | </div> |
| 90 | + <?php endif;?> | |
| 63 | 91 | </div> |
| 64 | 92 | <?php |
| 65 | 93 | } |
| 66 | 94 | }); |
| 67 | 95 | |
| 96 | +add_filter( 'intermediate_image_sizes_advanced', function( $sizes ){ | |
| 97 | + if(get_option('wdk_install_images_sizes_disable') == 1) { | |
| 98 | + return array(); | |
| 99 | + } | |
| 100 | + return $sizes; | |
| 101 | +} ); | |
| 102 | + | |
| 103 | +/* update edit log */ | |
| 104 | +add_action('wdk-membership/listing/saved', function($post_id = NULL, $old_listing_date = NULL){ | |
| 105 | + global $Winter_MVC_WDK; | |
| 106 | + $Winter_MVC_WDK->model('editlog_m'); | |
| 107 | + $Winter_MVC_WDK->editlog_m->insert(array( | |
| 108 | + 'user_id' => get_current_user_id(), | |
| 109 | + 'post_id' => $post_id, | |
| 110 | + 'date' => gmdate('Y-m-d H:i:s'), | |
| 111 | + 'ip' => $_SERVER['REMOTE_ADDR'] | |
| 112 | + )); | |
| 113 | +}); | |
| 114 | + | |
| 115 | + | |
| 116 | +add_filter('posts_clauses', function($clauses, $query) { | |
| 117 | + global $wpdb; | |
| 118 | + | |
| 119 | + if ( | |
| 120 | + !defined('REST_REQUEST') || !REST_REQUEST || | |
| 121 | + empty($query->query_vars['post_type']) || | |
| 122 | + $query->query_vars['post_type'] !== 'wdk-listing' | |
| 123 | + ) { | |
| 124 | + return $clauses; | |
| 125 | + } | |
| 126 | + | |
| 127 | + // Join your custom table `wdk_listings` | |
| 128 | + $clauses['join'] .= " INNER JOIN {$wpdb->prefix}wdk_listings AS wdk_tbl ON {$wpdb->posts}.ID = wdk_tbl.post_id"; | |
| 129 | + | |
| 130 | + // Add condition for activation | |
| 131 | + $clauses['where'] .= " AND wdk_tbl.is_activated = 1"; | |
| 132 | + | |
| 133 | + return $clauses; | |
| 134 | +}, 10, 2); | |
| 68 | 135 | ?> |