bp_document_rename_folder( int $folder_id, string $title = '', string $privacy = '' )
This function will rename the folder name.
Description
Parameters
- $folder_id
-
(Required)
- $title
-
(Optional)
Default value: ''
- $privacy
-
(Optional)
Default value: ''
Return
(bool|int)
Source
File: bp-document/bp-document-functions.php
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 | function bp_document_rename_folder( $folder_id = 0, $title = '' , $privacy = '' ) { global $wpdb , $bp ; if ( 0 === $folder_id && '' === $title ) { return false; } if ( (int) $folder_id > 0 ) { $has_access = bp_folder_user_can_edit( $folder_id ); if ( ! $has_access ) { return false; } } if ( strpbrk ( $title , "\\/?%*:|\"<>" ) !== false ) { return false; } $title = wp_strip_all_tags( $title ); $q = $wpdb ->query( $wpdb ->prepare( "UPDATE {$bp->document->table_name_folder} SET title = %s, date_modified = %s WHERE id = %d" , $title , bp_core_current_time(), $folder_id ) ); // db call ok; no-cache ok; bp_document_update_privacy( $folder_id , $privacy , 'folder' ); if ( false === $q ) { return false; } return $folder_id ; } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.