Changeset 2810
- Timestamp:
- 03/05/2010 04:01:27 AM (16 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 4 edited
-
bp-xprofile-admin.php (modified) (16 diffs)
-
bp-xprofile-classes.php (modified) (26 diffs)
-
bp-xprofile-filters.php (modified) (3 diffs)
-
bp-xprofile-templatetags.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-admin.php
r2805 r2810 21 21 22 22 else if ( isset( $_GET['mode'] ) && isset( $_GET['group_id'] ) && isset( $_GET['field_id'] ) && 'edit_field' == $_GET['mode'] ) 23 xprofile_admin_manage_field( $_GET['group_id'], $_GET['field_id'] );23 xprofile_admin_manage_field( $_GET['group_id'], $_GET['field_id'] ); 24 24 25 25 else if ( isset( $_GET['mode'] ) && isset( $_GET['field_id'] ) && 'delete_field' == $_GET['mode'] ) 26 xprofile_admin_delete_field( $_GET['field_id'], 'field');26 xprofile_admin_delete_field( $_GET['field_id'], 'field'); 27 27 28 28 else if ( isset( $_GET['mode'] ) && isset( $_GET['option_id'] ) && 'delete_option' == $_GET['mode'] ) … … 41 41 ?> 42 42 <div class="wrap"> 43 <h2><?php _e( 'Profile Field Setup', 'buddypress') ?></h2>44 <p><?php _e( 'Your users will distinguish themselves through their profile page. You must give them profile fields that allow them to describe themselves in a way that is relevant to the theme of your social network.', 'buddypress') ?></p>43 <h2><?php _e( 'Profile Field Setup', 'buddypress'); ?></h2> 44 <p><?php _e( 'Your users will distinguish themselves through their profile page. You must give them profile fields that allow them to describe themselves in a way that is relevant to the theme of your social network.', 'buddypress'); ?></p> 45 45 <p><?php _e('NOTE: Any fields in the first group will appear on the signup page.', 'buddypress'); ?></p> 46 46 … … 64 64 foreach ( $groups as $group ) { ?> 65 65 66 <table id="group_<?php echo $group->id; ?>" class="widefat field-group sortable">66 <table id="group_<?php echo $group->id; ?>" class="widefat field-group sortable"> 67 67 <thead> 68 68 <tr class="grabber"> 69 <th scope="col" width="10"><img src="<?php echo BP_PLUGIN_URL ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' )?>" /></th>69 <th scope="col" width="10"><img src="<?php echo BP_PLUGIN_URL; ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' ); ?>" /></th> 70 70 <th scope="col" colspan="3"><?php echo attribute_escape( $group->name ); ?></th> 71 71 <?php 72 72 if ( $group->can_delete ) : 73 73 ?> 74 <th scope="col" class="center"><a class="edit" href="admin.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo attribute_escape( $group->id ); ?>"><?php _e( 'Edit', 'buddypress' ) ?></a></th>75 <th scope="col" class="center"><a class="delete" href="admin.php?page=bp-profile-setup&mode=delete_group&group_id=<?php echo attribute_escape( $group->id ); ?>"><?php _e( 'Delete', 'buddypress' ) ?></a></th>74 <th scope="col" class="center"><a class="edit" href="admin.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo attribute_escape( $group->id ); ?>"><?php _e( 'Edit', 'buddypress' ); ?></a></th> 75 <th scope="col" class="center"><a class="delete" href="admin.php?page=bp-profile-setup&mode=delete_group&group_id=<?php echo attribute_escape( $group->id ); ?>"><?php _e( 'Delete', 'buddypress' ); ?></a></th> 76 76 <?php 77 77 else : 78 78 ?> 79 <th scope="col" class="center"><a class="edit" href="admin.php?page=bp-general-settings"><?php _e( 'Edit', 'buddypress' ) ?></a></th>79 <th scope="col" class="center"><a class="edit" href="admin.php?page=bp-general-settings"><?php _e( 'Edit', 'buddypress' ); ?></a></th> 80 80 <th scope="col" class="center"> </th> 81 81 <?php … … 86 86 <tr class="header"> 87 87 <td> </td> 88 <td><?php _e( 'Field Name', 'buddypress' ) ?></td>89 <td width="14%"><?php _e( 'Field Type', 'buddypress' ) ?></td>90 <td width="6%" class="center"><?php _e( 'Required?', 'buddypress' ) ?></td>91 <td colspan="2" width="10%" class="center"><?php _e( 'Actions', 'buddypress' ) ?></td>88 <td><?php _e( 'Field Name', 'buddypress' ); ?></td> 89 <td width="14%"><?php _e( 'Field Type', 'buddypress' ); ?></td> 90 <td width="6%" class="center"><?php _e( 'Required?', 'buddypress' ); ?></td> 91 <td colspan="2" width="10%" class="center"><?php _e( 'Actions', 'buddypress' ); ?></td> 92 92 </tr> 93 93 </thead> … … 95 95 <tfoot> 96 96 <tr class="nodrag"> 97 <td colspan="6"><a href="admin.php?page=bp-profile-setup&group_id=<?php echo attribute_escape( $group->id ); ?>&mode=add_field"><?php _e( 'Add New Field', 'buddypress' ) ?></a></td>97 <td colspan="6"><a href="admin.php?page=bp-profile-setup&group_id=<?php echo attribute_escape( $group->id ); ?>&mode=add_field"><?php _e( 'Add New Field', 'buddypress' ); ?></a></td> 98 98 </tr> 99 99 </tfoot> 100 100 101 <tbody id="<?php echo $group->id ;?>">101 <tbody id="<?php echo $group->id ?>"> 102 102 <?php 103 103 if ( $group->fields ) : … … 114 114 115 115 <tr id="field_<?php echo attribute_escape( $field->id ); ?>" class="sortable<?php if ( $class ) { echo ' ' . $class; } ?>"> 116 <td width="10"><img src="<?php echo BP_PLUGIN_URL ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' )?>" /></td>117 <td><span title="<?php echo $field->description; ?>"><?php echo attribute_escape( $field->name ); ?> <?php if(!$field->can_delete) { ?> <?php _e( '(Core Field)', 'buddypress' ) ?><?php} ?></span></td>116 <td width="10"><img src="<?php echo BP_PLUGIN_URL; ?>/bp-xprofile/admin/images/move.gif" alt="<?php _e( 'Drag', 'buddypress' ); ?>" /></td> 117 <td><span title="<?php echo $field->description; ?>"><?php echo attribute_escape( $field->name ); ?> <?php if(!$field->can_delete) { ?> <?php _e( '(Core Field)', 'buddypress' ); } ?></span></td> 118 118 <td><?php echo attribute_escape( $field->type ); ?></td> 119 119 <td class="center"><?php if ( $field->is_required ) { echo '<img src="' . BP_PLUGIN_URL . '/bp-xprofile/admin/images/tick.gif" alt="' . __( 'Yes', 'buddypress' ) . '" />'; } else { ?>-<?php } ?></td> 120 <td class="center"><a class="edit" href="<?php if ( !$field->can_delete ) { ?>admin.php?page=bp-general-settings<?php } else { ?>admin.php?page=bp-profile-setup&group_id=<?php echo attribute_escape( $group->id ); ?>&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=edit_field<?php } ?>"><?php _e( 'Edit', 'buddypress' ) ?></a></td>121 <td class="center"><?php if ( !$field->can_delete ) { ?> <?php } else { ?><a class="delete" href="admin.php?page=bp-profile-setup&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=delete_field"><?php _e( 'Delete', 'buddypress' ) ?></a><?php } ?></td>120 <td class="center"><a class="edit" href="<?php if ( !$field->can_delete ) { ?>admin.php?page=bp-general-settings<?php } else { ?>admin.php?page=bp-profile-setup&group_id=<?php echo attribute_escape( $group->id ); ?>&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=edit_field<?php } ?>"><?php _e( 'Edit', 'buddypress' ); ?></a></td> 121 <td class="center"><?php if ( !$field->can_delete ) { ?> <?php } else { ?><a class="delete" href="admin.php?page=bp-profile-setup&field_id=<?php echo attribute_escape( $field->id ); ?>&mode=delete_field"><?php _e( 'Delete', 'buddypress' ); ?></a><?php } ?></td> 122 122 </tr> 123 123 <?php … … 128 128 129 129 <tr class="nodrag"> 130 <td colspan="6"><?php _e( 'There are no fields in this group.', 'buddypress' ) ?></td>130 <td colspan="6"><?php _e( 'There are no fields in this group.', 'buddypress' ); ?></td> 131 131 </tr> 132 132 <?php … … 140 140 </div> 141 141 <p> 142 <a class="button" href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ) ?></a>142 <a class="button" href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a> 143 143 </p> 144 144 <?php … … 147 147 148 148 <div id="message" class="error"><p><?php _e('You have no groups.', 'buddypress' ); ?></p></div> 149 <p><a href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Group', 'buddypress' ) ?></a></p>149 <p><a href="admin.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Group', 'buddypress' ); ?></a></p> 150 150 <?php 151 151 endif; … … 167 167 global $message, $type; 168 168 169 $group = new BP_XProfile_Group( $group_id);170 171 if ( isset( $_POST['saveGroup']) ) {172 if ( BP_XProfile_Group::admin_validate( $_POST) ) {169 $group = new BP_XProfile_Group( $group_id ); 170 171 if ( isset( $_POST['saveGroup'] ) ) { 172 if ( BP_XProfile_Group::admin_validate( $_POST ) ) { 173 173 $group->name = wp_filter_kses( $_POST['group_name'] ); 174 174 $group->description = wp_filter_kses( $_POST['group_desc'] ); 175 175 176 176 if ( !$group->save() ) { 177 $message = __( 'There was an error saving the group. Please try again', 'buddypress');177 $message = __( 'There was an error saving the group. Please try again', 'buddypress' ); 178 178 $type = 'error'; 179 179 } else { 180 $message = __( 'The group was saved successfully.', 'buddypress');180 $message = __( 'The group was saved successfully.', 'buddypress' ); 181 181 $type = 'success'; 182 182 … … 184 184 } 185 185 186 unset( $_GET['mode']);186 unset( $_GET['mode'] ); 187 187 xprofile_admin( $message, $type ); 188 188 189 189 } else { 190 $group->render_admin_form( $message);190 $group->render_admin_form( $message ); 191 191 } 192 192 } else { … … 230 230 global $bp, $wpdb, $message, $groups; 231 231 232 $field = new BP_XProfile_Field( $field_id);232 $field = new BP_XProfile_Field( $field_id ); 233 233 $field->group_id = $group_id; 234 234 235 if ( isset( $_POST['saveField']) ) {235 if ( isset( $_POST['saveField'] ) ) { 236 236 if ( BP_XProfile_Field::admin_validate() ) { 237 237 $field->name = wp_filter_kses( $_POST['title'] ); … … 249 249 250 250 if ( !$field->save() ) { 251 $message = __( 'There was an error saving the field. Please try again', 'buddypress');251 $message = __( 'There was an error saving the field. Please try again', 'buddypress' ); 252 252 $type = 'error'; 253 253 254 unset( $_GET['mode']);255 xprofile_admin( $message, $type);254 unset( $_GET['mode'] ); 255 xprofile_admin( $message, $type ); 256 256 } else { 257 $message = __( 'The field was saved successfully.', 'buddypress');257 $message = __( 'The field was saved successfully.', 'buddypress' ); 258 258 $type = 'success'; 259 259 260 unset( $_GET['mode']);260 unset( $_GET['mode'] ); 261 261 262 262 do_action( 'xprofile_fields_saved_field', $field ); … … 266 266 } 267 267 } else { 268 $field->render_admin_form( $message);268 $field->render_admin_form( $message ); 269 269 } 270 270 } else { … … 282 282 global $message, $type; 283 283 284 if ( 'field' == $type ) {284 if ( 'field' == $type ) 285 285 $type = __('field', 'buddypress'); 286 } else {286 else 287 287 $type = __('option', 'buddypress'); 288 } 289 290 $field = new BP_XProfile_Field($field_id); 288 289 $field = new BP_XProfile_Field( $field_id ); 291 290 292 291 if ( !$field->delete() ) { 293 $message = sprintf( __('There was an error deleting the %s. Please try again', 'buddypress' ), $type);292 $message = sprintf( __('There was an error deleting the %s. Please try again', 'buddypress' ), $type ); 294 293 $type = 'error'; 295 294 } else { 296 $message = sprintf( __('The %s was deleted successfully!', 'buddypress' ), $type);295 $message = sprintf( __('The %s was deleted successfully!', 'buddypress' ), $type ); 297 296 $type = 'success'; 298 297 … … 300 299 } 301 300 302 unset( $_GET['mode']);303 xprofile_admin( $message, $type);301 unset( $_GET['mode'] ); 302 xprofile_admin( $message, $type ); 304 303 } 305 304 -
trunk/bp-xprofile/bp-xprofile-classes.php
r2809 r2810 21 21 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_groups} WHERE id = %d", $id ); 22 22 23 if ( !$group = $wpdb->get_row( $sql) )23 if ( !$group = $wpdb->get_row( $sql ) ) 24 24 return false; 25 25 … … 38 38 do_action( 'xprofile_group_before_save', $this ); 39 39 40 if ( $this->id ) {40 if ( $this->id ) 41 41 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_groups} SET name = %s, description = %s WHERE id = %d", $this->name, $this->description, $this->id ); 42 } else {42 else 43 43 $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_groups} (name, description, can_delete) VALUES (%s, %s, 1)", $this->name, $this->description ); 44 }45 44 46 45 if ( !$wpdb->query($sql) ) … … 68 67 if ( BP_XProfile_Field::delete_for_group( $this->id ) ) { 69 68 /* Remove profile data for the groups fields */ 70 for ( $i = 0; $i < count( $this->fields ); $i++ ) 69 for ( $i = 0; $i < count( $this->fields ); $i++ ) { 71 70 BP_XProfile_ProfileData::delete_for_field( $this->fields[$i]->id ); 72 71 } 73 72 } 74 73 … … 105 104 106 105 /* Get the group ids */ 107 foreach( (array)$groups as $group ) 106 foreach( (array)$groups as $group ) { 108 107 $group_ids[] = $group->id; 108 } 109 109 110 110 $group_ids = implode( ',', (array) $group_ids ); … … 121 121 if ( $fetch_field_data ) { 122 122 /* Fetch the field data for the user. */ 123 foreach( (array)$fields as $field ) 123 foreach( (array)$fields as $field ) { 124 124 $field_ids[] = $field->id; 125 } 125 126 126 127 $field_ids = implode( ',', (array) $field_ids ); … … 155 156 /* Validate Form */ 156 157 if ( empty( $_POST['group_name'] ) ) { 157 $message = __( 'Please make sure you give the group a name.', 'buddypress');158 $message = __( 'Please make sure you give the group a name.', 'buddypress' ); 158 159 return false; 159 160 } else { … … 187 188 188 189 <h2><?php echo $title; ?></h2> 189 <br /> 190 191 <?php 190 <?php 192 191 if ( $message != '' ) { 193 192 $type = ( 'error' == $type ) ? 'error' : 'updated'; 194 ?> 193 ?> 194 195 195 <div id="message" class="<?php echo $type; ?> fade"> 196 196 <p><?php echo $message; ?></p> 197 197 </div> 198 <?php } ?>198 <?php } ?> 199 199 200 200 <form action="<?php echo attribute_escape( $action ); ?>" method="post"> 201 202 201 <div id="titlediv"> 203 202 <label for="group_name"><?php _e( "Field Group Name", 'buddypress') ?></label> 204 203 <div> 205 <input type="text" name="group_name" id="group_name" value="<?php echo attribute_escape( $this->name ) ?>" style="width:50%" />204 <input type="text" name="group_name" id="group_name" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" /> 206 205 </div> 207 206 </div> … … 210 209 <input type="submit" name="saveGroup" value="<?php echo attribute_escape( $title ); ?> →" /> 211 210 </p> 212 213 211 </form> 214 212 </div> 215 216 213 <?php 217 214 } … … 265 262 266 263 if ( $get_data ) 267 $this->data = $this->get_field_data( $user_id);264 $this->data = $this->get_field_data( $user_id ); 268 265 269 266 } … … 306 303 307 304 if ( $this->id != null ) 308 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->id );305 $sql = $wpdb->prepare( "UPDATE {$bp->profile->table_name_fields} SET group_id = %d, parent_id = 0, type = %s, name = %s, description = %s, is_required = %d, order_by = %s, field_order = %d WHERE id = %d", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order, $this->id ); 309 306 else 310 307 $sql = $wpdb->prepare( "INSERT INTO {$bp->profile->table_name_fields} (group_id, parent_id, type, name, description, is_required, order_by, field_order ) VALUES (%d, 0, %s, %s, %s, %d, %s, %d )", $this->group_id, $this->type, $this->name, $this->description, $this->is_required, $this->order_by, $this->field_order ); … … 417 414 $sql = $wpdb->prepare( "SELECT * FROM {$bp->profile->table_name_fields} WHERE parent_id = %d AND group_id = %d $sort_sql", $parent_id, $this->group_id ); 418 415 419 if ( !$children = $wpdb->get_results( $sql) )416 if ( !$children = $wpdb->get_results( $sql ) ) 420 417 return false; 421 418 … … 426 423 global $wpdb, $bp; 427 424 428 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE parent_id = %d", $this->id);429 430 $wpdb->query( $sql);425 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE parent_id = %d", $this->id ); 426 427 $wpdb->query( $sql ); 431 428 } 432 429 … … 454 451 $sql = $wpdb->prepare( "DELETE FROM {$bp->profile->table_name_fields} WHERE group_id = %d", $group_id ); 455 452 456 if ( $wpdb->get_var( $sql) === false )453 if ( $wpdb->get_var( $sql ) === false ) 457 454 return false; 458 455 … … 503 500 $default_input = 'radio'; 504 501 ?> 505 <div id="<?php echo $type ?>" class="options-box" style="<?php if ( $this->type != $type ) { ?>display: none;<?php } ?> margin-left: 15px;">506 <h4><?php _e('Please enter options for this Field:', 'buddypress') ?></h4>507 <p><?php _e( 'Order By:', 'buddypress' ) ?>508 <select name="sort_order_<?php echo $type ?>" id="sort_order_<?php echo $type?>" >509 <option value="default" <?php if ( 'default' == $this->order_by ) {?> selected="selected"<?php } ?> ><?php _e( 'Order Entered', 'buddypress' ) ?></option>510 <option value="asc" <?php if ( 'asc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Ascending', 'buddypress' ) ?></option>511 <option value="desc" <?php if ( 'desc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Descending', 'buddypress' ) ?></option>502 <div id="<?php echo $type; ?>" class="options-box" style="<?php if ( $this->type != $type ) { ?>display: none;<?php } ?> margin-left: 15px;"> 503 <h4><?php _e('Please enter options for this Field:', 'buddypress'); ?></h4> 504 <p><?php _e( 'Order By:', 'buddypress' ); ?> 505 <select name="sort_order_<?php echo $type; ?>" id="sort_order_<?php echo $type; ?>" > 506 <option value="default" <?php if ( 'default' == $this->order_by ) {?> selected="selected"<?php } ?> ><?php _e( 'Order Entered', 'buddypress' ); ?></option> 507 <option value="asc" <?php if ( 'asc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Ascending', 'buddypress' ); ?></option> 508 <option value="desc" <?php if ( 'desc' == $this->order_by ) {?> selected="selected"<?php } ?>><?php _e( 'Name - Descending', 'buddypress' ); ?></option> 512 509 </select> 513 510 <?php 514 if ( !$options = $this->get_children( true) ) {511 if ( !$options = $this->get_children( true ) ) { 515 512 $i = 1; 516 513 while ( isset( $_POST[$type . '_option'][$i] ) ) { … … 530 527 531 528 if ( !empty( $options ) ) { 532 for ( $i = 0; $i < count( $options); $i++ ) {529 for ( $i = 0; $i < count( $options ); $i++ ) { 533 530 $j = $i + 1; 534 531 535 532 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 536 533 $default_name = '[' . $j . ']'; 537 ?>538 <p><?php _e('Option', 'buddypress') ?> <?php echo $j?>:539 <input type="text" name="<?php echo $type ?>_option[<?php echo $j ?>]" id="<?php echo $type ?>_option<?php echo $j ?>" value="<?php echo attribute_escape( $options[$i]->name )?>" />540 <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j ?>" /> <?php _e( 'Default Value', 'buddypress' )?>534 ?> 535 <p><?php _e('Option', 'buddypress'); ?> <?php echo $j; ?>: 536 <input type="text" name="<?php echo $type; ?>_option[<?php echo $j; ?>]" id="<?php echo $type; ?>_option<?php echo $j; ?>" value="<?php echo attribute_escape( $options[$i]->name ); ?>" /> 537 <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo $type; ?>_option<?php echo $default_name; ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j; ?>" /> <?php _e( 'Default Value', 'buddypress' ); ?> 541 538 <?php if ( $j != 1 && 542 $options[$i]->id != -1 ) : ?><a href="admin.php?page=bp-profile-setup&mode=delete_option&option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a><?php endif?></p>539 $options[$i]->id != -1 ) : ?><a href="admin.php?page=bp-profile-setup&mode=delete_option&option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id; ?>">[x]</a><?php endif; ?></p> 543 540 </p> 544 <?php} /* end for */ ?>545 <input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="<?php echo $j + 1 ?>" /> 546 547 <?php541 <?php } /* end for */ ?> 542 543 <input type="hidden" name="<?php echo $type; ?>_option_number" id="<?php echo $type; ?>_option_number" value="<?php echo $j + 1; ?>" /> 544 <?php 548 545 } else { 549 546 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 550 547 $default_name = '[1]'; 551 ?> 552 553 <p><?php _e('Option', 'buddypress') ?> 1: <input type="text" name="<?php echo $type ?>_option[1]" id="<?php echo $type ?>_option1" /> 554 <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name; ?>" id="isDefault_<?php echo $type ?>_option" value="1" /> <?php _e( 'Default Value', 'buddypress' ) ?> 555 <input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="2" /> 556 557 <?php } /* end if */ ?> 558 <div id="<?php echo $type ?>_more"></div> 559 <p><a href="javascript:add_option('<?php echo $type ?>')"><?php _e('Add Another Option', 'buddypress') ?></a></p> 548 ?> 549 550 <p><?php _e( 'Option', 'buddypress' ); ?> 1: <input type="text" name="<?php echo $type; ?>_option[1]" id="<?php echo $type; ?>_option1" /> 551 <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo $type; ?>_option<?php echo $default_name; ?>" id="isDefault_<?php echo $type; ?>_option" value="1" /> <?php _e( 'Default Value', 'buddypress' ); ?> 552 <input type="hidden" name="<?php echo $type; ?>_option_number" id="<?php echo $type; ?>_option_number" value="2" /> 553 554 <?php } /* end if */ ?> 555 556 <div id="<?php echo $type; ?>_more"></div> 557 <p><a href="javascript:add_option('<?php echo $type; ?>')"><?php _e('Add Another Option', 'buddypress'); ?></a></p> 560 558 </div> 561 559 … … 565 563 function render_admin_form( $message = '' ) { 566 564 if ( !$this->id ) { 567 $title = __( 'Add Field', 'buddypress');565 $title = __( 'Add Field', 'buddypress' ); 568 566 $action = "admin.php?page=bp-profile-setup&group_id=" . $this->group_id . "&mode=add_field"; 569 567 … … 574 572 $this->order_by = $_POST["sort_order_{$this->type}"]; 575 573 } else { 576 $title = __( 'Edit Field', 'buddypress');574 $title = __( 'Edit Field', 'buddypress' ); 577 575 $action = "admin.php?page=bp-profile-setup&mode=edit_field&group_id=" . $this->group_id . "&field_id=" . $this->id; 578 576 } … … 580 578 581 579 <div class="wrap"> 582 583 580 <h2><?php echo $title; ?></h2> 584 <br /> 585 586 <?php 581 <?php 587 582 if ( $message != '' ) { 588 ?> 583 ?> 584 589 585 <div id="message" class="error fade"> 590 586 <p><?php echo $message; ?></p> 591 587 </div> 592 <?php } ?>593 594 <form action="<?php echo $action ?>" method="post">588 <?php } ?> 589 590 <form action="<?php echo $action; ?>" method="post"> 595 591 <div id="poststuff"> 596 592 <div id="titlediv"> 597 <h3><label for="title"><?php _e( "Field Title", 'buddypress')?> *</label></h3>593 <h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3> 598 594 <div id="titlewrap"> 599 <input type="text" name="title" id="title" value="<?php echo attribute_escape( $this->name ) ?>" style="width:50%" />595 <input type="text" name="title" id="title" value="<?php echo attribute_escape( $this->name ); ?>" style="width:50%" /> 600 596 </div> 601 597 </div> 602 598 603 599 <div id="titlediv" class="inside"> 604 <h3><label for="description"><?php _e("Field Description", 'buddypress') ?></label></h3>600 <h3><label for="description"><?php _e("Field Description", 'buddypress'); ?></label></h3> 605 601 <div id="titlewrap"> 606 602 <textarea name="description" id="description" rows="8" cols="60"><?php echo htmlspecialchars( $this->description ); ?></textarea> … … 609 605 610 606 <div id="titlediv"> 611 <h3><label for="required"><?php _e( "Is This Field Required?", 'buddypress')?> *</label></h3>607 <h3><label for="required"><?php _e( "Is This Field Required?", 'buddypress' ); ?> *</label></h3> 612 608 <select name="required" id="required" style="width: 30%"> 613 <option value="0"<?php if ( $this->is_required == '0' ) { ?> selected="selected"<?php } ?>><?php _e( 'Not Required', 'buddypress' ) ?></option>614 <option value="1"<?php if ( $this->is_required == '1' ) { ?> selected="selected"<?php } ?>><?php _e( 'Required', 'buddypress' ) ?></option>609 <option value="0"<?php if ( $this->is_required == '0' ) { ?> selected="selected"<?php } ?>><?php _e( 'Not Required', 'buddypress' ); ?></option> 610 <option value="1"<?php if ( $this->is_required == '1' ) { ?> selected="selected"<?php } ?>><?php _e( 'Required', 'buddypress' ); ?></option> 615 611 </select> 616 612 </div> 617 613 618 614 <div id="titlediv"> 619 <h3><label for="fieldtype"><?php _e("Field Type", 'buddypress') ?> *</label></h3>615 <h3><label for="fieldtype"><?php _e("Field Type", 'buddypress'); ?> *</label></h3> 620 616 <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%"> 621 <option value="textbox"<?php if ( $this->type == 'textbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Text Box', 'buddypress' ) ?></option>622 <option value="textarea"<?php if ( $this->type == 'textarea' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi-line Text Box', 'buddypress' ) ?></option>623 <option value="datebox"<?php if ( $this->type == 'datebox' ) {?> selected="selected"<?php } ?>><?php _e( 'Date Selector', 'buddypress' ) ?></option>624 <option value="radio"<?php if ( $this->type == 'radio' ) {?> selected="selected"<?php } ?>><?php _e( 'Radio Buttons', 'buddypress' ) ?></option>625 <option value="selectbox"<?php if ( $this->type == 'selectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Drop Down Select Box', 'buddypress' ) ?></option>626 <option value="multiselectbox"<?php if ( $this->type == 'multiselectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi Select Box', 'buddypress' ) ?></option>627 <option value="checkbox"<?php if ( $this->type == 'checkbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Checkboxes', 'buddypress' ) ?></option>617 <option value="textbox"<?php if ( $this->type == 'textbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Text Box', 'buddypress' ); ?></option> 618 <option value="textarea"<?php if ( $this->type == 'textarea' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi-line Text Box', 'buddypress' ); ?></option> 619 <option value="datebox"<?php if ( $this->type == 'datebox' ) {?> selected="selected"<?php } ?>><?php _e( 'Date Selector', 'buddypress' ); ?></option> 620 <option value="radio"<?php if ( $this->type == 'radio' ) {?> selected="selected"<?php } ?>><?php _e( 'Radio Buttons', 'buddypress' ); ?></option> 621 <option value="selectbox"<?php if ( $this->type == 'selectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Drop Down Select Box', 'buddypress' ); ?></option> 622 <option value="multiselectbox"<?php if ( $this->type == 'multiselectbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Multi Select Box', 'buddypress' ); ?></option> 623 <option value="checkbox"<?php if ( $this->type == 'checkbox' ) {?> selected="selected"<?php } ?>><?php _e( 'Checkboxes', 'buddypress' ); ?></option> 628 624 </select> 629 625 </div> 630 626 631 <?php $this->render_admin_form_children() ?>627 <?php $this->render_admin_form_children(); ?> 632 628 633 629 <p class="submit"> 634 <input type="submit" value="<?php _e( "Save", 'buddypress')?> →" name="saveField" id="saveField" style="font-weight: bold" />635 <?php _e( 'or', 'buddypress') ?> <a href="admin.php?page=bp-profile-setup" style="color: red"><?php _e( 'Cancel', 'buddypress' )?></a>630 <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?> →" name="saveField" id="saveField" style="font-weight: bold" /> 631 <?php _e( 'or', 'buddypress' ); ?> <a href="admin.php?page=bp-profile-setup" style="color: red"><?php _e( 'Cancel', 'buddypress' ); ?></a> 636 632 </p> 637 633 … … 655 651 $message = __( 'Please make sure you fill out all required fields.', 'buddypress' ); 656 652 return false; 657 } else if ( empty( $_POST['field_file']) && $_POST['fieldtype'] == 'radio' && empty($_POST['radio_option'][1]) ) {653 } else if ( empty( $_POST['field_file'] ) && $_POST['fieldtype'] == 'radio' && empty( $_POST['radio_option'][1] ) ) { 658 654 $message = __( 'Radio button field types require at least one option. Please add options below.', 'buddypress' ); 659 655 return false; 660 } else if ( empty( $_POST['field_file']) && $_POST['fieldtype'] == 'selectbox' && empty($_POST['selectbox_option'][1]) ) {656 } else if ( empty( $_POST['field_file'] ) && $_POST['fieldtype'] == 'selectbox' && empty( $_POST['selectbox_option'][1] ) ) { 661 657 $message = __( 'Select box field types require at least one option. Please add options below.', 'buddypress' ); 662 658 return false; 663 } else if ( empty( $_POST['field_file']) && $_POST['fieldtype'] == 'multiselectbox' && empty($_POST['multiselectbox_option'][1]) ) {659 } else if ( empty( $_POST['field_file'] ) && $_POST['fieldtype'] == 'multiselectbox' && empty( $_POST['multiselectbox_option'][1] ) ) { 664 660 $message = __( 'Select box field types require at least one option. Please add options below.', 'buddypress' ); 665 661 return false; 666 } else if ( empty( $_POST['field_file']) && $_POST['fieldtype'] == 'checkbox' && empty($_POST['checkbox_option'][1]) ) {662 } else if ( empty( $_POST['field_file'] ) && $_POST['fieldtype'] == 'checkbox' && empty( $_POST['checkbox_option'][1] ) ) { 667 663 $message = __( 'Checkbox field types require at least one option. Please add options below.', 'buddypress' ); 668 664 return false; … … 692 688 693 689 if ( $profiledata = $wpdb->get_row( $sql ) ) { 694 $this->id = $profiledata->id;695 $this->user_id = $profiledata->user_id;696 $this->field_id = $profiledata->field_id;697 $this->value = stripslashes($profiledata->value);698 $this->last_updated = $profiledata->last_updated;690 $this->id = $profiledata->id; 691 $this->user_id = $profiledata->user_id; 692 $this->field_id = $profiledata->field_id; 693 $this->value = stripslashes( $profiledata->value ); 694 $this->last_updated = $profiledata->last_updated; 699 695 } 700 696 } … … 727 723 global $wpdb, $bp; 728 724 729 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id );730 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id );731 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id );732 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id );725 $this->user_id = apply_filters( 'xprofile_data_user_id_before_save', $this->user_id, $this->id ); 726 $this->field_id = apply_filters( 'xprofile_data_field_id_before_save', $this->field_id, $this->id ); 727 $this->value = apply_filters( 'xprofile_data_value_before_save', $this->value, $this->id ); 728 $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', date( 'Y-m-d H:i:s' ), $this->id ); 733 729 734 730 do_action( 'xprofile_data_before_save', $this ); … … 778 774 779 775 if ( $results ) { 780 $profile_data['user_login'] = $results[0]->user_login;781 $profile_data['user_nicename'] = $results[0]->user_nicename;782 $profile_data['user_email'] = $results[0]->user_email;776 $profile_data['user_login'] = $results[0]->user_login; 777 $profile_data['user_nicename'] = $results[0]->user_nicename; 778 $profile_data['user_email'] = $results[0]->user_email; 783 779 784 780 foreach( (array) $results as $field ) { 785 781 $profile_data[$field->field_name] = array( 786 'field_group_id' => $field->field_group_id,787 'field_group_name' => $field->field_group_name,788 'field_id' => $field->field_id,789 'field_type' => $field->field_type,790 'field_data' => $field->field_data782 'field_group_id' => $field->field_group_id, 783 'field_group_name' => $field->field_group_name, 784 'field_id' => $field->field_id, 785 'field_type' => $field->field_type, 786 'field_data' => $field->field_data 791 787 ); 792 788 } … … 806 802 807 803 if ( is_array( $user_ids ) ) { 808 $user_ids = implode( ',', (array) $user_ids );804 $user_ids = implode( ',', (array) $user_ids ); 809 805 $data = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id IN ({$user_ids})", $field_id ) ); 810 806 } else { … … 829 825 $field_sql = ''; 830 826 831 if ( is_array( $fields) ) {832 for ( $i = 0; $i < count( $fields); $i++ ) {827 if ( is_array( $fields ) ) { 828 for ( $i = 0; $i < count( $fields ); $i++ ) { 833 829 if ( $i == 0 ) 834 830 $field_sql .= $wpdb->prepare( "AND ( f.name = %s ", $fields[$i] ); … … 852 848 for ( $i = 0; $i < count( $values ); $i++ ) { 853 849 for ( $j = 0; $j < count( $fields ); $j++ ) { 854 if ( $values[$i]->name == $fields[$j] ) {850 if ( $values[$i]->name == $fields[$j] ) 855 851 $new_values[$fields[$j]] = $values[$i]->value; 856 } else if ( !array_key_exists( $fields[$j], $new_values ) ) {852 else if ( !array_key_exists( $fields[$j], $new_values ) ) 857 853 $new_values[$fields[$j]] = NULL; 858 }859 854 } 860 855 } -
trunk/bp-xprofile/bp-xprofile-filters.php
r2576 r2810 43 43 44 44 function xprofile_filter_format_field_value( $field_value, $field_type = '' ) { 45 if ( !isset( $field_value) || empty( $field_value ) )45 if ( !isset( $field_value ) || empty( $field_value ) ) 46 46 return false; 47 47 48 if ( 'datebox' == $field_type ) {48 if ( 'datebox' == $field_type ) 49 49 $field_value = bp_format_time( $field_value, true ); 50 } else {50 else 51 51 $field_value = str_replace(']]>', ']]>', $field_value ); 52 }53 52 54 53 return stripslashes( stripslashes( $field_value ) ); … … 65 64 66 65 if ( $values ) { 67 foreach ( (array) $values as $value ) {66 foreach ( (array) $values as $value ) { 68 67 $value = trim( $value ); 69 68 … … 96 95 if ( $fullnames = BP_XProfile_ProfileData::get_value_byid( 1, $user_ids ) ) { 97 96 foreach( (array)$fullnames as $user ) { 98 $users[$user->user_id] = trim( $user->value);97 $users[$user->user_id] = trim( $user->value ); 99 98 } 100 99 } -
trunk/bp-xprofile/bp-xprofile-templatetags.php
r2798 r2810 21 21 function bp_xprofile_data_template( $user_id, $profile_group_id ) { 22 22 $this->groups = BP_XProfile_Group::get( array( 23 'profile_group_id' => $profile_group_id,24 'user_id' => $user_id,25 'hide_empty_groups' => true,26 'fetch_fields' => true,27 'fetch_field_data' => true23 'profile_group_id' => $profile_group_id, 24 'user_id' => $user_id, 25 'hide_empty_groups' => true, 26 'fetch_fields' => true, 27 'fetch_field_data' => true 28 28 ) ); 29 29 30 $this->group_count = count( $this->groups);30 $this->group_count = count( $this->groups ); 31 31 $this->user_id = $user_id; 32 32 } … … 51 51 function rewind_groups() { 52 52 $this->current_group = -1; 53 if ( $this->group_count > 0 ) { 53 54 if ( $this->group_count > 0 ) 54 55 $this->group = $this->groups[0]; 55 }56 56 } 57 57 … … 60 60 return true; 61 61 } elseif ( $this->current_group + 1 == $this->group_count ) { 62 do_action( 'xprofile_template_loop_end');62 do_action( 'xprofile_template_loop_end' ); 63 63 /* Do some cleaning up after the loop */ 64 64 $this->rewind_groups(); … … 76 76 77 77 if ( 0 == $this->current_group ) /* loop has just started */ 78 do_action( 'xprofile_template_loop_start');78 do_action( 'xprofile_template_loop_start' ); 79 79 } 80 80 … … 90 90 function rewind_fields() { 91 91 $this->current_field = -1; 92 if ( $this->field_count > 0 ) { 92 93 if ( $this->field_count > 0 ) 93 94 $this->field = $this->group->fields[0]; 94 }95 95 } 96 96 … … 101 101 $field = &$this->group->fields[$i]; 102 102 103 if ( $field->data->value != null ) {103 if ( $field->data->value != null ) 104 104 $has_data = true; 105 }106 105 } 107 106 … … 113 112 114 113 function profile_fields() { 115 if ( $this->current_field + 1 < $this->field_count ) {114 if ( $this->current_field + 1 < $this->field_count ) 116 115 return true; 117 } elseif ( $this->current_field + 1 == $this->field_count ) { 118 /* Do some cleaning up after the loop */ 116 117 /* Do some cleaning up after the loop */ 118 elseif ( $this->current_field + 1 == $this->field_count ) 119 119 $this->rewind_fields(); 120 }121 120 122 121 return false; … … 128 127 $field = $this->next_field(); 129 128 130 if ( !empty( $field->data->value ) ) {129 if ( !empty( $field->data->value ) ) 131 130 $this->field_has_data = true; 132 } 133 else { 131 else 134 132 $this->field_has_data = false; 135 }136 133 } 137 134 } … … 257 254 global $group; 258 255 259 foreach ( (array) $group->fields as $field ) 256 foreach ( (array) $group->fields as $field ) { 260 257 $field_ids .= $field->id . ','; 258 } 261 259 262 260 return substr( $field_ids, 0, -1 ); … … 372 370 $html .= '<option value="">--------</option>'; 373 371 374 for ( $k = 0; $k < count( $options); $k++ ) {375 $option_value = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id);372 for ( $k = 0; $k < count( $options ); $k++ ) { 373 $option_value = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ); 376 374 377 375 /* Check for updated posted values, but errors preventing them from being saved first time */ … … 381 379 } 382 380 383 if ( $option_value == $options[$k]->name || $options[$k]->is_default_option ) {381 if ( $option_value == $options[$k]->name || $options[$k]->is_default_option ) 384 382 $selected = ' selected="selected"'; 385 } else {383 else 386 384 $selected = ''; 387 }388 385 389 386 $html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . attribute_escape( $options[$k]->name ) . '">' . attribute_escape( $options[$k]->name ) . '</option>', $options[$k] ); … … 394 391 $html = '<div id="field_' . $field->id . '">'; 395 392 396 for ( $k = 0; $k < count( $options); $k++ ) {397 $option_value = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id);393 for ( $k = 0; $k < count( $options ); $k++ ) { 394 $option_value = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ); 398 395 399 396 /* Check for updated posted values, but errors preventing them from being saved first time */ … … 403 400 } 404 401 405 if ( $option_value == $options[$k]->name || $value == $options[$k]->name || $options[$k]->is_default_option ) {402 if ( $option_value == $options[$k]->name || $value == $options[$k]->name || $options[$k]->is_default_option ) 406 403 $selected = ' checked="checked"'; 407 } else {404 else 408 405 $selected = ''; 409 }410 406 411 407 $html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . attribute_escape( $options[$k]->name ) . '"> ' . attribute_escape( $options[$k]->name ) . '</label>', $options[$k] ); … … 416 412 417 413 case 'checkbox': 418 $option_values = BP_XProfile_ProfileData::get_value_byid( $options[0]->parent_id);414 $option_values = BP_XProfile_ProfileData::get_value_byid( $options[0]->parent_id ); 419 415 420 416 /* Check for updated posted values, but errors preventing them from being saved first time */ … … 424 420 } 425 421 426 $option_values = maybe_unserialize( $option_values);427 428 for ( $k = 0; $k < count( $options); $k++ ) {429 for ( $j = 0; $j < count( $option_values); $j++ ) {422 $option_values = maybe_unserialize( $option_values ); 423 424 for ( $k = 0; $k < count( $options ); $k++ ) { 425 for ( $j = 0; $j < count( $option_values ); $j++ ) { 430 426 if ( $option_values[$j] == $options[$k]->name || @in_array( $options[$k]->name, $value ) || $options[$k]->is_default_option ) { 431 427 $selected = ' checked="checked"'; … … 442 438 443 439 if ( !empty( $field->data->value ) ) { 444 $day = date("j", $field->data->value);445 $month = date("F", $field->data->value);446 $year = date("Y", $field->data->value);447 $default_select = ' selected="selected"';440 $day = date("j", $field->data->value); 441 $month = date("F", $field->data->value); 442 $year = date("Y", $field->data->value); 443 $default_select = ' selected="selected"'; 448 444 } 449 445 … … 469 465 470 466 for ( $i = 1; $i < 32; $i++ ) { 471 if ( $day == $i ) {467 if ( $day == $i ) 472 468 $selected = ' selected = "selected"'; 473 } else {469 else 474 470 $selected = ''; 475 } 471 476 472 $html .= '<option value="' . $i .'"' . $selected . '>' . $i . '</option>'; 477 473 } … … 490 486 491 487 for ( $i = 0; $i < 12; $i++ ) { 492 if ( $month == $eng_months[$i] ) {488 if ( $month == $eng_months[$i] ) 493 489 $selected = ' selected = "selected"'; 494 } else {490 else 495 491 $selected = ''; 496 }497 492 498 493 $html .= '<option value="' . $eng_months[$i] . '"' . $selected . '>' . $months[$i] . '</option>'; … … 504 499 505 500 for ( $i = date( 'Y', time() ); $i > 1899; $i-- ) { 506 if ( $year == $i ) {501 if ( $year == $i ) 507 502 $selected = ' selected = "selected"'; 508 } else {503 else 509 504 $selected = ''; 510 }511 505 512 506 $html .= '<option value="' . $i .'"' . $selected . '>' . $i . '</option>'; … … 529 523 global $field; 530 524 531 return apply_filters( 'bp_get_the_profile_field_is_required', (int) $field->is_required );525 return apply_filters( 'bp_get_the_profile_field_is_required', (int) $field->is_required ); 532 526 } 533 527 534 528 function bp_unserialize_profile_field( $value ) { 535 if ( is_serialized( $value) ) {536 $field_value = maybe_unserialize( $value);529 if ( is_serialized( $value ) ) { 530 $field_value = maybe_unserialize( $value ); 537 531 $field_value = implode( ', ', $field_value ); 538 532 return $field_value; … … 547 541 function bp_get_profile_field_data( $args = '' ) { 548 542 $defaults = array( 549 'field' => false, /* Field name or ID. */550 'user_id' => $bp->displayed_user->id543 'field' => false, /* Field name or ID. */ 544 'user_id' => $bp->displayed_user->id 551 545 ); 552 546 … … 568 562 $group_name = bp_profile_group_name(false); 569 563 570 for ( $i = 0; $i < count( $groups); $i++ ) {571 if ( $group_name == $groups[$i]->name ) {564 for ( $i = 0; $i < count( $groups ); $i++ ) { 565 if ( $group_name == $groups[$i]->name ) 572 566 $selected = ' class="current"'; 573 } else {567 else 574 568 $selected = ''; 575 }576 569 577 570 if ( $groups[$i]->fields ) … … 591 584 592 585 if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { 593 $group = new BP_XProfile_Group( $group_id);586 $group = new BP_XProfile_Group( $group_id ); 594 587 wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' ); 595 588 } 596 589 597 if ( !$deprecated ) {590 if ( !$deprecated ) 598 591 return bp_get_profile_group_name(); 599 } else {592 else 600 593 echo bp_get_profile_group_name(); 601 }602 594 } 603 595 function bp_get_profile_group_name() { … … 610 602 611 603 if ( !$group = wp_cache_get( 'xprofile_group_' . $group_id, 'bp' ) ) { 612 $group = new BP_XProfile_Group( $group_id);604 $group = new BP_XProfile_Group( $group_id ); 613 605 wp_cache_set( 'xprofile_group_' . $group_id, $group, 'bp' ); 614 606 } … … 631 623 $last_updated = bp_get_profile_last_updated(); 632 624 633 if ( !$last_updated ) {625 if ( !$last_updated ) 634 626 _e( 'Profile not recently updated', 'buddypress' ) . '.'; 635 } else {627 else 636 628 echo $last_updated; 637 }638 629 } 639 630 function bp_get_profile_last_updated() { … … 680 671 global $bp; 681 672 682 ?> 673 ?> 674 683 675 <div class="generic-button"> 684 <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ) ?>" href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit"><?php _e( 'Edit Profile', 'buddypress' )?></a>676 <a class="edit" title="<?php _e( 'Edit Profile', 'buddypress' ); ?>" href="<?php echo $bp->displayed_user->domain . $bp->profile->slug ?>/edit"><?php _e( 'Edit Profile', 'buddypress' ); ?></a> 685 677 </div> 686 <?php 687 } 688 678 <?php 679 } 689 680 690 681 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)