This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* $restricted_level is the level ID that needs to be restricted to see BP profile fields | |
* .bp-widget.contact-details here .contact-details should be the class name of the profile group | |
*/ | |
add_action( 'wp_head', 'hide_bp_field' ); | |
function hide_bp_field() { | |
if( is_user_logged_in() ){ | |
$restricted_level = 1; | |
$current_user = wp_get_current_user(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Site Info | |
Plugin URI: http://premium.wpmudev.org/ | |
Description: Will shows information about all subsites | |
Version: 1.0.1 | |
Author: Ashok (Incsub) | |
Author URI: http://bappi-d-great.com | |
License: GNU General Public License (Version 2 - GPLv2) | |
Network: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_login_failed', 'my_front_end_login_fail' ); | |
function my_front_end_login_fail( $username ) { | |
$referrer = $_SERVER['HTTP_REFERER']; | |
$findme = '?login=failed'; | |
$pos = strpos( $referrer, $findme ); | |
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { | |
if( $pos === false ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function the_dr_categories_home_theme( $echo = true, $atts = null ){ | |
extract( shortcode_atts( array( | |
'style' => '', //list, grid | |
'lcats' => '', // | |
), $atts ) ); | |
//get plugin options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp', 'set_sidebar', 10); | |
function set_sidebar() { | |
global $_wp_sidebars_widgets, $bp; | |
switch( $bp->groups->current_group->id ) { | |
case 1: | |
$_wp_sidebars_widgets['REPLACEABLE SIDEBAR ID'] = $_wp_sidebars_widgets['REPLACED SIDEBAR ID']; | |
break; | |
case 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Works only if login required | |
function limit_active_apps( $reply_array ) { | |
global $wpdb, $current_user, $appointments; | |
// Change statuses as required. i.e. remove pending condition if you wish | |
$count = $wpdb->get_var( "SELECT COUNT(*) FROM " . $appointments->app_table . " WHERE user=".$current_user->ID." AND (status='pending' OR status='confirmed' OR status='paid' ) and created > DATE_SUB(CURDATE(), INTERVAL 1 DAY)" ); | |
if ( $count >= 3) | |
return array( 'error'=>'You have reached maximum allowed number of appointments' ); | |
return $reply_array; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_footer', 'ajax_app_auto_load' ); | |
function ajax_app_auto_load() { | |
?> | |
<style> | |
.app_services_button{display: none;} | |
</style> | |
<script type="text/javascript"> | |
jQuery(function($){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* Use the code at the beginning of a plugin that you want to be laoded at last | |
* | |
*/ | |
function this_plugin_last() { | |
$wp_path_to_this_file = preg_replace('/(.*)plugins\/(.*)$/', WP_PLUGIN_DIR."/$2", __FILE__); | |
$this_plugin = plugin_basename(trim($wp_path_to_this_file)); | |
$active_plugins = get_option('active_plugins'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Needs php greatet than 5.3 | |
* | |
* (not for all, written for special purpose) | |
*/ | |
add_action('load-users.php',function() { | |
if(isset($_GET['action']) && isset($_GET['bp_gid']) && isset($_GET['users'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- functions.php --> | |
<?php | |
add_action( 'wp_enqueue_scripts', 'theme_custom_style_script', 11 ); | |
function theme_custom_style_script() { | |
wp_enqueue_style( 'dynamic-css', admin_url('admin-ajax.php').'?action=dynamic_css', '', VERSION); | |
} | |
add_action('wp_ajax_dynamic_css', 'dynamic_css'); | |
add_action('wp_ajax_nopriv_dynamic_css', 'dynamic_css'); |