New version of Sch.gr Commons plugin


We updated the plugin Sch.gr Commons https://wordpress.org/plugins/schgr-commons/  to work as it should with the recent HTTPS change of video.sch.gr 

The plugin adds oEmbed support in WordPress posts, pages and custom post types for videos, presentations etc from the https://video.sch.gr, mmpres.sch.gr sites of Greek Schools Network.
There are no settings. Simply, add the URL in your content editor.
Just paste the given “Απευθείας σύνδεσμος” link from the “Κοινοποίηση” section of a video from video.sch.gr into the content area and it will by transformed to oEmbed into your post, page or custom post type.

screenshot-3

Advertisements

Extend SiteOrigin slider with hide frames functionality


The SiteOrigin Widgets Bundle is one of my favorite plugins, not only because it has a bundle of widgets, but also because it is very extendable and allows other developers to customize and add more features to each widget. Moreover the guys of Siteorigin also provide a guide on how to extend the plugin (see https://siteorigin.com/docs/widgets-bundle/)

Recently I wanted to use the slider of the SiteOrigin Widgets Bundle but I also wanted to be able to  hide a frame or two – not deleted, which is the default option if you don’t want to display them anymore. Hiding and not deleting frames is a useful  feature when you have frames for  special occasions and don’t want to recreate them each time you need them.

The only thing needed is a checkbox “Hide this frame” into the frame’s tab, which then should be “be respected” by the rendering function of the slider, so the specific frame won’t be displayed.

hide_frame
The SiteOrigin slider widget’s settings with the “Hide this frame” functionality added.

So the addition of this extra functionality in the SiteOrigin slider turn out to be very easy.

All you have to do is to add the following code into your theme’s functions.php file

 

Add a sortable user Id column into WordPress Users table


Sometimes it is useful to find the user_id of each user you have in your WordPress site.  This is especially helpful if you have a multisite with a lots of users.  Something like this:

user_d

In order to have that kind of functionality,  you can add the following code in your theme’s functions.php.
If you have a multisite installation the ID column will be only displayed in the network users admin page and not in each subsite’s users admin table.

 

Override bp-signups view with pending users view from ‘new user approve’ plugin


Using BuddyPress and New user approve plugin is a bit confusing for the admin, cause the “pending” users link on top of  users table in admin page, points to BuddyPress pending users. But when the ‘New user approve’ plugin is activated, the pending users are shown in a different page.

In order to fix the link “Pending” displayed on top of the users table, the following filter is needed.

Add download funtionality to Royal PrettyPhoto plugin


A way to extend Royal prettyPhoto plugin to support download image functionality is via Javascript.

Just put the following lines into the functions.php of your theme file.

add_action('wp_footer','ls_prettyPhoto_Download');
/**
 * Adds download functionality to prettyPhoto plugin
 * @author lenasterg
 */
function ls_prettyPhoto_Download() {
 echo '<style>.pp_download{ background: #ccc; border-radius: 3px; height: 25px; padding: 4px;}</style>


jQuery(document).ready(function() {
 jQuery("a[rel^=\'prettyPhoto\']").prettyPhoto({
 changepicturecallback: function(){
 jQuery(".pp_social").append("");
 $getit= settings.image_markup.replace(/{path}/g,pp_images[set_position]);
 jQuery(".pp_pic_holder").find(\'.pp_details .pp_download_place\').html(\'Download\');
 }
 });
});
';
}

 

You can download the above code also from gist:

https://gist.github.com/lenasterg/3f46bf31a04321588d2bc2a01bb4b9be

Email to superadmin when a subsite has low available space


Since part of my job is to support a very, very large multisite (and multiuser) WordPress installation, I deal daily with user’s requests and problems.

One of the most frustrating things for them and me, is when the available space of their blog is low. They have to report it to our helpdesk and then wait till we increase it.

Since I couldn’t find a plugin which notice the network admin about low space in subblogs,  I wrote a simple function which does it.

The function sends an email to the network admin when the available space is less then 200MB. It runs every time the blog admin visits the control panel of his/her’s blog.
Just add the following code in your custom.php file.

/**
* Send email to super admin when the blog's available space is less than 200MB
*/
function ls_blog_space_mail() {
$space_left = round( get_upload_space_available() / 1024 / 1024 );
if ( $space_left < 200 ) {
$message = 'Site ' . get_site_url() . ' has only ' . $space_left . 'MB space left. '
. 'If you wish to expand the available space visit ' . network_admin_url( 'site-settings.php?id=' . get_current_blog_id() ) . ' and increase the "' . __( 'Site Upload Space Quota' ) . '."';
wp_mail( get_site_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ]. Low available space", $message );
}
}


if ( is_multisite() ) {
add_action( 'activity_box_end', 'ls_blog_space_mail' );
}

Or find it in github