Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/29/2015 04:27:24 AM (10 years ago)
Author:
johnjamesjacoby
Message:

XProfile: Add brackets to `class-bp-xprofile-field.php. Stylistic changes only.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php

    r9657 r9658  
    5454        }
    5555
    56         $bp  = buddypress();
    57         $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id );
    58 
    59         if ( $field = $wpdb->get_row( $sql ) ) {
     56        $bp    = buddypress();
     57        $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE id = %d", $id ) );
     58
     59        if ( ! empty( $field ) ) {
    6060            $this->id               = $field->id;
    6161            $this->group_id          = $field->group_id;
     
    9595        // Prevent deletion by url when can_delete is false.
    9696        // Prevent deletion of option 1 since this invalidates fields with options.
    97         if ( empty( $this->id ) || empty( $this->can_delete ) || ( $this->parent_id && $this->option_order == 1 ) )
     97        if ( empty( $this->id ) || empty( $this->can_delete ) || ( $this->parent_id && $this->option_order == 1 ) ) {
    9898            return false;
     99        }
    99100
    100101        $bp = buddypress();
    101102
    102         if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id ) ) )
     103        if ( !$wpdb->query( $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id ) ) ) {
    103104            return false;
     105        }
    104106
    105107        // delete the data in the DB for this field
    106         if ( true === $delete_data )
     108        if ( true === $delete_data ) {
    107109            BP_XProfile_ProfileData::delete_for_field( $this->id );
     110        }
    108111
    109112        return true;
     
    210213
    211214                        if ( is_array( $defaults ) ) {
    212                             if ( isset( $defaults[$option_key] ) )
     215                            if ( isset( $defaults[$option_key] ) ) {
    213216                                $is_default = 1;
     217                            }
    214218                        } else {
    215                             if ( (int) $defaults == $option_key )
     219                            if ( (int) $defaults == $option_key ) {
    216220                                $is_default = 1;
     221                            }
    217222                        }
    218223
     
    336341        $bp = buddypress();
    337342
    338         if ( empty( $bp->profile->table_name_fields ) || !isset( $field_name ) )
     343        if ( empty( $bp->profile->table_name_fields ) || !isset( $field_name ) ) {
    339344            return false;
     345        }
    340346
    341347        return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s AND parent_id = 0", $field_name ) );
     
    345351        global $wpdb;
    346352
    347         if ( !is_numeric( $position ) || !is_numeric( $field_group_id ) )
     353        if ( !is_numeric( $position ) || !is_numeric( $field_group_id ) ) {
    348354            return false;
     355        }
    349356
    350357        $bp = buddypress();
Note: See TracChangeset for help on using the changeset viewer.