Example #1
0
 function axiom_save_fields_in_user_profile($user_id)
 {
     if (!current_user_can('edit_user', $user_id)) {
         return false;
     }
     update_user_meta($user_id, 'user_position', $_POST['user_position']);
     $social_list = axiom_get_theme_option('social_icons');
     foreach ($social_list as $soc) {
         $sn = basename($soc['icon']);
         //$sn = axiom_substr($sn, 0, axiom_strrpos($sn, '.'));
         $sn = axiom_substr($sn, axiom_strrpos($sn, '-') + 1);
         if (($pos = axiom_strrpos($sn, '_')) !== false) {
             $sn = axiom_substr($sn, 0, $pos);
         }
         update_user_meta($user_id, 'user_' . $sn, $_POST['user_' . $sn]);
     }
 }
Example #2
0
    function axiom_team_show_meta_box()
    {
        global $post, $AXIOM_GLOBALS;
        // Use nonce for verification
        $data = get_post_meta($post->ID, 'team_data', true);
        $fields = $AXIOM_GLOBALS['team_meta_box']['fields'];
        ?>
		<input type="hidden" name="meta_box_team_nonce" value="<?php 
        echo wp_create_nonce(basename(__FILE__));
        ?>
" />
		<table class="team_area">
		<?php 
        foreach ($fields as $id => $field) {
            $meta = isset($data[$id]) ? $data[$id] : '';
            ?>
			<tr class="team_field <?php 
            echo esc_attr($field['class']);
            ?>
" valign="top">
				<td><label for="<?php 
            echo esc_attr($id);
            ?>
"><?php 
            echo esc_attr($field['title']);
            ?>
</label></td>
				<td>
					<?php 
            if ($id == 'team_member_socials') {
                $style = "icons";
                $upload_info = wp_upload_dir();
                $upload_url = $upload_info['baseurl'];
                $social_list = axiom_get_theme_option('social_icons');
                foreach ($social_list as $soc) {
                    $sn = basename($soc['icon']);
                    if ($style == 'icons') {
                        $sn = axiom_substr($sn, axiom_strrpos($sn, '-') + 1, strlen($sn) - axiom_strrpos($sn, '-'));
                    } else {
                        $sn = axiom_substr($sn, 0, axiom_strrpos($sn, '.'));
                    }
                    if (($pos = axiom_strrpos($sn, '_')) !== false) {
                        $sn = axiom_substr($sn, 0, $pos);
                    }
                    $link = isset($meta[$sn]) ? $meta[$sn] : '';
                    ?>
							<label for="<?php 
                    echo esc_attr($id . '_' . $sn);
                    ?>
"><?php 
                    echo esc_attr(axiom_strtoproper($sn));
                    ?>
</label><br>
							<input type="text" name="<?php 
                    echo esc_attr($id);
                    ?>
[<?php 
                    echo esc_attr($sn);
                    ?>
]" id="<?php 
                    echo esc_attr($id . '_' . $sn);
                    ?>
" value="<?php 
                    echo esc_attr($link);
                    ?>
" size="30" /><br>
							<?php 
                }
            } else {
                ?>
						<input type="text" name="<?php 
                echo esc_attr($id);
                ?>
" id="<?php 
                echo esc_attr($id);
                ?>
" value="<?php 
                echo esc_attr($meta);
                ?>
" size="30" />
						<?php 
            }
            ?>
					<br><small><?php 
            echo esc_attr($field['desc']);
            ?>
</small>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
    }