Advertisement
Guest User

Untitled

a guest
Apr 28th, 2013
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.92 KB | None | 0 0
  1. function symbiostock_social_credentials( $user ) { ?>
  2.  
  3. <?php
  4. if ( !current_user_can( 'manage_options', $userid ) )
  5. return false;
  6.  
  7. $prfx = 'symbiostock_';
  8.  
  9. $text_fields = array(
  10. 'Personal Photo' => '(URL)',
  11. 'Software' => 'Illustrator, photoshop, 3d Studio Max, etc.',
  12. 'Equipment' => 'Cameras, computers, graphic tablets, etc.',
  13. 'Location' => 'Country/City',
  14. 'Languages' => 'Your spoken language(s)',
  15. 'Website 1' => '(URL)',
  16. 'Website 2' => '(URL)',
  17. 'Gallery Page' => '(URL)',
  18. 'Clients' => 'Who you\'ve worked for.',
  19. );
  20.  
  21. $select_dropdowns = array(
  22.  
  23. 'Profession 1' => array('-', 'Illustrator', 'Photographer', 'Developer', 'Artist', 'Marketing', 'Graphic Design', '3d Design' ),
  24. 'Profession 2' => array('-', 'Illustrator', 'Photographer', 'Developer', 'Artist', 'Marketing', 'Graphic Design', '3d Design' ),
  25. 'Portfolio Focus 1' => array('-', 'Photography', 'Vector', '3d Design', 'Digital Painting'),
  26. 'Portfolio Focus 2' => array('-', 'Photography', 'Vector', '3d Design', 'Digital Painting'),
  27. 'Gender' => array('-', 'Male', 'Female'),
  28.  
  29. );
  30.  
  31. if(isset($_POST['symbiostock_social_credentials'])){
  32.  
  33. $symbiostock_social_credentials = array();
  34.  
  35. foreach($text_fields as $key => $value){
  36.  
  37. $name_id = $prfx . strtolower(str_replace(' ', '_', $key));
  38.  
  39. if(isset($_POST[$prfx.$name_id])){
  40.  
  41. array_push($symbiostock_social_credentials, array($key => $_POST[$prfx.$key]));
  42.  
  43. }
  44.  
  45. }
  46.  
  47. foreach($select_dropdowns as $key => $value){
  48. $name_id = $prfx . strtolower(str_replace(' ', '_', $key));
  49. if(isset($_POST[$prfx.$key])){
  50. array_push($symbiostock_social_credentials, array($key => $_POST[$prfx.$name_id]));
  51. }
  52.  
  53. }
  54.  
  55. update_user_meta($user->ID, 'symbiostock_social_credentials', $symbiostock_social_credentials);
  56.  
  57. }
  58.  
  59. $credentials = get_user_meta($user->ID, 'symbiostock_social_credentials');
  60.  
  61. print_r($_POST);
  62. ?>
  63.  
  64. <h3>Symbiostock Profile and Extended Network Info</h3>
  65.  
  66. <table class="form-table">
  67.  
  68. <?php
  69.  
  70. foreach($text_fields as $key => $text){
  71.  
  72. $name_id = $prfx . strtolower(str_replace(' ', '_', $key));
  73. /*
  74. if (strpos($text_field,'URL') !== false) {
  75.  
  76. if(symbiostock_validate_url($text_field) == false){
  77.  
  78. echo '<p>Invalid URL for ' . $key . '. Please try again.</p>';
  79.  
  80. continue;
  81. }*/
  82.  
  83. ?>
  84.  
  85. <tr>
  86. <th><label for="<?php echo $name_id; ?>"><?php echo $key; ?></label></th>
  87. <td>
  88. <input type="text" name="<?php echo $name_id; ?>" id="<?php echo $name_id; ?>" value="" class="regular-text" /><br />
  89. <span class="description"><?php echo $text; ?></span>
  90. </td>
  91. </tr>
  92.  
  93. <?php
  94.  
  95. }
  96.  
  97. foreach ($select_dropdowns as $key => $options){
  98. $name_id = $prfx . strtolower(str_replace(' ', '_', $key));
  99.  
  100. ?>
  101. <tr>
  102. <th><label for="<?php echo $prfx.$name_id; ?>"> <?php echo $key; ?></label> </th>
  103. <td>
  104. <select id="<?php echo $prfx.$name_id ?>" name="<?php echo $prfx.$name_id; ?>" id="<?php echo $name_id; ?>" class="regular-text">
  105.  
  106. <?php
  107.  
  108. foreach($options as $option){
  109. ?> <option value="<?php echo $option; ?>"><?php echo $option; ?></option> <?php
  110. }
  111. ?>
  112.  
  113. </select><br />
  114. </td>
  115. </tr>
  116.  
  117. <?php
  118.  
  119. }
  120.  
  121. ?>
  122. <input type="hidden" name="symbiostock_social_credentials" value="1" />
  123. </table>
  124. <?php }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement