<?php /** * Template: BLOG LISTING AUTHOR * version 1.0 * @author: ThaiNT **/ et_get_mobile_header(); global $wp_query, $wp_rewrite, $current_user; $user = get_user_by('id', get_query_var('author')); $user = QA_Member::convert($user); ?> <!-- CONTAINER --> <div class="wrapper-mobile"> <!-- TOP BAR --> <section class="profile-user-wrapper"> <div class="container"> <div class="row"> <div class="col-md-3 col-xs-3 padding-right-0"> <a href="javascript:void(0);" class="profile-avatar"> <?php echo et_get_avatar($user->ID, 65); ?> </a> </div> <div class="col-md-9 col-xs-9"> <div class="profile-wrapper"> <span class="user-name-profile"><?php echo esc_attr($user->display_name); ?> </span>
public function init_theme() { global $wp_rewrite; // post type QA_Questions::init(); QA_Answers::init(); QA_Member::init(); if (ae_get_option('twitter_login', false)) { new ET_TwitterAuth(); } if (ae_get_option('facebook_login', false)) { new ET_FaceAuth(); } if (ae_get_option('gplus_login', false)) { new ET_GoogleAuth(); } /** * new class QA_PackAction to control all action do with user badge */ $qa_pack = new QA_PackAction(); // register footer menu register_nav_menus(array('et_header' => __('Menu display on Header', ET_DOMAIN), 'et_left' => __('Menu display on Left Sidebar', ET_DOMAIN))); //sidebars register_sidebar(array('name' => __('Left Sidebar', ET_DOMAIN), 'id' => 'qa-left-sidebar', 'description' => __("Display widgets in left sidebar", ET_DOMAIN))); register_sidebar(array('name' => __('Right Sidebar', ET_DOMAIN), 'id' => 'qa-right-sidebar', 'description' => __("Display widgets in right sidebar", ET_DOMAIN))); //header sidebars register_sidebar(array('name' => __('Header Sidebar', ET_DOMAIN), 'id' => 'qa-header-sidebar', 'description' => __("Display widgets in header sidebar", ET_DOMAIN))); //blog sidebars register_sidebar(array('name' => __('Blog\'s Left Sidebar', ET_DOMAIN), 'id' => 'qa-blog-left-sidebar', 'description' => __("Display widgets in blog's left sidebar", ET_DOMAIN))); register_sidebar(array('name' => __('Blog\'s Right Sidebar', ET_DOMAIN), 'id' => 'qa-blog-right-sidebar', 'description' => __("Display widgets in blog's right sidebar", ET_DOMAIN))); add_theme_support('automatic-feed-links'); $author_slug = apply_filters('qa_member_slug', 'member'); // change slug name $wp_rewrite->author_base = $author_slug; /** * create post type report */ $args = array('labels' => array('name' => __('Reports', ET_DOMAIN), 'singular_name' => __('Report', ET_DOMAIN), 'add_new' => __('Add New', ET_DOMAIN), 'add_new_item' => __('Add New Report', ET_DOMAIN), 'edit_item' => __('Edit Report', ET_DOMAIN), 'new_item' => __('New Report', ET_DOMAIN), 'all_items' => __('All Reports', ET_DOMAIN), 'view_item' => __('View Report', ET_DOMAIN), 'search_items' => __('Search Reports', ET_DOMAIN), 'not_found' => __('No Reports found', ET_DOMAIN), 'not_found_in_trash' => __('No Reports found in Trash', ET_DOMAIN), 'parent_item_colon' => '', 'menu_name' => __('Reports', ET_DOMAIN)), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => 'report'), 'capability_type' => 'post', 'has_archive' => 'reports', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'editor', 'author'), 'taxonomies' => array('report-taxonomy')); register_post_type('report', $args); $tax_labels = array('name' => _x('Reports taxonomy', ET_DOMAIN), 'singular_name' => _x('Report taxonomys', ET_DOMAIN), 'search_items' => __('Search Reports', ET_DOMAIN), 'popular_items' => __('Popular Reports', ET_DOMAIN), 'all_items' => __('All Reports', ET_DOMAIN), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __('Edit Report', ET_DOMAIN), 'update_item' => __('Update Report', ET_DOMAIN), 'add_new_item' => __('Add New Report', ET_DOMAIN), 'new_item_name' => __('New Report Name', ET_DOMAIN), 'separate_items_with_commas' => __('Separate Reports with commas', ET_DOMAIN), 'add_or_remove_items' => __('Add or remove Reports', ET_DOMAIN), 'choose_from_most_used' => __('Choose from the most used Reports', ET_DOMAIN), 'not_found' => __('No Reports found.', ET_DOMAIN), 'menu_name' => __('Reports taxonomy', ET_DOMAIN)); $tax_args = array('hierarchical' => true, 'labels' => $tax_labels, 'show_ui' => true, 'show_admin_column' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array('slug' => 'Report-taxonomy')); register_taxonomy('report-taxonomy', 'report', $tax_args); }
public function auth_google() { try { // turn on session if (!isset($_SESSION)) { ob_start(); @session_start(); } $data = $_POST['content']; // find usser $user = false; $return = array('redirect_url' => home_url()); $gplus_client_id = ae_get_option('gplus_client_id'); $gplus_secret_id = ae_get_option('gplus_secret_id'); // if user is already authenticated before if (isset($_POST['gplus_token']) && isset($_POST['gplus_code'])) { $userinfor = wp_remote_get('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $_POST['gplus_token']); $userinfor = json_decode($userinfor['body']); if ($userinfor->id !== $data['id']) { $resp = array('success' => false, 'msg' => __('Please login by using your Google plus account again!', ET_DOMAIN)); } } else { $resp = array('success' => false, 'msg' => __('Please login by using your Google plus account again!', ET_DOMAIN)); } // if user is already authenticated before if (isset($data['id']) && ($user = $this->get_user($data['id']))) { // $result = $this->logged_user_in($data['id']); $userdata = QA_Member::convert($user); $nonce = array('reply_thread' => wp_create_nonce('insert_reply'), 'upload_img' => wp_create_nonce('et_upload_images')); $return = array('user' => $userdata, 'nonce' => $nonce); } else { // avatar $ava_response = isset($data['picture']) ? $data['picture'] : ''; $sizes = get_intermediate_image_sizes(); $avatars = array(); if ($ava_response) { foreach ($sizes as $size) { $avatars[$size] = array($ava_response); } } else { $avatars = false; } // username //$username = $data['displayName']; $username = $data['name']; $params = array('user_login' => $username, 'user_email' => isset($data['email']) ? $data['email'] : false, 'et_avatar' => $avatars); //remove avatar if cant fetch avatar foreach ($params as $key => $param) { if ($param == false) { unset($params[$key]); } } $_SESSION['et_auth'] = serialize($params); $_SESSION['et_social_id'] = $data['id']; $_SESSION['et_auth_type'] = 'google'; $return['params'] = $params; $return['redirect_url'] = $this->auth_url; // et_get_page_link('social-connect'); } $resp = array('success' => true, 'msg' => __('You have logged in successfully', ET_DOMAIN), 'redirect' => home_url(), 'data' => $return); } catch (Exception $e) { $resp = array('success' => false, 'msg' => $e->getMessage()); } wp_send_json($resp); }
?> href="javascript:void(0)" data-name="vote_down" class="<?php echo $vote_down_class; ?> "> <i class="fa fa-chevron-down"></i> </a> </li> <!--// vote down --> <?php if (is_singular('question')) { if ($post->post_type == 'answer') { $active = $qa_question->et_best_answer == $qa_answer->ID ? 'active' : ''; // Get user point $user = QA_Member::convert($current_user); $user_point = $user->qa_point; // Get badges $levels = qa_get_privileges(); $approve_answer = $levels->approve_answer; //if( $user_point > $approve_answer || $current_user->ID == $qa_question->post_author || $active != '' ){ $answer_authorname = get_the_author_meta('display_name', $qa_answer->post_author); $data_name = 'data-name="' . ($qa_question->et_best_answer == $qa_answer->ID ? 'un-accept-answer' : 'accept-answer') . '"'; ?> <li title="<?php _e('Mark as best answer', ET_DOMAIN); //printf(__("Agree with %s", ET_DOMAIN), $answer_authorname ); ?> " > <a href="javascript:void(0)" <?php
/** * handle ajax unban user * @return mixed */ public function unban_user() { try { if (!current_user_can('manage_options')) { throw new Exception(__("You don't have permission", ET_DOMAIN)); } //wp_parse_str( $_POST['content'], $data ); $data = $_POST['content']; $user = QA_Member::get_instance(); $result = $user->unban($data['ID']); $user_data = et_make_member_data(get_user_by('id', $data['ID'])); //delete private data unset($user_data['user_email']); unset($user_data['user_pass']); $resp = array('success' => true, 'msg' => __('User has been unbanned', ET_DOMAIN), 'data' => array('user' => $user_data)); } catch (Exception $e) { $resp = array('success' => false, 'msg' => $e->getMessage()); } return $resp; }
/** * AJAX search questions by keyword (next version) * */ public function search_questions() { try { $query = QA_Questions::search($_POST['content']); $data = array(); foreach ($query->posts as $post) { $question = QA_Questions::convert($post); $question->et_avatar = QA_Member::get_avatar_urls($post->post_author, 30); $question->permalink = get_permalink($post->ID); $data[] = $question; } $resp = array('success' => true, 'msg' => '', 'data' => array('questions' => $data, 'total' => $query->found_posts, 'count' => $query->post_count, 'pages' => $query->max_num_pages, 'search_link' => qa_search_link($_POST['content']['s']), 'search_term' => $_POST['content']['s'], 'test' => $query)); } catch (Exception $e) { $resp = array('success' => false, 'msg' => $e->getMessage()); } wp_send_json($resp); }
public function confirm() { try { if (!current_user_can('manage_options')) { throw new Exception(__("You don't have permission", ET_DOMAIN)); } $data = $_POST['content']; if (!$data['ID']) { throw new Exception(__("Required user ID.", ET_DOMAIN)); } QA_Member::update(array('ID' => $data['ID'], 'register_status' => '')); $resp = array('success' => true, 'msg' => __('User has been confirmed', ET_DOMAIN)); } catch (Exception $e) { $resp = array('success' => false, 'msg' => $e->getMessage()); } return $resp; }