Changeset 15
- Timestamp:
- 04/07/2008 09:35:36 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
bp_friends.php (modified) (1 diff)
-
bp_messages.php (modified) (2 diffs)
-
bp_xprofile.php (modified) (1 diff)
-
bp_xprofile/bp_xprofile.classes.php (modified) (11 diffs)
-
bp_xprofile/bp_xprofile.cssjs.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp_friends.php
r14 r15 63 63 64 64 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 65 if($wpdb->get_var("show tables like ' $table_name'") != $table_name) friends_install();65 if($wpdb->get_var("show tables like '%" . $table_name . "%'") == false) friends_install(); 66 66 } 67 67 add_action('admin_menu','friends_add_menu'); -
trunk/bp_messages.php
r14 r15 26 26 27 27 $sql = "CREATE TABLE ". $table_name ." ( 28 id mediumint(9) NOT NULL AUTO_INCREMENT, 29 sender_id mediumint(9) NOT NULL, 30 recipient_id mediumint(9) NOT NULL, 28 id int(11) NOT NULL AUTO_INCREMENT, 29 sender_id int(11) NOT NULL, 30 recipient_id int(11) NOT NULL, 31 folder_id tinyint(1) NOT NULL DEFAULT 1, 31 32 subject varchar(200) NOT NULL, 32 33 message longtext NOT NULL, … … 70 71 71 72 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 72 if($wpdb->get_var("show tables like ' $table_name'") != $table_name) messages_install();73 if($wpdb->get_var("show tables like '%" . $table_name . "%'") == false) messages_install(); 73 74 } 74 75 add_action('admin_menu','messages_add_menu'); -
trunk/bp_xprofile.php
r14 r15 102 102 103 103 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 104 if($wpdb->get_var("show tables like ' $bp_xprofile_table_name'") != $bp_xprofile_table_name) xprofile_install();104 if($wpdb->get_var("show tables like '%" . $bp_xprofile_table_name . "%'") == false) xprofile_install(); 105 105 } 106 106 add_action('admin_menu','xprofile_add_menu'); -
trunk/bp_xprofile/bp_xprofile.classes.php
r14 r15 57 57 58 58 } 59 60 function exists()59 60 function save() 61 61 { 62 62 global $wpdb; 63 63 64 // check to see if the current object exists in the DB 65 66 $sql = "SELECT id FROM " . $this->table_name . "_groups 67 WHERE group_id = " . $this->id; 68 69 if(!$wpdb->get_row($sql)) 70 { 71 return false; 72 } 73 74 return true; 75 } 76 77 function save() 78 { 79 global $wpdb; 80 81 if($this->exists()) 64 if($this->id != null) 82 65 { 83 66 // Update a group. … … 306 289 } 307 290 308 function exists()291 function delete() 309 292 { 310 293 global $wpdb; 311 294 312 // check to see if the current object exists in the DB 313 314 $sql = "SELECT id FROM " . $this->table_name . "_fields 315 WHERE id = " . $this->id; 316 317 if(!$wpdb->get_row($sql)) 318 { 319 return false; 320 } 321 322 return true; 323 } 324 325 function delete() 295 $sql = "DELETE FROM " . $this->table_name . "_fields 296 WHERE id = " . $this->id . " 297 OR parent_id = " . $this->id; 298 299 if($wpdb->query($sql) === false) { 300 return false; 301 } 302 303 // delete the data in the DB for this field 304 BP_XProfile_ProfileData::delete_all($this->id); 305 306 return true; 307 308 } 309 310 function save() 326 311 { 327 312 global $wpdb; 328 329 $sql = "DELETE FROM " . $this->table_name . "_fields 330 WHERE id = " . $this->id; 331 332 if($wpdb->query($sql) === false) { 333 return false; 334 } 335 336 return true; 337 338 } 339 340 function save() 341 { 342 global $wpdb; 343 344 if($this->exists()) 313 314 if($this->id != null) 345 315 { 346 316 $sql = "UPDATE " . $this->table_name . "_fields … … 364 334 if($wpdb->query($sql) !== false) 365 335 { 366 // Remove any radio or dropdown options for this 367 // field. They will be re-added if needed. 368 // This stops orphan options if the user changes a 369 // field from a radio button field to a text box. 370 371 $this->delete_children(); 336 // Only do this if we are editing an existing field 337 if($this->id != null) { 338 339 // Remove any radio or dropdown options for this 340 // field. They will be re-added if needed. 341 // This stops orphan options if the user changes a 342 // field from a radio button field to a text box. 343 $this->delete_children(); 344 } 372 345 373 346 // Check to see if this is a selectbox or radio button field. 374 347 // We need to add the options to the db, if it is. 375 376 348 if($this->type == "radio" || $this->type == "selectbox") 377 349 { … … 404 376 { 405 377 return false; 406 378 407 379 // Need to go back and reverse what has been entered here. 408 380 } … … 626 598 function render_admin_form($message = '') 627 599 { 628 $options = $this->get_children(); 629 600 if($this->id != null) { 601 $options = $this->get_children(); 602 } 630 603 ?> 631 604 … … 642 615 <form action="<?php echo $action ?>" method="post"> 643 616 644 <fieldset id="titlediv"> 645 <legend><?php _e("Field Title") ?></legend> 617 <label for="title">* <?php _e("Field Title") ?></label> 646 618 <div> 647 619 <input type="text" name="title" id="title" value="<?php echo $this->name ?>" style="width:50%" /> 648 620 </div> 649 </fieldset> 650 651 <fieldset id="descriptiondiv"> 652 <legend><?php _e("Field Description") ?></legend> 621 <p></p> 622 <label for="description"><?php _e("Field Description") ?></label> 653 623 <div> 654 624 <textarea name="description" id="description" rows="5" cols="60"><?php echo $this->desc ?></textarea> 655 625 </div> 656 </fieldset> 657 658 <fieldset id="requireddiv"> 659 <legend><?php _e("Is This Field Required?") ?></legend> 626 <p></p> 627 <label for="required">* <?php _e("Is This Field Required?") ?></label> 660 628 <div> 661 629 <select name="required" id="required"> … … 664 632 </select> 665 633 </div> 666 </fieldset> 667 668 <fieldset id="typediv"> 669 <legend><?php _e("Field Type") ?></legend> 634 <p></p> 635 <label for="fieldtype">* <?php _e("Field Type") ?></label> 670 636 <div> 671 637 <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)"> … … 677 643 </select> 678 644 </div> 679 </fieldset>680 645 681 646 <div id="radio" style="<?php if($this->type != 'radio') {?>display: none;<?php } ?> margin-left: 15px;"> … … 762 727 if($_POST['title'] == '' || $_POST['required'] == '' || $_POST['fieldtype'] == '') 763 728 { 764 $message = __('Please make sure you fill out the form completely, every field is required.');729 $message = __('Please make sure you fill out all required fields.'); 765 730 return false; 766 731 } … … 952 917 } 953 918 954 955 956 919 /** Static Functions **/ 957 920 … … 974 937 return false; 975 938 } 939 } 940 } 941 942 function delete_all($field_id) 943 { 944 global $wpdb, $userdata; 945 946 if(bp_core_validate($field_id)) 947 { 948 $sql = "DELETE FROM " . $this->table_name . "_data 949 WHERE field_id = " . $field_id; 950 951 if($wpdb->query($sql) === false) { 952 return false; 953 } 954 955 return true; 976 956 } 977 957 } -
trunk/bp_xprofile/bp_xprofile.cssjs.php
r14 r15 157 157 color: #555; 158 158 } 159 159 160 160 161 161 </style>
Note: See TracChangeset
for help on using the changeset viewer.