• Am I able to upload a pdf file via the frontend and all visitors will see the pdf file on the page?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author nickboss

    (@nickboss)

    Hi, is it going to be only one file or there might be many?

    Regards

    Nickolas

    Thread Starter debdeb

    (@debdeb)

    It will probably be 1 file (multiple pages) but it will be changed from time to time

    Plugin Author nickboss

    (@nickboss)

    Hi, the following is an example script that will get the last file uploaded by the administrator (assumes that admin has user ID 1) and will present it to visitors as a link.

    Put it in functions.php file of your theme:

    if (!function_exists('wfu_file_upload_hide_output_handler')) {
    	function wfu_file_upload_hide_output_handler($echo_str) {
    		$recs = wfu_get_recs_of_user(1);
    		$url = "";
    		foreach ( $recs as $rec ) {
    			$path = wfu_path_rel2abs($rec->filepath);
    			$name = wfu_basename($path);
    			if ( strtolower(wfu_fileext($name)) == "pdf" ) $url = str_replace(ABSPATH, site_url()."/", $path);
    		}
    		if ( $url != "" ) $echo_str = '<a href="'.$url.'">'.wfu_basename($url).'</a>';
    		return $echo_str;
    	}
    	add_filter('_wfu_file_upload_hide_output', 'wfu_file_upload_hide_output_handler', 10, 1);
    }

    Regards

    Nickolas

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PDF uploader and viewer’ is closed to new replies.