コード例 #1
0
ファイル: theme.php プロジェクト: rinodung/wp-question
 function ae_convert_user($user)
 {
     $user_instance = QA_Member::get_instance();
     $user->register_status = get_user_meta($user->ID, 'register_status', true) == "unconfirm" ? "unconfirm" : '';
     //$user->banned            = $user_instance->is_ban($user->ID) ? true : false;
     $user->qa_point = get_user_meta($user->ID, 'qa_point', true) ? get_user_meta($user->ID, 'qa_point', true) : 0;
     $user->et_question_count = et_count_user_posts($user->ID, 'question');
     $user->et_answer_count = et_count_user_posts($user->ID, 'answer');
     return $user;
 }
コード例 #2
0
ファイル: members.php プロジェクト: herosrx/qaengine
 /**
  * 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;
 }
コード例 #3
0
ファイル: front.php プロジェクト: rinodung/wp-question
 public function frontend_init($wp_rewrite)
 {
     global $wp_rewrite, $current_user;
     // modify the "search questions" link
     $search_slug = apply_filters('search_question_slug', 'search-questions');
     add_rewrite_rule($search_slug . '/([^/]+)/?$', 'index.php?pagename=search&keyword=$matches[1]', 'top');
     add_rewrite_rule($search_slug . '/([^/]+)/page/([0-9]{1,})/?$', 'index.php?pagename=search&keyword=$matches[1]&paged=$matches[2]', 'top');
     $author_slug = ae_get_option('members_slug', 'member');
     //apply_filters( 'qa_member_slug', 'member' ); // change slug name
     $wp_rewrite->author_base = $author_slug;
     $rules = get_option('rewrite_rules');
     if (!isset($rules[$search_slug . '/([^/]+)/?$'])) {
         $wp_rewrite->flush_rules();
     }
     // check ban user
     $user_factory = QA_Member::get_instance();
     if ($current_user->ID && $user_factory->is_ban($current_user->ID)) {
         wp_logout();
         wp_clear_auth_cookie();
     }
 }