Hook to upload userdatas to cloud
-
Hello,
I’d like to upload a text file with user datas to Google Drive.
A long time ago, Nickboss helped me to do the same with Dropbox and it worked fine.
I try to use following hook and the path were I want to place the txt file is (/mmm/%userdata1%/%userdata3%/%userdata2%/) I replaced “dropbox” by “gdrive” but unsure of the namesif (!function_exists('wfu_after_upload_handler')) { function wfu_after_upload_handler($changable_data, $additional_data) { $user = wp_get_current_user(); if ( $user->ID == 0 ) $username = "guest"; else $username = $user->user_login; $gdrivepath = "mmm/".$additional_data["files"][0]["user_data"][0]["value"]."/".$additional_data["files"][0]["user_data"][2]["value"]."/".$additional_data["files"][0]["user_data"][1]["value"]; $deletelocal = false; foreach ( $additional_data["files"] as $file ) { $fileext = wfu_fileext($file["filepath"], true); if ( $fileext == ".wav" ) { $txtpath = preg_replace("/\\$fileext$/", ".txt", $file["filepath"]); $contents = ""; foreach ( $file["user_data"] as $userdata ) $contents .= ( $contents == "" ? "" : "\r\n" ).$userdata["label"].": ".$userdata["value"]; file_put_contents($txtpath, $contents); $fileid = wfu_log_action('include', $txtpath, $user->ID, '', '', get_current_blog_id(), '', null); wfu_gdrive_add_file_to_queue($fileid, $txtpath, $gdrivepath, $deletelocal, "last"); } } return $changable_data; } add_filter('wfu_after_upload', 'wfu_after_upload_handler', 10, 2); }
Thanks for help
JL
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Hook to upload userdatas to cloud’ is closed to new replies.