ericfaure
Forum Replies Created
-
OK ! Merci de votre réponse.
Bonjour,
Merci de votre réponse. C’est le filtre qui me manquait.
Cordialement,
EFForum: Plugins
In reply to: [BuddyDrive] Filename and file type not recognized after upload, renamed f–*Hello Blub69,
Try to put this code in your bp-custom.php or in your function.php
This function normally names the file with its extension. Useful for differentiating files. Only valid for new files, it does not rename old ones.
See you soonif( function_exists ( 'buddydrive' ) ) { remove_action( 'wp_ajax_buddydrive_upload', 'buddydrive_upload_file' ); function cust_buddydrive_upload_file() { $is_html4 = false; if ( ! empty( $_POST['html4' ] ) ) { $is_html4 = true; } if ( empty( $_POST['bp_params'] ) && buddydrive_use_deprecated_ui() ) { buddydrive_save_new_buddyfile(); return; } check_admin_referer( 'bp-uploader' ); $bp_params = (array) $_POST['bp_params' ]; if ( empty( $bp_params['item_id'] ) ) { bp_attachments_json_response( false, $is_html4 ); } if ( ! is_user_logged_in() || ( (int) bp_loggedin_user_id() !== (int) $bp_params['item_id'] && ! bp_current_user_can( 'bp_moderate' ) ) ) { bp_attachments_json_response( false, $is_html4 ); } $bd_file = buddydrive_upload_item( $_FILES, $bp_params['item_id'] ); if ( ! empty( $bd_file['error'] ) ) { bp_attachments_json_response( false, $is_html4, array( 'type' => 'upload_error', 'message' => $bd_file['error'], ) ); } $name_parts = pathinfo( $bd_file['file'] ); $url = $bd_file['url']; $mime = $bd_file['type']; $file = $bd_file['file']; $title = $name_parts['basename']; $privacy = buddydrive_get_default_privacy(); $groups = array(); $parent_folder_id = 0; if ( ! empty( $bp_params['parent_folder_id'] ) ) { $parent_folder_id = (int) $bp_params['parent_folder_id']; } if ( ! empty( $bp_params['privacy'] ) ) { $privacy = $bp_params['privacy']; if ( ! empty( $bp_params['privacy_item_id'] ) && 'groups' === $privacy ) { $groups = (array) $bp_params['privacy_item_id']; } } $buddyfile_id = buddydrive_add_item( array( 'user_id' => $bp_params['item_id'], 'type' => buddydrive_get_file_post_type(), 'guid' => $url, 'title' => $title, 'mime_type' => $mime, 'privacy' => $privacy, 'groups' => $groups, 'parent_folder_id' => $parent_folder_id, ) ); if ( empty( $buddyfile_id ) ) { bp_attachments_json_response( false, $is_html4, array( 'type' => 'upload_error', 'message' => __( 'Error while creating the file, sorry.', 'buddydrive' ), ) ); } else { if ( 'public' === $privacy ) { buddydrive_set_thumbnail( $buddyfile_id, $bd_file ); } } $response = buddydrive_prepare_for_js( $buddyfile_id ); $response['buddydrive_id'] = $response['id']; $response['url'] = $response['link']; $response['uploaded'] = true; unset( $response['id'] ); bp_attachments_json_response( true, $is_html4, $response ); } add_action( 'wp_ajax_buddydrive_upload', 'cust_buddydrive_upload_file' ); }Forum: Plugins
In reply to: [BuddyDrive] Filename and file type not recognized after upload, renamed f–*Hello blub69,
Here is my config .ovhconfig :app.engine=php
app.engine.version=7.0
http.firewall=security
environment=production
container.image=stableMy .ovhconfig file is at the root of the site – my wordpress folder is in the www folder.
Can you check on the ftp if your files are correctly named? chmod 755 on buddydrive folder. If so, maybe check the .htaccess too.
I do not know how to help you, I am a beginner.
Good luck !
EricForum: Plugins
In reply to: [BuddyDrive] How to display file types in BuddyDriveI use this solution in production and it works very well. I even found a way to display the icon of the file type instead of the default wordpress. See you soon. Eric
Hello mrpritchett,
I’m glad you’re back on the job.
Thank you for continuing to work on this great plugin.
See you soon
EricForum: Plugins
In reply to: [BuddyDrive] Not showing files after upload, loading sign is showing alwaysHi Kiran,
I tested the download of a file “Test” on your buddydrive. Everything works well for me !!Forum: Plugins
In reply to: [BuddyDrive] How to display file types in BuddyDriveHi,
I found the solution to the file name problem renamed f–x. HereI also found a solution to display the file extension. This happens in the file : “/wp-content/plugins/buddydrive/includes/buddydrive-item-ajax.php” at line 60.
$name_parts = pathinfo( $bd_file['file'] ); $url = $bd_file['url']; $mime = $bd_file['type']; $file = $bd_file['file']; $title = $name_parts['filename'];change to :
$title = $name_parts['basename'];Or add this code to your function.php file:
remove_action( 'wp_ajax_buddydrive_upload', 'buddydrive_upload_file' ); function cust_buddydrive_upload_file() { $is_html4 = false; if ( ! empty( $_POST['html4' ] ) ) { $is_html4 = true; } if ( empty( $_POST['bp_params'] ) && buddydrive_use_deprecated_ui() ) { buddydrive_save_new_buddyfile(); return; } check_admin_referer( 'bp-uploader' ); $bp_params = (array) $_POST['bp_params' ]; if ( empty( $bp_params['item_id'] ) ) { bp_attachments_json_response( false, $is_html4 ); } if ( ! is_user_logged_in() || ( (int) bp_loggedin_user_id() !== (int) $bp_params['item_id'] && ! bp_current_user_can( 'bp_moderate' ) ) ) { bp_attachments_json_response( false, $is_html4 ); } $bd_file = buddydrive_upload_item( $_FILES, $bp_params['item_id'] ); if ( ! empty( $bd_file['error'] ) ) { bp_attachments_json_response( false, $is_html4, array( 'type' => 'upload_error', 'message' => $bd_file['error'], ) ); } $name_parts = pathinfo( $bd_file['file'] ); $url = $bd_file['url']; $mime = $bd_file['type']; $file = $bd_file['file']; $title = $name_parts['basename']; $privacy = buddydrive_get_default_privacy(); $groups = array(); $parent_folder_id = 0; if ( ! empty( $bp_params['parent_folder_id'] ) ) { $parent_folder_id = (int) $bp_params['parent_folder_id']; } if ( ! empty( $bp_params['privacy'] ) ) { $privacy = $bp_params['privacy']; if ( ! empty( $bp_params['privacy_item_id'] ) && 'groups' === $privacy ) { $groups = (array) $bp_params['privacy_item_id']; } } $buddyfile_id = buddydrive_add_item( array( 'user_id' => $bp_params['item_id'], 'type' => buddydrive_get_file_post_type(), 'guid' => $url, 'title' => $title, 'mime_type' => $mime, 'privacy' => $privacy, 'groups' => $groups, 'parent_folder_id' => $parent_folder_id, ) ); if ( empty( $buddyfile_id ) ) { bp_attachments_json_response( false, $is_html4, array( 'type' => 'upload_error', 'message' => __( 'Error while creating the file, sorry.', 'buddydrive' ), ) ); } else { if ( 'public' === $privacy ) { buddydrive_set_thumbnail( $buddyfile_id, $bd_file ); } } $response = buddydrive_prepare_for_js( $buddyfile_id ); $response['buddydrive_id'] = $response['id']; $response['url'] = $response['link']; $response['uploaded'] = true; unset( $response['id'] ); bp_attachments_json_response( true, $is_html4, $response ); } add_action( 'wp_ajax_buddydrive_upload', 'cust_buddydrive_upload_file' );There is certainly simpler, but I am not an expert. This change works for me. Tell me if this is correct.
Forum: Plugins
In reply to: [BuddyDrive] Under New ManagementHi @kariravantti,
could you please share how you have customized the plugin to show file extensions?
Thanks.Forum: Plugins
In reply to: [BuddyDrive] Filename and file type not recognized after upload, renamed f–*Hi,
I found the solution to the file name problem renamed f–x. My wordpress site is hosted on an OVH server. The “.ovhconfig” file was placed in the “www” directory. I moved it to the root and everything works without understanding why …! Look perhaps also on the side of the file “.htaccess” if there is no problem.Hi,
I found the solution to the file name problem renamed f–x. My wordpress site is hosted on an OVH server. The “.ovhconfig” file was placed in the “www” directory. I moved it to the root and everything works without understanding why …!Forum: Plugins
In reply to: [BuddyDrive] How to display file types in BuddyDriveForum: Plugins
In reply to: [BuddyDrive] Filename and file type not recognized after upload, renamed f–*Hello,
I have exactly the same problem. My buddypress, buddydrive, multi network and wordpress plugins are up to date. Buddydrive displays F – 1 instead of the file name and does not recognize the extension. @lebweb and @daworm23, did you find a solution? I feel that this forum is not very followed. is not it? Like @dopeboy, we would like the file type to be displayed as well. Thank you for following up.