アカウントページへの文章追加方法
PHP初心者のものです。現在wordpressのプラグイン、Ultimate memberを用いたアカウント情報管理ページを作成しております。
アカウントページでは添付の画像のように、アドレスの変更やパスワードの変更が可能になっているのですが、現状の入力フォームに加え、注意書きなどを文字列出力等で表示したいのですが、どこにどのように記述するのか見当もつきません・・・・
該当のソースコード
PHP
1 2 /** 3 * Get Tab Output 4 * 5 * @param $id 6 * @param $shortcode_args 7 * 8 * @return mixed|string|null 9 * @throws \Exception 10 */ 11 function get_tab_fields( $id, $shortcode_args ) { 12 $output = null; 13 14 UM()->fields()->set_id = $id; 15 UM()->fields()->set_mode = 'account'; 16 UM()->fields()->editing = true; 17 18 if ( ! empty( $this->tab_output[ $id ]['content'] ) && ! empty( $this->tab_output[ $id ]['hash'] ) && 19 $this->tab_output[ $id ]['hash'] == md5( json_encode( $shortcode_args ) ) ) { 20 return $this->tab_output[ $id ]['content']; 21 } 22 23 switch ( $id ) { 24 25 26 case 'delete': 27 28 $args = ''; 29 if ( $this->current_password_is_required( $id ) ) { 30 $args = 'single_user_password'; 31 } 32 33 /** 34 * UM hook 35 * 36 * @type filter 37 * @title um_account_tab_delete_fields 38 * @description Extend Account Tab Delete 39 * @input_vars 40 * [{"var":"$args","type":"array","desc":"Account Arguments"}, 41 * {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}] 42 * @change_log 43 * ["Since: 2.0"] 44 * @usage add_filter( 'um_account_tab_delete_fields', 'function_name', 10, 2 ); 45 * @example 46 * <?php 47 * add_filter( 'um_account_tab_delete_fields', 'my_account_tab_delete_fields', 10, 2 ); 48 * function my_account_tab_delete_fields( $args, $shortcode_args ) { 49 * // your code here 50 * return $args; 51 * } 52 * ?> 53 */ 54 $args = apply_filters( 'um_account_tab_delete_fields', $args, $shortcode_args ); 55 56 $fields = UM()->builtin()->get_specific_fields( $args ); 57 $fields = $this->filter_fields_by_attrs( $fields, $shortcode_args ); 58 59 $this->init_displayed_fields( $fields, $id ); 60 61 foreach ( $fields as $key => $data ) { 62 $output .= UM()->fields()->edit_field( $key, $data ); 63 } 64 65 if ( ! $output && ! $this->current_password_is_required( $id ) ) { 66 $output = '<div></div>'; 67 } 68 69 break; 70 71 case 'general': 72 73 $args = 'user_login,first_name,last_name,user_email'; 74 75 if ( ! UM()->options()->get( 'account_name' ) ) { 76 $args = 'user_login,user_email'; 77 } 78 79 if ( ! UM()->options()->get( 'account_email' ) && ! um_user( 'can_edit_everyone' ) ) { 80 $args = str_replace(',user_email','', $args ); 81 } 82 83 if ( $this->current_password_is_required( $id ) ) { 84 $args .= ',single_user_password'; 85 } 86 87 /** 88 * UM hook 89 * 90 * @type filter 91 * @title um_account_tab_general_fields 92 * @description Extend Account Tab General 93 * @input_vars 94 * [{"var":"$args","type":"array","desc":"Account Arguments"}, 95 * {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}] 96 * @change_log 97 * ["Since: 2.0"] 98 * @usage add_filter( 'um_account_tab_general_fields', 'function_name', 10, 2 ); 99 * @example 100 * <?php 101 * add_filter( 'um_account_tab_general_fields', 'my_account_tab_general_fields', 10, 2 ); 102 * function my_account_tab_general_fields( $args, $shortcode_args ) { 103 * // your code here 104 * return $args; 105 * } 106 * ?> 107 */ 108 $args = apply_filters( 'um_account_tab_general_fields', $args, $shortcode_args ); 109 110 $fields = UM()->builtin()->get_specific_fields( $args ); 111 $fields = $this->filter_fields_by_attrs( $fields, $shortcode_args ); 112 113 $this->init_displayed_fields( $fields, $id ); 114 115 foreach ( $fields as $key => $data ) { 116 $output .= UM()->fields()->edit_field( $key, $data ); 117 } 118 119 break; 120 121 case 'password': 122 123 $args = 'user_password'; 124 125 /** 126 * UM hook 127 * 128 * @type filter 129 * @title um_account_tab_password_fields 130 * @description Extend Account Tab Password 131 * @input_vars 132 * [{"var":"$args","type":"array","desc":"Account Arguments"}, 133 * {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}] 134 * @change_log 135 * ["Since: 2.0"] 136 * @usage add_filter( 'um_account_tab_password_fields', 'function_name', 10, 2 ); 137 * @example 138 * <?php 139 * add_filter( 'um_account_tab_password_fields', 'my_account_tab_password_fields', 10, 2 ); 140 * function my_account_tab_password_fields( $args, $shortcode_args ) { 141 * // your code here 142 * return $args; 143 * } 144 * ?> 145 */ 146 $args = apply_filters( 'um_account_tab_password_fields', $args, $shortcode_args ); 147 148 $fields = UM()->builtin()->get_specific_fields( $args ); 149 $fields = $this->filter_fields_by_attrs( $fields, $shortcode_args ); 150 151 $this->init_displayed_fields( $fields, $id ); 152 153 foreach ( $fields as $key => $data ) { 154 $output .= UM()->fields()->edit_field( $key, $data ); 155 } 156 157 break; 158 159 default : 160 161 /** 162 * UM hook 163 * 164 * @type filter 165 * @title um_account_content_hook_{$id} 166 * @description Change not default Account tabs content 167 * @input_vars 168 * [{"var":"$output","type":"string","desc":"Account Tab Output"}, 169 * {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}] 170 * @change_log 171 * ["Since: 2.0"] 172 * @usage add_filter( 'um_account_content_hook_{$id}', 'function_name', 10, 2 ); 173 * @example 174 * <?php 175 * add_filter( 'um_account_content_hook_{$id}', 'my_account_content', 10, 2 ); 176 * function my_account_tab_password_fields( $args, $shortcode_args ) { 177 * // your code here 178 * return $args; 179 * } 180 * ?> 181 */ 182 $output = apply_filters( "um_account_content_hook_{$id}", $output, $shortcode_args ); 183 break; 184 185 } 186 187 $this->tab_output[ $id ] = array( 'content' => $output, 'hash' => md5( json_encode( $shortcode_args ) ) ); 188 return $output; 189 } 190 191
あなたの回答
tips
プレビュー