peterhuckle
Forum Replies Created
-
Hi Aashil
Many thanks for your reply. The courses page works fine but it is the courses shortcode that doesn’t seem to respond to the settings.
Peter
As a comment to my earlier post. I have many course categories and want to display the courses for each of these without creating a page for each by using a querystring such as ?mycategory=xyz. I have made a php script which uses the do_shortcode wp function e.g. echo do_shortcode( ‘[masteriyo_courses category=”‘ . get_query_var(‘mycategory’) . ‘”]’ ); This works fine EXCEPT that the formatting problem reoccurs. All courses are in a single full page width column which diminishes in width for every course of a row. Any help would be appreciated!
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Connection to a SQL databaseThanks Tobias – yes it’s a really simple thing that I want to do, but just didn’t want to reinvent the wheel – many thanks for the suggestion – I’ll give it a go.
Best wishes
Peter
Forum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] Connection to a SQL databaseHi Tobias
I have the same need – I have a plugin that lets you vote for pictures in a gallery and I would love to be able to simply list, filter and sort the votes. As the votes come in all the time, it isn’t possible to copy the mysql table.
I’m currently giving the admin for the website access to phpMyAdmin but it’s really much too complicated for them to use on a day to day basis.
Best wishes
Peter
Forum: Plugins
In reply to: [Mmm Simple File List] Searching filenamesI’ve coded something up – a simple string search – it it worth sending to you?
Looking into the content of the google and bing rss feeds, images are http while the feed is https and feedzy says it doesn’t display these. If you type the http feed url from bing it forwards to an https address and shows fine. Can anybody suggest how to create a filter that will convert all http image address in the feed to https? Maybe this would solve the problem?
Forum: Themes and Templates
In reply to: [Bento] Sit not functioning anymoreI figured out that if I turn off ‘Display loading screen’ in ‘Customizing – preloader’ then all is well.
Forum: Themes and Templates
In reply to: [Bento] Sit not functioning anymoreI have this problem too – works fine in all browsers I’ve tried except Chrome. I have tried disabling plugins but it doesn’t seem to make any difference. Website is hokianga.com.
Here are the console errors being shown:
jquery-migrate.min.js?ver=1.4.1:2 JQMIGRATE: Migrate is installed, version 1.4.1
theme-scripts.js?ver=4.9.8:203 Uncaught TypeError: $bento_isocontainer.imagesLoaded is not a function
at HTMLDocument.<anonymous> (theme-scripts.js?ver=4.9.8:203)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)
theme-scripts.js?ver=4.9.8:294 Uncaught TypeError: $bento_isocontainer.isotope is not a function
at theme-scripts.js?ver=4.9.8:294
at dispatch (jquery.js?ver=1.12.4:3)
at r.handle (jquery.js?ver=1.12.4:3)
theme-scripts.js?ver=4.9.8:355 Uncaught TypeError: $bento_isocontainer.isotope is not a function
at theme-scripts.js?ver=4.9.8:355
at dispatch (jquery.js?ver=1.12.4:3)
at r.handle (jquery.js?ver=1.12.4:3)- This reply was modified 6 years, 3 months ago by peterhuckle.
Forum: Themes and Templates
In reply to: [Bento] Mobile full widthI have fixed the problem – setting the body width to 100% in the custom CSS seems to do it – I’ve no idea why it was assuming less that 100% though.
Forum: Themes and Templates
In reply to: [Bento] Maps HeadersMany thanks – your reply is appreciated.
Forum: Themes and Templates
In reply to: [Bento] Maps Headers… I forgot to add that I would also like the option of displaying no flags. At the moment the map center is always displayed as a flag.
Forum: Plugins
In reply to: [React Webcam] Direct Plugin to different FolderHi
I think the page refreshes but there is a new image file. I have been struggling to both stop the file system filling up with images and the refresh problem. The code below seems to work OK. I’m using a Wanscam webcam that creates a new image directory for each day, then creates a directory inside that called images into which the image files are ftp’d. I decided to add a new parameter to be able to specify the name of this subdirectory e.g. [reactwebcam refreshinterval=300 dir=wanscam imagedir=images] and then I find the latest image, clean up the old directories and images and copy the latest image to the webcam/dir directory with the name of the webcam and type of the original image. Hope this helps someone:
<?php
/*
Plugin Name: React Webcam
Version: 1.2.0
Author: Radek Matej
Description: Add auto-refreshing image from your webcam to any page.
*/namespace ReactWebcam;
const WEBCAM_DIR = ‘webcam’;
const SUBDIR_ATTNAME = ‘dir’;
const IMAGEDIR_ATTNAME = ‘imagedir’;
const REFRESHINT_ATTNAME = ‘refreshinterval’;
const REFRESHINT_DEFAULT = 60; // secondsfunction init($atts) {
$atts = shortcode_atts(array(
REFRESHINT_ATTNAME => REFRESHINT_DEFAULT,
SUBDIR_ATTNAME => NULL,
IMAGEDIR_ATTNAME => NULL
), $atts);wp_register_script(‘react’, plugins_url(‘js/vendor/react.min.js’, __FILE__));
wp_enqueue_script(‘ReactWebcam_ActualImage’, plugins_url(‘js/ActualImage.js’, __FILE__), array(‘react’));$upload_dir = wp_upload_dir();
$ajax_url = admin_url(‘admin-ajax.php’);
$images_root_url = $upload_dir[‘baseurl’] . ‘/’ . WEBCAM_DIR . ‘/’;
if ($atts[SUBDIR_ATTNAME]) {
$images_root_url .= $atts[SUBDIR_ATTNAME] . ‘/’;
}
$initial_image_filename = get_last_filename($atts[SUBDIR_ATTNAME],$atts[IMAGEDIR_ATTNAME]);return ‘<div class=”react-webcam”
data-ajax-url=”‘ . $ajax_url . ‘”
data-images-root-url=”‘ . $images_root_url . ‘”
data-subdir=”‘ . $atts[SUBDIR_ATTNAME] . ‘”
data-imagedir=”‘ . $atts[IMAGEDIR_ATTNAME] . ‘”
data-initial-image-filename=”‘ . $initial_image_filename . ‘”
data-refresh-interval=”‘ . $atts[REFRESHINT_ATTNAME] . ‘”>
</div>’;};
/*
Returns filename of the last webcam image. Modified by Peter Huckle this routine looks in the WordPress uploads directory for the webcam directory and inside this for subdirectories sorted by name, the last one is assumed to be the latest. It cleans up the webcam directory by deleting all but the latest subdirectory. It then looks into this latest subdirectory and deletes all but the latest image file which is then copied to the webcam directory and renamed with the name of this directory. This is to ensure that on auto display page refresh an image is always displayed.
*/
function get_last_filename($subdir,$imagedir) {
$upload_dir = wp_upload_dir();
$webcam_dir = $upload_dir[‘basedir’] . ‘/’ . WEBCAM_DIR . ‘/’;if ($subdir && preg_match(‘/[a-z0-9]/i’, $subdir)) {
$webcam_dir .= $subdir . ‘/’;
}$dirs = glob($webcam_dir . “/*”, GLOB_ONLYDIR);
if (count($dirs)){
foreach ($dirs as $path) {
$last_path = $path;
}
$webcam_foundsubdir = basename($last_path);
foreach ($dirs as $path) {
if ($path <> $last_path){
rrmdir($path);
}
}
}
if ($imagedir && preg_match(‘/[a-z0-9]/i’, $imagedir)) {
$webcam_foundsubdir .= “/” . $imagedir;
}$files = glob($webcam_dir . “/” . $webcam_foundsubdir . “/*”);
if (count($files)){
foreach ($files as $file) {
if (is_file($file) && $array = getimagesize($file)){
$last_file = $file;
}
}
foreach ($files as $file) {
if (is_file($file)){
if ($file <> $last_file){
unlink($file);
}
}
}
$show_image_type = pathinfo($last_file, PATHINFO_EXTENSION);
if ($subdir) {
$show_image_name = $subdir . “.” . $show_image_type;
} else {
$show_image_name = WEBCAM_DIR . “.” . $show_image_type;
}
copy($last_file, $webcam_dir . $show_image_name);
return $show_image_name;
} else {
return “”;
}
}/*
Recursively remove directories
*/
function rrmdir($dir) {
foreach (glob($dir . ‘/*’) as $file) {
if (is_dir($file)){
rrmdir($file);
} else {
unlink($file);
}
}
rmdir($dir);
}/*
AJAX call handler to return last webcam image filename. $subdir is the directory inside webcamdir for use if you have multiple webcams. $imagedir is the directory inside the found directories within webcam dir. For example, some Wanscam cameras allow you to specify a directory name for the storage for image uploads but then they insert into this directories – one for each day, and inside these a directory called images and inside that the images themselves. For example, the directory structure for webcam1 would be something like uploads/webcam/webcam1/2017/05/28/images/
*/function last_image() {
$subdir = $_GET[‘dir’];
$imagedir = $_GET[‘imagedir’];
echo get_last_filename($subdir,$imagedir);
wp_die();
}add_action(‘wp_ajax_last_image’, ‘ReactWebcam\last_image’);
add_action(‘wp_ajax_nopriv_last_image’, ‘ReactWebcam\last_image’);add_shortcode(‘reactwebcam’, ‘ReactWebcam\init’);
?>
Forum: Plugins
In reply to: [React Webcam] Overwrite time stamped image?Hi
I fixed with problem with a small change – see the unlink loop below. Hope that helps!
Peter
// Returns filename of the last webcam image.
function get_last_filename($subdir) {$upload_dir = wp_upload_dir();
$webcam_dir = $upload_dir[‘basedir’] . ‘/’ . WEBCAM_DIR . ‘/’;if ($subdir && preg_match(‘/[a-z0-9]/i’, $subdir)) {
$webcam_dir .= $subdir . ‘/’;
}foreach (array_filter(glob($webcam_dir . ‘*’), ‘is_file’) as $path) {
$last_filename = basename($path);
}
// Added code: Unlink all but latest image
foreach (array_filter(glob($webcam_dir . ‘*’), ‘is_file’) as $path) {
if ($last_filename <> basename($path)){
unlink($path);
}
}
// … end of added code
return $last_filename;};
Forum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] Feature RequestsI am worried that all invoices are publicly available. What I would like to do is to include payment buttons in the email that’s sent with a PDF attached invoice. Is that possible now or is it a feature request?