{"id":2284,"date":"2021-03-28T18:53:29","date_gmt":"2021-03-28T09:53:29","guid":{"rendered":"https:\/\/mem.quarka.org\/manual\/create-a-specialized-qa-heatmap-analytics-browsing-account\/"},"modified":"2022-03-10T11:26:11","modified_gmt":"2022-03-10T02:26:11","slug":"create-a-specialized-qa-heatmap-analytics-browsing-account","status":"publish","type":"ht_kb","link":"https:\/\/mem.quarka.org\/en\/manual\/create-a-specialized-qa-heatmap-analytics-browsing-account\/","title":{"rendered":"Create a specialized QA Heatmap Analytics browsing account."},"content":{"rendered":"\n<p>This article is based on information provided by our ambassador, <a href=\"https:\/\/uzurea.net\/\">uzurea.net<\/a>. Thank you very much.<\/p>\n\n<p>By customizing the permissions feature of WordPress, you can enable a specific account to view only QA Heatmap Analytics. The steps are as follows<\/p>\n\n<ol><li>Add any user. The permission to view the dashboard is fine for subscribers, but to be able to view the heatmap, you need to be an administrator (editor or higher for paid plans) in the current version 1.1.3.<\/li><li>Add the code shown below to your theme&#8217;s functions.php.<\/li><li>Replace &#8216;login_name&#8217; (two places) in the code in step 2 with the login ID of the user you added in step 1.<ol><li>\u4f8b\uff09$user_login === &#8216;myname@test.com&#8217;<\/li><\/ol><\/li><li>In the variable $need_submenus in the code of 2, add or leave the submenu names you need for the users of 1.<ol><li>\u4f8b\uff09$need_submenus = [&#8216;\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9&#8217;];<\/li><\/ol><\/li><li>After logging in as user 1 and going directly to the QA Heatmap Analytics admin URL, make sure you can view the menu that you correctly set up in 4.<\/li><\/ol>\n<p class=\"has-background has-very-light-gray-background-color\">\u203badd_cap\u95a2\u6570\u3092\u7528\u3044\u308b\u305f\u3081\u3001\u4e0a\u8a18\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3068\u8a72\u5f53\u30e6\u30fc\u30b6\u30fc\u306b\u306f\u6c38\u4e45\u7684\u306bQA Heatmap Analytics\u306e\u95b2\u89a7\u6a29\u9650\u304c\u4e0e\u3048\u3089\u308c\u307e\u3059\uff08DB\u306euser_meta\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\uff09\u3002\u4e0d\u8981\u306b\u306a\u3063\u305f\u6a29\u9650\u3092\u524a\u9664\u3059\u308b\u306b\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u3054\u3068\u524a\u9664\u3059\u308b\u304b\u3001remove_cap\u95a2\u6570\u3092\u6d3b\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002Since the <a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_user\/add_cap\/\">add_cap<\/a> function is used, the above setting will permanently give the user the permission to view QA Heatmap Analytics (stored in the user_meta of the DB). To remove the permissions that are no longer needed, delete the entire user or use the <a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_user\/remove_cap\/\">remove_cap<\/a> function.<\/p>\n\n<h2 id=\"code-to-add-to-functions-php\" >Code to add to functions.php<\/h2>\n\n<pre class=\"wp-block-code\"><code>\/\/\u7ba1\u7406\u8005\u753b\u9762\u3078\u306e\u30a2\u30af\u30bb\u30b9\u6a29\u3092\u4ed8\u4e0e\nfunction qa_roleadd_func ( $user_login , $current_user ) {\n    \/\/\u6a29\u9650\u3092\u4e0e\u3048\u305f\u3044\u30e6\u30fc\u30b6\u30fc\u306e\u30ed\u30b0\u30a4\u30f3ID\u3092\u6307\u5b9a\u3057\u307e\u3059\n    if ( $user_login === 'login_name' ) {\n        $current_user->add_cap('manage_options');\n    }\n}\nadd_action( 'wp_login', 'qa_roleadd_func', 10, 2 );\n\n\/\/\u7ba1\u7406\u753b\u9762\u306e\u4e0d\u8981\u306a\u30e1\u30cb\u30e5\u30fc\u3092\u6d88\u3059\nfunction remove_admin_menus() {\n    $currentuser = wp_get_current_user();\n    if ( $currentuser->user_login === 'login_name' ) {\n\n        \/\/QA Heatmap Analytics\u4ee5\u5916\u306e\u30e1\u30cb\u30e5\u30fc\u3092\u6d88\u3057\u307e\u3059\n        \/\/\u4e0b\u8a18\u3067\u6d88\u305b\u306a\u3044\u30e1\u30cb\u30e5\u30fc\u306f\u3001theme\u306b\u5165\u3063\u3066\u3044\u308bfunctions.php\u306a\u3069\u3067\u76f4\u63a5\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\n        global $menu;\n        foreach ( $menu as $idx => $eachmenu ) {\n            if ( $eachmenu&#91;0] !== 'QA Heatmap Analytics' ) {\n                unset( $menu&#91;$idx] );\n            }\n        }\n\n        \/\/QA Heatmap Analytics \u30b5\u30d6\u30e1\u30cb\u30e5\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\n        \/\/\u5fc5\u8981\u306a\u30e1\u30cb\u30e5\u30fc\u540d\u3092\u8a18\u5165\u3057\u3066\u304a\u304d\u307e\u3059\u3002\n        $need_submenus = &#91;'\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9', '\u30b5\u30a4\u30c8\u7d71\u8a08\u60c5\u5831', '\u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u7ba1\u7406'];\n        global $submenu;\n        foreach ( $submenu&#91;'qahm-realtime'] as $idx => $eachsub ) {\n            $is_need = false;\n            foreach ( $need_submenus as $need_submenu ) {\n                if ( $eachsub&#91;0] === $need_submenu ) {\n                    $is_need = true;\n                }\n            }\n            if ( ! $is_need ) {\n                unset( $submenu&#91;'qahm-realtime']&#91;$idx] );\n            }\n        }\n    }\n}\nadd_action('admin_menu', 'remove_admin_menus');<\/code><\/pre>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0},"ht_kb_category":[323],"ht_kb_tag":[],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"QA Analytics Support","author_link":"https:\/\/mem.quarka.org\/en\/author\/qa-analytics-support\/"},"uagb_comment_info":0,"uagb_excerpt":"This article is based on information provided by our ambassador, uzurea.net. Thank you very much. By customizing the permissions feature of WordPress, you can enable a specific account to view only QA Heatmap Analytics. The steps are as follows Add any user. The permission to view the dashboard is fine for subscribers, but to be&hellip;","_links":{"self":[{"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb\/2284"}],"collection":[{"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb"}],"about":[{"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/comments?post=2284"}],"version-history":[{"count":1,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb\/2284\/revisions"}],"predecessor-version":[{"id":2286,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb\/2284\/revisions\/2286"}],"wp:attachment":[{"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/media?parent=2284"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb_category?post=2284"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/mem.quarka.org\/en\/wp-json\/wp\/v2\/ht_kb_tag?post=2284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}