try this to see if preview will work, open the file mdocs-downloads.php and change this:
} elseif($is_google == false || $is_box_view == false) {
mdocs_errors(__('Something when wrong, and your download has failed.'), 'error');
}
to this
}
let me know what you see.
Thread Starter
George
(@trustgovernance)
When I navigate to the website I now get this error message:
Parse error: syntax error, unexpected ‘}’ in /home/geogra19/library.ssiwatersheds.ca/wp-content/plugins/memphis-documents-library/mdocs-downloads.php on line 64
change it back to the original
You must have deleted too many }
Thread Starter
George
(@trustgovernance)
I have done but am still getting a syntax error.
Here is the string . . .
} elseif(isset($_GET[“mdocs-file”])) {
$the_mdoc = get_the_mdoc_by($_GET[“mdocs-file”], ‘id’);
$is_allowed = mdocs_check_file_rights($the_mdoc, false);
$filename = $the_mdoc[‘filename’];
$file = $upload_dir[‘basedir’].’/mdocs/’.$filename;
} elseif($is_google == false || $is_box_view == false) {
mdocs_errors(__('Something when wrong, and your download has failed.'), 'error');
}
// COUNT THE DOWNLOAD
if($is_allowed && !isset($_GET[‘mdocs-export-file’]) && !isset($_GET[‘mdocs-version’]) && $is_box_view === false && $is_google === false) {
$mdocs[$the_mdoc[‘index’]][‘downloads’] = intval($mdocs[$the_mdoc[‘index’]][‘downloads’])+1;
mdocs_save_list($mdocs);
Everything looks fine, copy this:
// CHECK TYPE OF DOWNLOAD
if(isset($_GET['mdocs-export-file']) ) {
$is_allowed = mdocs_check_file_rights(null, false);
$filename = basename($_GET['mdocs-export-file']);
$file = sys_get_temp_dir().'/'.$filename;
} elseif(isset($_GET['mdocs-version']) ) {
$the_mdoc = get_the_mdoc_by(basename($_GET['mdocs-file']), 'id');
$is_allowed = mdocs_check_file_rights($the_mdoc, false);
$file = basename($_GET['mdocs-version']);
$filename = substr(basename($_GET['mdocs-version']), 0, strrpos(basename($_GET['mdocs-version']), '-'));
} elseif(isset($_GET["mdocs-file"])) {
$the_mdoc = get_the_mdoc_by($_GET["mdocs-file"], 'id');
$is_allowed = mdocs_check_file_rights($the_mdoc, false);
$filename = $the_mdoc['filename'];
$file = $upload_dir['basedir'].'/mdocs/'.$filename;
} elseif($is_google == false || $is_box_view == false) {
mdocs_errors(__('Something when wrong, and your download has failed.'), 'error');
}
if all else fails download mDocs and FTP into your site and overwrite the file.
Thread Starter
George
(@trustgovernance)
I overwrote the file and now have access to the site. The Preview problem remains. I Just uploaded a trial document to see if it was only existing files that were affected but new uploads also show the problem. I’ve very few other plugins and haven’t updated the theme lately so am at a loss as to how to resolve.
The error is occurring because for some reason the preview get trigger is not firing. There are a number of reasons that this could be happening and it can’t be narrowed down from this error.
More than likely it is a server configuration that is previewing the get request from firing.
Open a browser debugger an make sure you don’t see any javascript errors.
Thread Starter
George
(@trustgovernance)
The error console shows a couple items but no javascript errors.
‘Failed to load resource: the server responded with a status of 404 (HTTP/2.0 404) ‘
‘WebSocket connection to ‘wss://public-api.wordpress.com/plugin/wpcom/me/newest-note-date” failed: Unexpected response code: 403. ‘
What preview are you using google or box?
Thread Starter
George
(@trustgovernance)
Box are no longer accepting new sign ups to View API.
hmmm….
Can we test code again
let go back to this:
} elseif($is_google == false || $is_box_view == false) {
mdocs_errors(__('Something when wrong, and your download has failed.'), 'error');
}
and change it to this:
} elseif($is_google == false || $is_box_view == false) {
//mdocs_errors(__('Something when wrong, and your download has failed.'), 'error');
}
Thread Starter
George
(@trustgovernance)
That did the trick. Thank you.
Thread Starter
George
(@trustgovernance)
Should have marked this resolved.
so preview is working now?