How to know what functions are hooked to an action/filter?

December 21, 2017

A very useful function if you need to know which functions are hooked to a particular hook and where the functions are located. Found in stackoverflow, answer of Danijel 

https://stackoverflow.com/a/26680808

 

Advertisements

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

December 11, 2017

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

June 15, 2017

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

December 2, 2016

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

January 5, 2016

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

December 9, 2015

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

July 24, 2015

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

July 24, 2015

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.

July 13, 2015

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

February 9, 2015

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 );

%d bloggers like this: