Skip to:
Content

BuddyPress.org

Ticket #1307: current_theme_supports.patch

File current_theme_supports.patch, 2.3 KB (added by GIGALinux, 16 years ago)
  • bp-core.php

     
    17911760add_action( 'in_plugin_update_message-buddypress/bp-loader.php', 'bp_core_update_message' );
    17921761
    17931762/**
     1763 * bp_core_get_theme_warning()
     1764 *
     1765 * Returns a warning if the current theme could maybe incompatible with BuddyPress
     1766 *
     1767 * @package BuddyPress Core
     1768 * @uses current_theme_supports() Check if the current theme supports a feature
     1769 */
     1770function bp_core_get_theme_warning() {
     1771        if ( false == function_exists( "current_theme_supports" ) )
     1772                return;
     1773               
     1774        if ( current_theme_supports( "buddypress" ) )
     1775                return;
     1776               
     1777        if ( isset( $_GET["dismiss_theme_warning"] ) )
     1778                update_site_option("dismiss_theme_warning", "1");
     1779
     1780        if ( is_site_admin() && "1" != get_site_option("dismiss_theme_warning") )
     1781                echo '<div style="color:red;" id="update-nag">' . __( 'WARNING: Your current theme could be maybe incompatible with BuddyPress. Please contact the theme author.', 'buddypress' ) . ' <a href="index.php?dismiss_theme_warning=true">' . __( "Dismiss", "buddypress" ) . '</a></div>';
     1782}
     1783
     1784add_action( 'admin_notices', 'bp_core_get_theme_warning' );
     1785
     1786/**
     1787 * bp_core_set_theme_warning()
     1788 *
     1789 * Set the warning if the current theme could maybe incompatible with BuddyPress
     1790 *
     1791 * @package BuddyPress Core
     1792 * @uses current_theme_supports() Check if the current theme supports a feature
     1793 */
     1794function bp_core_set_theme_warning( $theme ) {
     1795        if ( false == function_exists( "current_theme_supports" ) )
     1796                return;
     1797               
     1798        if ( current_theme_supports( "buddypress" ) )
     1799                return;
     1800               
     1801        update_site_option("dismiss_theme_warning", $theme);
     1802}
     1803
     1804add_action( "switch_theme", "bp_core_set_theme_warning" );
     1805
     1806/**
    17941807 * bp_core_clear_user_object_cache()
    17951808 *
    17961809 * Clears all cached objects for a user, or a user is part of.
  • bp-themes/bp-sn-parent/functions.php

     
    6767}
    6868add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
    6969
     70/* Register theme support for BuddyPress */
     71if ( function_exists( "add_theme_support" ) )
     72        add_theme_support( "buddypress" );
     73
    7074?>
     75 No newline at end of file