{"id":321,"date":"2021-09-04T15:01:26","date_gmt":"2021-09-04T06:01:26","guid":{"rendered":"https:\/\/tako.nakano.net\/blog\/?p=321"},"modified":"2021-09-04T15:03:14","modified_gmt":"2021-09-04T06:03:14","slug":"ultimate-member-url-support-is-worse","status":"publish","type":"post","link":"https:\/\/tako.nakano.net\/blog\/2021\/09\/ultimate-member-url-support-is-worse\/","title":{"rendered":"Ultimate Member \u306e URL \u5236\u5fa1\u304c\u30b4\u30df"},"content":{"rendered":"<p>\u526f\u696d\u306e\u90fd\u5408\u3067 Ultimate Member \u3068\u3044\u3046 WordPress \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\uff0e<br \/>\n\u30b5\u30a4\u30c8\u5168\u4f53\u3092\u30e1\u30f3\u30d0\u30fc\u4ee5\u5916\u304b\u3089\u79d8\u533f\u3057\uff0c\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u8005\u3067\u306a\u3044\u3068\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u304f\u3059\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u304c\u53ef\u80fd\u3067\u3042\u308b\uff0e<\/p>\n<p>\u79d8\u533f\u3057\u305f\u969b\u306b\uff0c\u300c\u7279\u5b9a\u306e URL \u3092\u8a31\u53ef\u3059\u308b\u300d\u8a2d\u5b9a\u304c\u53ef\u80fd\u306a\u306e\u3067\u3042\u308b\u304c\uff0c\u5b8c\u5168\u4e00\u81f4\u578b\u3057\u304b\u3067\u304d\u306a\u3044\uff08\u5185\u90e8\u3067 <code>in_array<\/code> \u3092\u7528\u3044\u3066\u3044\u308b\uff09\uff0e<\/p>\n<h2>\u7d50\u8ad6:<\/h2>\n<p>Reflection \u307e\u3067\u6301\u3061\u51fa\u3057\u3066\uff0cUgly \u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3059\u308b\u3068\u826f\u3044\uff0e<code>&#039;forums&#039;<\/code> \u3078\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u3059\u4f8b\u304c\u4ee5\u4e0b\u3067\u3042\u308b\uff0e\u3053\u306e\u30b3\u30fc\u30c9\u306f MIT\/X \u30e9\u30a4\u30bb\u30f3\u30b9\u3084\uff0cPublic Domain \u3067\u3042\u308b\u3082\u306e\u3068\u3057\u3066\u7528\u3044\u3066\u3088\u3044\uff0e<\/p>\n<pre><code class=\"language-php\">add_action(\n    &#039;um_access_check_global_settings&#039;,\n    function() {\n        if ( function_exists( &#039;UM&#039; ) ) {\n            $current_url = UM()-&gt;permalinks()-&gt;get_current_url( get_option( &#039;permalink_structure&#039; ) );\n            $forum_url = home_url( &#039;\/forums\/&#039; );\n            $partial_url = substr( $current_url, 0, strlen( $forum_url ) );\n\n            if( $partial_url == $forum_url ) {\n                $um_access = UM()-&gt;classes[&#039;access&#039;];\n                \/\/ $um_access-&gt;allow_access = true;  \/\/ private \u306a\u306e\u3067\u4e0d\u53ef\u80fd\n                $refrection = new ReflectionClass( get_class( $um_access ) );\n                $allow_access = $refrection-&gt;getProperty( &#039;allow_access&#039; );\n                $allow_access-&gt;setAccessible( true );\n                $allow_access-&gt;setValue( $um_access, true );\n            }\n        }\n    }\n);<\/code><\/pre>\n<h2>\u8a73\u7d30<\/h2>\n<p><a href=\"https:\/\/wordpress.org\/support\/topic\/exclude-the-following-urls-for-access\/\">\u201cExclude the following URLs\u201d for Access<\/a><br \/>\n\u3067\u306f<\/p>\n<blockquote>\n<p>\u201cExclude the following URLs\u201d for Access<br \/>\nIs it possible to use Regex with this option under Access -&gt; Restriction Content?<br \/>\nAlso what does \u201cRestricted Access to posts\u201d and \u201cRestricted Access to Taxonomies\u201d Mean? Does this mean \u201cEnable Restrict Content Access\u201d?<\/p>\n<\/blockquote>\n<p>\u3068\u3044\u3063\u305f\u8b70\u8ad6\u304c\u3055\u308c\u3066\u3044\u308b\uff0e\u3057\u304b\u3057\uff0c\u672a\u5b9f\u88c5\u3067\u3042\u308b\uff0e<\/p>\n<p><code>ultimate-member\/includes\/core\/class-access.php<\/code> \u30d5\u30a1\u30a4\u30eb\u3067\u306f\uff0c<\/p>\n<pre><code class=\"language-php\">function template_redirect() {\n    \/\/ ...\n    do_action( &#039;um_access_check_global_settings&#039; );\n    $this-&gt;check_access();\n}<\/code><\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u3066\uff0c\u3053\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306f\uff0c<\/p>\n<pre><code class=\"language-php\">add_action( &#039;um_access_check_global_settings&#039;, array( &amp;$this, &#039;um_access_check_global_settings&#039; ) );<\/code><\/pre>\n<p>\u3068\u3044\u3046\u5f62\u3067\uff0c\u3044\u304b\u306b\u3082\u767b\u9332\u3067\u304d\u308b\u3088\u3046\u306a\u611f\u3058\u3092\u91b8\u3057\u51fa\u3057\u3066\u3044\u308b\uff0e\u305d\u3057\u3066\uff0c<\/p>\n<pre><code class=\"language-php\">function check_access() {\n    if ( $this-&gt;allow_access == true )\n        return true;\n    \/\/ ...\n}<\/code><\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u308b\u304b\u3089\uff0c<code>$this-&gt;allow_access<\/code> \u3092\u66f8\u304d\u63db\u3048\u308c\u3070\u826f\u3055\u305d\u3046\u3060\uff0e\u3057\u304b\u3057\uff0c\u809d\u5fc3\u306e\u3053\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u304c <code>private<\/code> \u306a\u306e\u3067\u3042\u308b\uff0e\u66f8\u304d\u63db\u3048\u3089\u308c\u306a\u3044\uff0e\uff08\u305d\u3082\u305d\u3082\uff0c<code>$this<\/code> \u306b\u76f8\u5f53\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092 action \u306e\u95a2\u6570\u306b\u6e21\u305b\u3068\u601d\u3046\u306e\u3060\u304c\u2026\uff09<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\uff0c <code>private<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5f37\u5f15\u306b\u66f8\u304d\u63db\u3048\u308b\u919c\u60aa\u306a\u65b9\u6cd5\u3092\u884c\u3046\u3057\u304b\u306a\u3044\uff0e\u8a73\u7d30\u306f\u5148\u306b\u8ff0\u3079\u305f\u901a\u308a\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u526f\u696d\u306e\u90fd\u5408\u3067 Ultimate Member \u3068\u3044\u3046 WordPress \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\uff0e \u30b5\u30a4\u30c8\u5168\u4f53\u3092\u30e1\u30f3\u30d0\u30fc\u4ee5\u5916\u304b\u3089\u79d8\u533f\u3057\uff0c\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u8005\u3067\u306a\u3044\u3068\u30a2\u30af\u30bb\u30b9\u3067\u304d\u306a\u304f\u3059\u308b\u3068\u3044\u3063\u305f\u3053\u3068\u304c\u53ef\u80fd\u3067\u3042\u308b\uff0e \u79d8\u533f\u3057\u305f\u969b\u306b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[8],"tags":[],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4dIdP-5b","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/comments?post=321"}],"version-history":[{"count":2,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/posts\/321\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/media?parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/categories?post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tako.nakano.net\/blog\/wp-json\/wp\/v2\/tags?post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}