Skip to content

Instantly share code, notes, and snippets.

Bogdan Rapaić bogdan-mainwp

Block or report user

Report or block bogdan-mainwp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bogdan-mainwp
bogdan-mainwp / premium-plugin-updates.php
Last active Oct 30, 2019
Support for the Premium Plugin updates
View premium-plugin-updates.php
<?php
// Add the following code snippet to the PHP section of the MainWP Custom Dashboard Extension or the functions.php file of the active theme on your Dashboard site.
add_filter( 'mainwp_detect_premium_plugins_update', 'myhook_mainwp_detect_premium_plugins_update', 10 );
function myhook_mainwp_detect_premium_plugins_update( $premiums ) {
// add plugin info (slug) here. In this example, we used Elementor Extras, but you should replace it with the correct plugin info
$premiums[] = 'elementor-extras/elementor-extras.php';
return $premiums;
}
@bogdan-mainwp
bogdan-mainwp / hide-custom-branding.php
Created Oct 3, 2019
Hide custom branding for certain user
View hide-custom-branding.php
<?php
// Hide custom branidng for the user with specific ID
// Replace ID with actual ID number
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' );
function mycustom_mainwp_child_branding_init_options( $option ) {       
$current_user_id = get_current_user_id();       
if ( $current_user_id == 'ID' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {        
$option[ 'cancelled_branding' ] = true;    
@bogdan-mainwp
bogdan-mainwp / mainwp-client-reports-linebreak.php
Last active Oct 2, 2019
Custom code snippet for fixing the line break issue in reports.
View mainwp-client-reports-linebreak.php
<?php
// Add the following code snippet to the PHP section of the MainWP Custom Dashbaord Extension
add_filter( 'mainwp_client_reports_newline_break', 'mycustom_client_reports_newline_break', 10, 1 );
function mycustom_client_reports_newline_break( $value ){
return false;
}
@bogdan-mainwp
bogdan-mainwp / custom-report-pdf-paper-size.php
Last active Jun 17, 2019
Custom code snippet for setting the custom paper size for the client report PDF.
View custom-report-pdf-paper-size.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_client_report_pdf_page_format', 'mycustom_pdf_page_format', 10 , 1 );
function mycustom_pdf_page_format( $format = '' ) {
return 'A4';
}
@bogdan-mainwp
bogdan-mainwp / specific-time-for-emails.php
Last active Jun 17, 2019
Set specific time for email notifications about Trusted Updates
View specific-time-for-emails.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_updatescheck_sendmail_at_time', 'mycustom_mainwp_updatescheck_sendmail_at_time', 10, 1 );
function myhook_mainwp_updatescheck_sendmail_at_time( $hour ) {
$hour = '12:00'; // send email notifactions after 12:00
return $hour;
@bogdan-mainwp
bogdan-mainwp / add-sites.php
Created May 30, 2018
Custom filter for adding new sites to MainWP Dashboard
View add-sites.php
<?php
// Available parameters: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version, http_user, http_pass
$params = array(
'url' => 'demosite.com',
'name' => 'Site Friendly Name',
'wpadmin' => 'adminusername',
'unique_id' => 'unique_id'
);
@bogdan-mainwp
bogdan-mainwp / code-snippets-customizations.php
Created Mar 8, 2019
Custom code snippet to change code editor height and background color for the Code Snippets extension.
View code-snippets-customizations.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_codesnippets_editor_attr', 'myhook_mainwp_codesnippets_editor_attr', 10);
function myhook_mainwp_codesnippets_editor_attr( $data ) {
$data['height'] = 500;
// supported themes: 'erlang-dark', 'night', 'xq-dark', 'xq-light', 'the-matrix', 'eclipse'
@bogdan-mainwp
bogdan-mainwp / custom-client-reports-tokens.php
Last active Mar 6, 2019
Custom code snippet for creating custom tokens for the Client Reports Extension
View custom-client-reports-tokens.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
// Create Custom Client Report tokens
add_filter( 'mainwp_client_reports_tokens_groups', 'mycustom_reports_tokens_groups' );
function mycustom_reports_tokens_groups( $tokens ) {
// examples
@bogdan-mainwp
bogdan-mainwp / mainwp-wp-version.php
Last active Dec 6, 2018
Custom code snippet for creating a custom WP Version column in the Manage Sites table and displaying Child Site WP version for each child site.
View mainwp-wp-version.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
// WP Version example
add_filter( 'mainwp-sitestable-getcolumns', 'mycustom_sites_table_column', 10 );
add_filter( 'mainwp-sitestable-item', 'mycustom_sitestable_item', 10 );
View mainwp-disable-emails-about-auto-updates.php
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_updatescheck_disable_sendmail', 'mycustom_mainwp_updatescheck_disable_sendmail', 10, 1 );
function mycustom_mainwp_updatescheck_disable_sendmail( $input ) {
return true;
}
You can’t perform that action at this time.