質問編集履歴

3

追記

2018/06/08 01:19

投稿

kinakomochi
kinakomochi

スコア24

test CHANGED
File without changes
test CHANGED
@@ -110,4 +110,4 @@
110
110
 
111
111
  else側に該当するアカウントは問題なく動作しています。
112
112
 
113
- 何か原因分かる方いらしゃらでしょうか。
113
+ プラグイン「Adminimize」で権限の設定をしているのです、権限設定によて読み込まれくなるなどあるのでしょうか。

2

追記

2018/06/08 01:19

投稿

kinakomochi
kinakomochi

スコア24

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,43 @@
18
18
 
19
19
  function profile_js() {
20
20
 
21
+ if (current_user_can( 'administrator')) { ?>
22
+
23
+
24
+
25
+ <script type="text/javascript">
26
+
27
+ jQuery(document).ready(function() {
28
+
29
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2').css("display","none");
30
+
31
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table').css("display","none");
32
+
33
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2').text("会員様情報");
34
+
35
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table .user-first-name-wrap > th').text("担当者名");
36
+
37
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table .user-last-name-wrap').css("display","none");
38
+
39
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table .user-nickname-wrap > th').text("企業名");
40
+
41
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table .user-display-name-wrap > th').text("サイト表示名");
42
+
43
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2').css("display","none");
44
+
45
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2').css("display","none");
46
+
47
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table').css("display","none");
48
+
49
+ });
50
+
51
+ </script>
52
+
53
+ <?php
54
+
55
+ }else{
56
+
21
- ?>
57
+ ?>
22
58
 
23
59
  <script type="text/javascript">
24
60
 
@@ -44,6 +80,8 @@
44
80
 
45
81
  jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2').css("display","none");
46
82
 
83
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table').css("display","none");
84
+
47
85
  });
48
86
 
49
87
  </script>
@@ -52,8 +90,24 @@
52
90
 
53
91
  }
54
92
 
93
+ }
94
+
95
+ //アクションフックshow_user_profileにこのスクリプトを組み込む
96
+
55
97
  add_action( 'show_user_profile', 'profile_js' );
56
98
 
57
99
 
58
100
 
59
101
  ```
102
+
103
+
104
+
105
+ 追記
106
+
107
+ ==
108
+
109
+ 上記コードで運用していたのですが、突然「current_user_can( 'administrator')」側のスクリプトが読み込まれなくなってしまいました。
110
+
111
+ else側に該当するアカウントは問題なく動作しています。
112
+
113
+ 何か原因が分かる方いらっしゃらないでしょうか。

1

追加

2018/06/08 01:13

投稿

kinakomochi
kinakomochi

スコア24

test CHANGED
File without changes
test CHANGED
@@ -5,3 +5,55 @@
5
5
  項目名変更はjQueryなどでやるしか方法がないのでしょうか。
6
6
 
7
7
  よろしくお願いします。
8
+
9
+
10
+
11
+ 「:contains」とか使ってみましたが、うんともすんとも言わなかったので妥協案として下記コードにしましたが、とても綺麗とは言えない状態です。
12
+
13
+ 何かいい方法ありますでしょうか。
14
+
15
+
16
+
17
+ ```ここに言語を入力
18
+
19
+ function profile_js() {
20
+
21
+ ?>
22
+
23
+ <script type="text/javascript">
24
+
25
+ jQuery(document).ready(function() {
26
+
27
+ jQuery('.wp-heading-inline').css("display","none");
28
+
29
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2').css("display","none");
30
+
31
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table').css("display","none");
32
+
33
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2').css("display","none");
34
+
35
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table').css("display","none");
36
+
37
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2').css("display","none");
38
+
39
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table').css("display","none");
40
+
41
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2').css("display","none");
42
+
43
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table').css("display","none");
44
+
45
+ jQuery('#your-profile input[type="hidden"] + input[type="hidden"] + p + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2 + .form-table + h2').css("display","none");
46
+
47
+ });
48
+
49
+ </script>
50
+
51
+ <?php
52
+
53
+ }
54
+
55
+ add_action( 'show_user_profile', 'profile_js' );
56
+
57
+
58
+
59
+ ```