From 4d5b44f738f9bffe3492861ffa0f9b16b52552ea Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Fri, 13 Dec 2019 14:54:22 +0200 Subject: [PATCH] - metatable function; --- includes/core/class-member-directory.php | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/includes/core/class-member-directory.php b/includes/core/class-member-directory.php index 9affc2b3..16a5077f 100644 --- a/includes/core/class-member-directory.php +++ b/includes/core/class-member-directory.php @@ -95,9 +95,40 @@ if ( ! class_exists( 'um\core\Member_Directory' ) ) { add_filter( 'init', array( &$this, 'init_filter_types' ), 2 ); add_action( 'template_redirect', array( &$this, 'access_members' ), 555 ); + + + //add_action( 'updated_user_meta', array( &$this, 'on_update_usermeta' ), 10, 4 ); } + function on_update_usermeta( $meta_id, $object_id, $meta_key, $_meta_value ) { + + //$object_id //userID + //$meta_key // meta_key + //$_meta_value // value + + $metakeys = get_option( 'um_usermeta_fields', array() ); + + + + + global $wpdb; + + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE {$wpdb->prefix}um_followers ( +user_id int(11) unsigned NOT NULL auto_increment, +time datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +user_id1 int(11) unsigned NOT NULL, +user_id2 int(11) unsigned NOT NULL, +PRIMARY KEY (id) +) $charset_collate;"; + + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); + dbDelta( $sql ); + + } + /** * Getting member directory post ID via hash * Hash is unique attr, which we use visible at frontend