function render_profile() { if (is_author()) { $this->user_id = get_current_user_id(); $this->member_id = $this->get_MID(); $this->load_profile_background(); $headline_position = get_user_meta($this->member_id, 'pr_member_headline_position', true); $headline_color = get_user_meta($this->member_id, 'pr_member_headline_color', true); $month = get_user_meta($this->member_id, 'birth_month', true); $day = get_user_meta($this->member_id, 'birth_day', true); $year = get_user_meta($this->member_id, 'birth_year', true); $this->age = PR_Membership::compute_age($month, $day, $year); if (!isset($headline_position) && empty($headline_position)) { $this->headline_position = self::DEFAULT_HEADLINE_POSITION; } else { $this->headline_position = $headline_position; } if (!isset($headline_color) && empty($headline_color)) { $this->headline_color = self::DEFAULT_HEADLINE_COLOR; } else { $this->headline_color = $headline_color; } if (isset($_POST['activity'])) { $result = $this->add_activity($_POST['activity']); } require_once dirname(__DIR__) . '/views/profile.php'; } }
function render_privacy_page() { require_once WPPR_PLUGIN_DIR . '/models/members-model.php'; $model = new Members_Model(); $attributes = array('errors' => array(), 'success' => false); if (is_user_logged_in()) { // get current user id $this->user_id = get_current_user_id(); if (isset($_POST['submit']) && $_POST['submit'] == 'save') { if (isset($_POST['privacy'])) { $this->update_privacy($_POST['privacy']); } } // get current user's metada $meta = get_user_meta($this->user_id); $userdata = get_userdata($this->user_id); $this->user_url = $userdata->user_url; $this->display_name = $userdata->display_name; $this->ref_sports = $model->get_other_sports(); //get only meta keys with value $meta = array_filter(array_map(function ($a) { return $a[0]; }, $meta)); $member_meta = $model->get_member_meta(); foreach ($member_meta as $key) { if (isset($meta[$key])) { $this->{$key} = $meta[$key]; if ($key == 'interests') { $this->interests = unserialize($this->interests); } if ($key == 'gender') { $this->gender == 1 ? $this->gender = 'Male' : ($this->gender = 'Female'); } if ($key == 'birth_month') { $this->birth_month = date('F', mktime(0, 0, 0, $this->birth_month, $this->birth_day)); } $this->age = PR_Membership::compute_age($this->birth_month, $this->birth_day, $this->birth_year); } } /* Privacy Check */ $meta_keys = $model->get_privacy_meta(); foreach ($meta_keys as $key) { if (isset($meta[$key])) { $this->{$key} = $meta[$key]; } } } require_once dirname(__DIR__) . '/views/privacy.php'; }