PluginProbe
Virtue/Ascend/Pinnacle Toolkit / 4.9.12.2
Virtue/Ascend/Pinnacle Toolkit v4.9.12.2
4.9.12.2 trunk 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.7 All 48 releases
virtue-toolkit / author_box.php

author_box.php in Virtue/Ascend/Pinnacle Toolkit 4.9.12.2, at author_box.php

154 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Author Profile Feilds
3 add_action( 'show_user_profile', 'virtue_toolkit_show_extra_profile_fields' );
4 add_action( 'edit_user_profile', 'virtue_toolkit_show_extra_profile_fields' );
5 function virtue_toolkit_show_extra_profile_fields( $user ) {
6 if(current_user_can( 'edit_posts') ) { ?>
7 <h3><?php echo __('Extra profile information for author box', 'virtue-toolkit');?></h3>
8
9 <table class="form-table">
10 <tr>
11 <th>
12 <label for="occupation">
13 <?php _e('Occupation', 'virtue-toolkit');?>
14 </label>
15 </th>
16 <td>
17 <input type="text" name="occupation" id="occupation" value="<?php echo esc_attr( get_the_author_meta( 'occupation', $user->ID ) ); ?>" class="regular-text" /><br />
18 <span class="description"><?php _e('Please enter your Occupation.', 'virtue-toolkit');?></span>
19 </td>
20 </tr>
21 <tr>
22 <th>
23 <label for="twitter">Twitter</label>
24 </th>
25 <td>
26 <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>" class="regular-text" /><br />
27 <span class="description"><?php _e('Please enter your Twitter username.', 'virtue-toolkit'); ?></span>
28 </td>
29 </tr>
30 <tr>
31 <th>
32 <label for="facebook">Facebook</label></th>
33 <td>
34 <input type="text" name="facebook" id="facebook" value="<?php echo esc_attr( get_the_author_meta( 'facebook', $user->ID ) ); ?>" class="regular-text" /><br />
35 <span class="description"><?php _e('Please enter your Facebook url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
36 </td>
37 </tr>
38 <tr>
39 <th>
40 <label for="google">Google Plus</label>
41 </th>
42 <td>
43 <input type="text" name="google" id="google" value="<?php echo esc_attr( get_the_author_meta( 'google', $user->ID ) ); ?>" class="regular-text" /><br />
44 <span class="description"><?php _e('Please enter your Google Plus url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
45 </td>
46 </tr>
47 <tr>
48 <th>
49 <label for="youtube">YouTube</label>
50 </th>
51 <td>
52 <input type="text" name="youtube" id="youtube" value="<?php echo esc_attr( get_the_author_meta( 'youtube', $user->ID ) ); ?>" class="regular-text" /><br />
53 <span class="description"><?php _e('Please enter your YouTube url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
54 </td>
55 </tr>
56 <tr>
57 <th>
58 <label for="flickr">Flickr</label>
59 </th>
60 <td>
61 <input type="text" name="flickr" id="flickr" value="<?php echo esc_attr( get_the_author_meta( 'flickr', $user->ID ) ); ?>" class="regular-text" /><br />
62 <span class="description"><?php _e('Please enter your Flickr url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
63 </td>
64 </tr>
65 <tr>
66 <th>
67 <label for="vimeo">Vimeo</label>
68 </th>
69 <td>
70 <input type="text" name="vimeo" id="vimeo" value="<?php echo esc_attr( get_the_author_meta( 'vimeo', $user->ID ) ); ?>" class="regular-text" /><br />
71 <span class="description"><?php _e('Please enter your Vimeo url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
72 </td>
73 </tr>
74 <tr>
75 <th>
76 <label for="linkedin">Linkedin</label>
77 </th>
78 <td>
79 <input type="text" name="linkedin" id="linkedin" value="<?php echo esc_attr( get_the_author_meta( 'linkedin', $user->ID ) ); ?>" class="regular-text" /><br />
80 <span class="description"><?php _e('Please enter your Linkedin url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
81 </td>
82 </tr>
83 <tr>
84 <th>
85 <label for="dribbble">Dribbble</label>
86 </th>
87 <td>
88 <input type="text" name="dribbble" id="dribbble" value="<?php echo esc_attr( get_the_author_meta( 'dribbble', $user->ID ) ); ?>" class="regular-text" /><br />
89 <span class="description"><?php _e('Please enter your Dribbble url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
90 </td>
91 </tr>
92 <tr>
93 <th>
94 <label for="pinterest">Pinterest</label>
95 </th>
96 <td>
97 <input type="text" name="pinterest" id="pinterest" value="<?php echo esc_attr( get_the_author_meta( 'pinterest', $user->ID ) ); ?>" class="regular-text" /><br />
98 <span class="description"><?php _e('Please enter your Pinterest url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
99 </td>
100 </tr>
101 <tr>
102 <th>
103 <label for="instagram">Instagram</label>
104 </th>
105 <td>
106 <input type="text" name="instagram" id="instagram" value="<?php echo esc_attr( get_the_author_meta( 'instagram', $user->ID ) ); ?>" class="regular-text" /><br />
107 <span class="description"><?php _e('Please enter your Instagram url. (be sure to include http://)', 'virtue-toolkit'); ?></span>
108 </td>
109 </tr>
110 </table>
111 <?php
112 }
113 }
114
115 add_action( 'personal_options_update', 'virtue_toolkit_save_extra_profile_fields' );
116 add_action( 'edit_user_profile_update', 'virtue_toolkit_save_extra_profile_fields' );
117
118 function virtue_toolkit_save_extra_profile_fields( $user_id ) {
119 if ( !current_user_can( 'edit_user', $user_id ) )
120 return false;
121 if(isset($_POST['occupation'])){
122 update_user_meta( $user_id, 'occupation', wp_filter_post_kses($_POST['occupation']) );
123 }
124 if(isset($_POST['twitter'])) {
125 update_user_meta( $user_id, 'twitter', sanitize_title(wp_unslash($_POST['twitter']) ));
126 }
127 if(isset($_POST['facebook'])) {
128 update_user_meta( $user_id, 'facebook', esc_url_raw($_POST['facebook']) );
129 }
130 if(isset($_POST['google'])) {
131 update_user_meta( $user_id, 'google', esc_url_raw($_POST['google']) );
132 }
133 if(isset($_POST['youtube'])) {
134 update_user_meta( $user_id, 'youtube', esc_url_raw($_POST['youtube']) );
135 }
136 if(isset($_POST['flickr'])) {
137 update_user_meta( $user_id, 'flickr', esc_url_raw($_POST['flickr']) );
138 }
139 if(isset($_POST['vimeo'])) {
140 update_user_meta( $user_id, 'vimeo', esc_url_raw($_POST['vimeo']) );
141 }
142 if(isset($_POST['linkedin'])) {
143 update_user_meta( $user_id, 'linkedin', esc_url_raw($_POST['linkedin']) );
144 }
145 if(isset($_POST['dribbble'])) {
146 update_user_meta( $user_id, 'dribbble', esc_url_raw($_POST['dribbble']) );
147 }
148 if(isset($_POST['pinterest'])) {
149 update_user_meta( $user_id, 'pinterest', esc_url_raw($_POST['pinterest']) );
150 }
151 if(isset($_POST['instagram'])) {
152 update_user_meta( $user_id, 'instagram', esc_url_raw($_POST['instagram']) );
153 }
154 }