How to alert network admin 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

Build it with scratch.mit.edu. Show it in your WordPress site


icon-256x256With Scratch (https://scratch.mit.edu/), you can program your own interactive stories, games, and animations – and share your creations with others in the online community. Scratch helps young people learn to think creatively, reason systematically, and work collaboratively – essential skills for life in the 21st century.

Now, with LS oEmbed support for Scratch Mit  you can just copy-paste the URL from a scratch project into the content area of a post or page
and it will by transformed to oEmbed.

This oEmbed functionality was initial build for the Greek Schools Network blogging platform (http://blogs.sch.gr) and now it is available for all via the WordPress repository in https://wordpress.org/plugins/ls-oembed-support-for-scratch-mit/

The plugin is a useful addon for educational WordPress sites.

WordPress 4.4 “Clifford” – Fully translated in more than 40 languages


At https://wordpress.org/news/2015/12/clifford/ you can read all the new features version 4.4. has to make your site more connected and responsive.

Also this version is already available in more than 40 languages (if you count all English “versions” too).

Among them is also the Greek version!!! I’m so proud to be part of the Greek translation team

Thanks to all teammates and our editors ♥ ♥ ♥

 

 

The Greek Schools’ Network goes (more) WordPress – Its 1st plugin is here


The Greek Schools’ Network (GSN – http://www.sch.gr) is the educational intranet of the Ministry of Education, which interlinks all Greek schools and provides high quality electronic services.

Among other services (such as blogging platforms), it allows teachers, schools to upload and share videos and slideshows using the http://vod-new.sch.gr and http://mmpres.sch.gr sites.

Now we go a step further.

Its 1st WordPress plugin Sch.gr Commons plugin. adds oEmbed support in WordPress posts, pages and custom post types for videos, presentations etc from the vod-new.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 vod-new.sch.gr into the content area and it will by transformed to oEmbed into your post, page or custom post type.

You can find the Sch.gr Commons into the WordPress.org repository https://wordpress.org/plugins/schgr-commons/

Copy the url from a vod-new.sch.gr video
Paste a simple url in post
The resulted embed video from vod-new.sch.gr into the post.

Embed SlideSnack presentation into your wordpress post with LS Snacktools plugin


SlideSnack.com is a great presentation sharing tool that enables you to easily upload and share presentations online.
But there was a small “gap” if you wanted to embed your presentation into a WordPress site. You had to use iframe.  NOT any more.

With the LS Snacktools plugin you can just copy-paste the given “Link to this post” from Slidesnack.com into the content area and it will by transformed to oEmbed into your post, page or custom post type.

You can find the LS Snacktools plugin in the WordPress.org repository: https://wordpress.org/plugins/ls-snacktools/

Ls Gtrans Widget: New simple widget with selectbox to Google translation for the current page.


Simple drag and drop the widget to allow your visitors to tranlate the viewed page in google tranlate. The plugin is created, due to security rescriction of wordpress. It simple displays a selectbox with more than 25 European languages. When a user selects a language a new window in http://translate.google.com/ opens.

  • The original language is autodetected.
  • Multisite ready.

Widget code available at: 

http://wordpress.org/plugins/ls-gtrans-widget/

 

Widget drag and drop
Widget in frontend

WP admin bar – How to hide/replace WordPress icon and blavatars – updated


At the left side of wp admin bar an wordpress icon “W” is shown.

When the user hover it, it lists some wordpress.org links.  Also in multisite installation a wordpress logo (called blavatar) is shown next to each blog name. Also if you have buddypress installed the same blavatar appears in the admin members stats metabox.

A simple way to hide those images or/and replace them with your site favicon is the following.

Just add the functions into your bp-custom.php (or custom.php) file the following:


/**
* Replace wordpress blavatar with site's favicon
*/
function ls_replace_blavatars() {
echo '<style>
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {content:" "!important;}
#wpadminbar .quicklinks li .blavatar:before {content:" "!important;}


#wp-admin-bar-wp-logo>.ab-item .ab-icon { background: url("/wp-content/favicon.ico") no-repeat;}
#wpadminbar .quicklinks li div.blavatar { background: url("/wp-content/favicon.ico") no-repeat;}
//for buddypress members stats metabox
div#community-profile-page li.bp-blogs-profile-stats:before {content:" "!important;}
div#community-profile-page li.bp-blogs-profile-stats {background: url("/wp-content/favicon.ico") no-repeat; padding-left:16px}
//end for buddypress stats metabox
}
add_action('admin_head', 'replace_blavatars');


/**
* Remove wordpress logo/pages from admin bar
* @global type $wp_admin_bar
*/
function ls_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu( 'wp-logo' );
}


add_action( 'wp_before_admin_bar_render', 'ls_admin_bar_remove', 0 );

Yet another plugin resurrection :-) BuddyPress Block Activity Stream Types for BP 2.x


Since I manage a very large BP community, I was in a need  of a plugin which reduces the data recorded in the bp_activity table, which stores all the Buddypress activity. A plugin that would  “block” an activity record from being saved to the stream/database. Activities like user joining groups, friendships and profile updates.

But the only plugin which does this was BuddyPress Block Activity Stream Types which was great, but is hasn’t been updated in over 2 years and so isn’t compatible with BP 2.x.

screenshot-1So, based on the ideas and footsteps of this plugin creators I made an updated version for Buddypress 2.x.🙂, which uses the Settings API of wordpress and adds a “Buddypress Block Activity Stream Types”  section into Buddypress Settings admin page.

The “resurrected” plugin code is currently available at  https://github.com/lenasterg/buddypress-block-activity-stream-types-ls 

 

 

 

 

 

Nav menus administration. Open all metaboxes by default


When you have a multisite installation, it is possible that the bloggers you host. have trouble to create menus for their blog.  The default behavior of wordPress in wp-admin/nav-menus.php is to have hidden the posts, tags and formats metaboxes, which make the process of finding the things they want to include in the navigation menus more difficult. The following snippet opens by default these metaboxes in wp-admin/nav-menus.php.

Just paste the following in your /plugins/custom.php or /plugins/bp-custom.php file.

https://gist.github.com/lenasterg/64989b9711273fbd9844