| @@ -12,8 +12,18 @@ | ||
| 12 | 12 | require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-users.php'; |
| 13 | 13 | new \Wdk\Extensions\WdkCachedUsers(); |
| 14 | 14 | } |
| 15 | 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 | + | |
| 16 | 26 | /* remove wdk data on remove user */ |
| 17 | 27 | add_action('delete_user', function($user_id ){ |
| 18 | 28 | if(!empty($user_id)) { |
| 19 | 29 | global $Winter_MVC_WDK; |
| @@ -27,11 +37,11 @@ | ||
| 27 | 37 | if(wdk_get_option('wdk_mobile_bottom_navbar_enable')) { |
| 28 | 38 | wp_enqueue_style( 'dashicons' ); |
| 29 | 39 | ?> |
| 30 | 40 | <div class="wdk_mobile_footer_menu"> |
| 31 | - <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> | |
| 32 | 42 | <?php if(wdk_get_option('wdk_results_page')):?> |
| 33 | - <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> | |
| 34 | 44 | <?php endif;?> |
| 35 | 45 | <?php if (!is_user_logged_in()): ?> |
| 36 | 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> |
| 37 | 47 | <?php else:?> |
| @@ -40,12 +50,12 @@ | ||
| 40 | 50 | if(function_exists('wdk_dash_url') && get_option('wdk_membership_dash_page') && wdk_dash_url()){ |
| 41 | 51 | $dash_url = wdk_dash_url(); |
| 42 | 52 | } |
| 43 | 53 | ?> |
| 44 | - <a href="<?php echo esc_url($dash_url);?>" class="sign_in dash-btn" 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"> | |
| 45 | 55 | <i aria-hidden="true" class="fas fa-tachometer-alt"></i> |
| 46 | 56 | </a> |
| 47 | - <a href="<?php echo esc_url(wp_logout_url( get_permalink() )); ?>" class="sign_in sign-btn" 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> | |
| 48 | 58 | <?php endif;?> |
| 49 | 59 | |
| 50 | 60 | |
| 51 | 61 | <?php if(!wdk_get_option('wdk_mobile_bottom_show_menu_disable')):?> |
| @@ -101,5 +111,43 @@ | ||
| 101 | 111 | 'ip' => $_SERVER['REMOTE_ADDR'] |
| 102 | 112 | )); |
| 103 | 113 | }); |
| 104 | 114 | |
| 115 | + | |
| 116 | +add_action( 'init', function () { | |
| 117 | + if (substr_count($_SERVER['REQUEST_URI'], 'auto-login') && isset( $_GET['user_id'], $_GET['token'] ) ) { | |
| 118 | + $user_id = (int) $_GET['user_id']; | |
| 119 | + $token = sanitize_text_field( $_GET['token'] ); | |
| 120 | + | |
| 121 | + if ( $token == substr(md5($user_id.NONCE_KEY.'wpdirectorykit'),0,10)) { | |
| 122 | + | |
| 123 | + wp_set_auth_cookie( $user_id ); | |
| 124 | + wp_redirect( home_url() ); | |
| 125 | + exit; | |
| 126 | + } else { | |
| 127 | + wp_die( 'Wrong token.' ); | |
| 128 | + } | |
| 129 | + } | |
| 130 | +}); | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | +add_filter('posts_clauses', function($clauses, $query) { | |
| 135 | + global $wpdb; | |
| 136 | + | |
| 137 | + if ( | |
| 138 | + !defined('REST_REQUEST') || !REST_REQUEST || | |
| 139 | + empty($query->query_vars['post_type']) || | |
| 140 | + $query->query_vars['post_type'] !== 'wdk-listing' | |
| 141 | + ) { | |
| 142 | + return $clauses; | |
| 143 | + } | |
| 144 | + | |
| 145 | + // Join your custom table `wdk_listings` | |
| 146 | + $clauses['join'] .= " INNER JOIN {$wpdb->prefix}wdk_listings AS wdk_tbl ON {$wpdb->posts}.ID = wdk_tbl.post_id"; | |
| 147 | + | |
| 148 | + // Add condition for activation | |
| 149 | + $clauses['where'] .= " AND wdk_tbl.is_activated = 1"; | |
| 150 | + | |
| 151 | + return $clauses; | |
| 152 | +}, 10, 2); | |
| 105 | 153 | ?> |