Example #1
0
function _base_scripts()
{
    global $post;
    // remove version
    add_filter('script_loader_src', 'remove_src_version');
    // global styles
    wp_enqueue_style('bootstrap-min', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), '');
    wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css', array(), '');
    if (class_exists('bbPress')) {
        if (is_bbpress()) {
            wp_enqueue_style('bbpress-custom', get_template_directory_uri() . '/assets/css/bbpress.css', array(), '');
        }
    }
    wp_enqueue_style('custom', get_template_directory_uri() . '/assets/css/customs.css', array(), '');
    wp_enqueue_style('custom-style', get_template_directory_uri() . '/style.css', array(), '');
    // global scripts
    wp_enqueue_script('jquery');
    wp_enqueue_script('bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array(), '', true);
    if (is_single() && get_post_type() == 'course_unit') {
        wp_enqueue_script('froogaloop2', get_template_directory_uri() . '/assets/js/froogaloop2.min.js', array(), '', true);
    }
    if (is_page_template('page-templates/tpl-webinars.php')) {
        wp_enqueue_style('fancybox', get_template_directory_uri() . '/assets/lib/fancybox/jquery.fancybox.css', array(), '');
        wp_enqueue_script('fancybox', get_template_directory_uri() . '/assets/lib/fancybox/jquery.fancybox.pack.js', array(), '', true);
        wp_enqueue_script('fancybox-media', get_template_directory_uri() . '/assets/lib/fancybox/helpers/jquery.fancybox-media.js', array(), '', true);
    }
    if (has_shortcode($post->post_content, 'iard_table')) {
        wp_enqueue_script('angular', get_template_directory_uri() . '/assets/js/angular.min.js', array(), '', true);
        wp_enqueue_script('angular-sanitize', get_template_directory_uri() . '/assets/js/angular-sanitize.js', array(), '', true);
        wp_enqueue_script('table-app', get_template_directory_uri() . '/assets/js/tables.js', array(), '', true);
    }
    wp_enqueue_script('main', get_template_directory_uri() . '/assets/js/main.js', array(), '', true);
}
Example #2
0
function porto_page_title()
{
    global $porto_settings;
    $output = '';
    if (!is_front_page()) {
    } elseif (is_home()) {
        $output .= $porto_settings['blog-title'];
    }
    if (is_singular()) {
        $output .= porto_page_title_leaf();
    } else {
        if (is_post_type_archive()) {
            if (is_search()) {
                $output .= porto_page_title_leaf('search');
            } else {
                $output .= porto_page_title_archive();
            }
        } elseif (is_tax() || is_tag() || is_category()) {
            $html = porto_page_title_leaf('term');
            if (is_tag()) {
                $output .= sprintf(__('Tag - %s', 'porto'), $html);
            } elseif (is_tax('product_tag')) {
                $output .= sprintf(__('Product Tag - %s', 'porto'), $html);
            } else {
                $output .= $html;
            }
        } elseif (is_date()) {
            if (is_year()) {
                $output .= porto_page_title_leaf('year');
            } elseif (is_month()) {
                $output .= porto_page_title_leaf('month');
            } elseif (is_day()) {
                $output .= porto_page_title_leaf('day');
            }
        } elseif (is_author()) {
            $output .= porto_page_title_leaf('author');
        } elseif (is_search()) {
            $output .= porto_page_title_leaf('search');
        } elseif (is_404()) {
            $output .= porto_page_title_leaf('404');
        } elseif (class_exists('bbPress') && is_bbpress()) {
            if (bbp_is_search()) {
                $output .= porto_page_title_leaf('bbpress_search');
            } elseif (bbp_is_single_user()) {
                $output .= porto_page_title_leaf('bbpress_user');
            } else {
                $output .= porto_page_title_leaf();
            }
        } else {
            if (is_home() && !is_front_page()) {
                if (get_option('show_on_front') == 'page') {
                    $output .= get_the_title(get_option('page_for_posts', true));
                } else {
                    $output .= $porto_settings['blog-title'];
                }
            }
        }
    }
    return apply_filters('porto_page_title', $output);
}
Example #3
0
 /**
  * Alter main sidebar to display bbpress_sidebar sidebar
  *
  * @access public
  * @since  2.1.0
  */
 public function display_sidebar($sidebar)
 {
     if (is_bbpress() && wpex_get_mod('bbpress_custom_sidebar', true)) {
         $sidebar = 'bbpress_sidebar';
     }
     return $sidebar;
 }
Example #4
0
 public function switch_breadcrumb_nav()
 {
     if (is_bbpress()) {
         remove_action('g1_content_begin', 'g1_add_breadcrumbs');
         add_action('g1_content_begin', array($this, 'render_breadcrumb'));
     }
 }
Example #5
0
function cuttz_bbpress_layout($layout)
{
    if (!is_bbpress()) {
        return $layout;
    }
    //get current layout saved in genesis setting
    $gsettings = get_option(GENESIS_SETTINGS_FIELD, null);
    $layout = isset($gsettings['site_layout']) ? $gsettings['site_layout'] : null;
    $set = genesis_get_option('bbpress-layout', cuttz_get_skin_page_id(), false);
    $set = $set == 'default' ? $layout : $set;
    // if no setting in Cuttz defined then use Genesis setting
    $forum_id = bbp_get_forum_id();
    $forumlayout = false;
    if (!empty($forum_id)) {
        $forumlayout = esc_attr(get_post_meta($forum_id, '_genesis_layout', true));
        if (!empty($forumlayout)) {
            return $forumlayout;
        }
    }
    if (empty($forumlayout)) {
        return $set;
    }
    if (is_user_logged_in()) {
    }
    return $set;
}
Example #6
0
/**
* Shows a breadcrumb for all types of pages. This is a wrapper function for the Breadcrumb_Trail class,
* which should be used in theme templates.
*
* @since 0.1.0
* @access public
* @param array $args Arguments to pass to Breadcrumb_Trail.
* @return void
*/
function breadcrumb_trail($args = array())
{
    if (function_exists('is_bbpress') && is_bbpress()) {
        $breadcrumb = new bbPress_Breadcrumb_Trail($args);
    } else {
        $breadcrumb = new Breadcrumb_Trail($args);
    }
    return $breadcrumb->trail();
}
Example #7
0
/**
 * Shows a breadcrumb for all types of pages.  This is a wrapper function for the Breadcrumb_Trail class, 
 * which should be used in theme templates.
 *
 * @since  0.1.0
 * @access public
 * @param  array $args Arguments to pass to Breadcrumb_Trail.
 * @return void
 */
function sde_breadcrumb_trail($args = array())
{
    if (function_exists('is_bbpress') && is_bbpress()) {
        $breadcrumb = new bbPress_SDE_Breadcrumb_Trail($args);
    } else {
        $breadcrumb = new SDE_Breadcrumb_Trail($args);
    }
    $breadcrumb->trail();
}
Example #8
0
/**
 * Shows a breadcrumb for all types of pages.  This is a wrapper function for the Breadcrumb_Trail class, 
 * which should be used in theme templates.
 *
 * @since  0.1.0
 * @access public
 * @param  array $args Arguments to pass to Breadcrumb_Trail.
 * @return void
 */
function reactor_breadcrumbs($args = array())
{
    if (function_exists('is_bbpress') && is_bbpress()) {
        $breadcrumb = new bbPress_Breadcrumb_Trail($args);
    } else {
        $breadcrumb = new Breadcrumb_Trail($args);
    }
    $breadcrumb->trail();
}
Example #9
0
File: config.php Project: 6226/wp
function kleo_bbpress_change_layout($layout)
{
    if (is_bbpress()) {
        $bbpress_template = sq_option('bbpress_sidebar', 'default');
        if ($bbpress_template != 'default') {
            $layout = $bbpress_template;
        }
    }
    return $layout;
}
function myfossil_plugins_nav_below_fix($nav_below)
{
    if (class_exists('bbPress') && is_bbpress()) {
        return;
    }
    if (class_exists('BuddyPress') && is_buddypress()) {
        return;
    }
    return $nav_below;
}
Example #11
0
 /**
  * Helper function which checks whether we are running buddypress
  *
  * @return bool true if we are on a system running buddypress, false otherwise.
  */
 function AA_is_bbpress()
 {
     if (function_exists('is_bbpress')) {
         return is_bbpress();
     }
     if (is_admin() && is_plugin_active('bbpress/bbpress.php')) {
         return true;
     }
     return false;
 }
/**
 * Load a custom.css style sheet, if it exists in a child theme.
 *
 * @return void
 */
function ro_enqueue_bbpress_stylesheets()
{
    if (!is_admin() and is_bbpress()) {
        if (is_child_theme()) {
            if (file_exists(get_stylesheet_directory() . "/bbpress.css")) {
                wp_enqueue_style('ro-bbpress-css', ROTW16_CURI . '/bbpress.css');
            }
        }
    }
}
 /**
  * Shows a breadcrumb for all types of pages.  This is a wrapper function for the Breadcrumb_Trail class,
  * which should be used in theme templates.
  *
  * @since  0.1.0
  * @access public
  * @param  array $args Arguments to pass to Breadcrumb_Trail.
  * @return void
  */
 function kleo_breadcrumb($args = array())
 {
     if (function_exists('bp_is_active') && !bp_is_blog_page()) {
         $breadcrumb = new buddypress_Breadcrumb_Trail($args);
     } elseif (function_exists('is_bbpress') && is_bbpress()) {
         $breadcrumb = new bbPress_Breadcrumb_Trail($args);
     } else {
         $breadcrumb = new Breadcrumb_Trail($args);
     }
     return $breadcrumb->trail();
 }
Example #14
0
/**
 * Shows a breadcrumb for all types of pages.  This is a wrapper function for the Breadcrumb_Trail class,
 * which should be used in theme templates.
 *
 * @since  0.1.0
 * @access public
 * @param  array $args Arguments to pass to Breadcrumb_Trail.
 * @return void
 */
function breadcrumb_trail($args = array())
{
    $defaults = array('container' => 'div', 'separator' => '', 'before' => '', 'after' => '', 'show_on_front' => true, 'network' => false, 'show_title' => true, 'show_browse' => false, 'echo' => true, 'post_taxonomy' => array('post' => 'category', 'product' => 'product_cat'), 'labels' => array('browse' => '', 'home' => __('Home', THEME_LANG), 'error_404' => __('404 Not Found', THEME_LANG), 'archives' => __('Archives', THEME_LANG), 'search' => __('Search results for “%s”', THEME_LANG), 'paged' => __('Page %s', THEME_LANG), 'archive_minute' => __('Minute %s', THEME_LANG), 'archive_week' => __('Week %s', THEME_LANG), 'archive_minute_hour' => '%s', 'archive_hour' => '%s', 'archive_day' => '%s', 'archive_month' => '%s', 'archive_year' => '%s'));
    $args = wp_parse_args($args, $defaults);
    $args = apply_filters('breadcrumb_trail_args', $args);
    if (function_exists('is_bbpress') && is_bbpress()) {
        $breadcrumb = new bbPress_Breadcrumb_Trail($args);
    } else {
        $breadcrumb = new Breadcrumb_Trail($args);
    }
    return $breadcrumb->trail();
}
Example #15
0
 public function __construct(&$plugin)
 {
     $this->p =& $plugin;
     $this->p->debug->mark();
     if (is_admin() || is_bbpress()) {
         // load sharing buttons code if sharing features exist and are enabled
         if (array_key_exists('ssb', $this->p->is_avail) && $this->p->is_avail['ssb'] === true) {
             $classname = __CLASS__ . 'Sharing';
             $this->sharing = new $classname($this->p);
         }
     }
 }
 /**
  * Conditional check:
  * Figure out if bbPress is installed.
  * If bbPress is installed, then check that we're on a bbPress template.
  *
  * @return  bool
  */
 public static function is_bbpress()
 {
     /**
      * Check if bbPress is installed.
      * If not, then return false
      */
     if (!function_exists('is_bbpress')) {
         return false;
     }
     /**
      * Return the result of the is_woocommerce() function (boolean)
      */
     return is_bbpress();
 }
Example #17
0
function _is_portal_page()
{
    global $post;
    $parents = array_reverse(get_post_ancestors($post->ID));
    $parent_id = $parents[0];
    if (class_exists('bbPress')) {
        $is_bbpress = is_bbpress() ? true : false;
    }
    if (_in_array($post->ID, _portal_page_id()) || _in_array($parent_id, _portal_page_id()) || is_single() && get_post_type() == 'course_unit' || is_single() && get_post_type() == 'databank' || $is_bbpress) {
        return true;
    } else {
        return false;
    }
}
Example #18
0
 /**
  * Get sidebar settings based on the page type
  *
  * @return array
  */
 public function sidebar_options()
 {
     if (is_home()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
     } elseif (function_exists('is_bbpress') && is_bbpress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         if (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search()) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         }
     } elseif (function_exists('is_buddypress') && is_buddypress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product() || is_shop())) {
         $sidebars = array('global' => Avada()->settings->get('woo_global_sidebar'), 'sidebar_1' => Avada()->settings->get('woo_sidebar'), 'sidebar_2' => Avada()->settings->get('woo_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product_category() || is_product_tag())) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('woocommerce_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('woocommerce_archive_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (is_page()) {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     } elseif (is_single()) {
         $sidebars = array('global' => Avada()->settings->get('posts_global_sidebar'), 'sidebar_1' => Avada()->settings->get('posts_sidebar'), 'sidebar_2' => Avada()->settings->get('posts_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_singular('avada_portfolio')) {
             $sidebars = array('global' => Avada()->settings->get('portfolio_global_sidebar'), 'sidebar_1' => Avada()->settings->get('portfolio_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         } else {
             if (is_singular('tribe_events') || is_singular('tribe_organizer') || is_singular('tribe_venue')) {
                 $sidebars = array('global' => Avada()->settings->get('ec_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
             }
         }
         if (is_singular('tribe_organizer') || is_singular('tribe_venue')) {
             $sidebars['global'] = 1;
         }
     } elseif (is_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_post_type_archive('avada_portfolio') || is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('portfolio_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_archive_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         }
     } elseif (is_search()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('search_sidebar'), 'sidebar_2' => Avada()->settings->get('search_sidebar_2'), 'position' => Avada()->settings->get('search_sidebar_position'));
     } else {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     }
     if (class_exists('Tribe__Events__Main') && is_events_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
     }
     // Remove sidebars from the certain woocommerce pages
     if (class_exists('WooCommerce')) {
         if (is_cart() || is_checkout() || is_account_page() || get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))) {
             $sidebars = array();
         }
     }
     return $sidebars;
 }
 public static function fix_breadcrumbs($html = '', $args = array())
 {
     if (function_exists('is_bbpress') && is_bbpress() && function_exists('bbp_get_breadcrumb')) {
         remove_filter('bbp_no_breadcrumb', '__return_true', 20);
         $html = bbp_get_breadcrumb(array('before' => $args['beforeBreadcrumbs'] . '<ol' . $args['listAttr'] . ' xmlns:v="http://rdf.data-vocabulary.org/#">', 'after' => '</ol>' . $args['afterBreadcrumbs'], 'sep' => $args['delimiter'] ? $args['delimiter'] : ' ', 'pad_sep' => false, 'sep_before' => '', 'sep_after' => '', 'crumb_before' => $args['linkBefore'], 'crumb_after' => $args['linkAfter'], 'current_before' => $args['before'], 'current_after' => $args['after']));
         $html = str_replace('<a ', '<a' . $args['linkAttr'], $html);
         if ($args['linkBefore'] && $args['before']) {
             $html = str_replace($args['linkBefore'] . $args['before'], $args['before'], $html);
         }
         if ($args['linkAfter'] && $args['after']) {
             $html = str_replace($args['linkAfter'] . $args['after'], $args['after'], $html);
         }
         add_filter('bbp_no_breadcrumb', '__return_true', 20);
     }
     return $html;
 }
/**
 * Template logic helper function for bbPress filter 'bbp_get_template_part'.
 *
 * @since  1.5.0
 *
 * @param  array 	$templates
 * @param  string 	$slug
 * @param  string 	$name
 *
 * @return array Array of template parts for bbPress.
 */
function ddw_gwnf_bbpress_noresults_template_logic($templates, $slug, $name)
{
    /** Only do stuff when on 'feedback-no-search.php' template part: */
    if ($slug == 'feedback' && $name == 'no-search' && is_bbpress()) {
        /** Only for no forum search results, remove this original bbPress filter */
        remove_filter('the_content', 'bbp_replace_the_content');
        /**
         * Add our widgetized area instead.
         *
         * Note: This needs to happen early on, BEFORE the original bbPress content.
         */
        add_action('the_content', 'ddw_gwnf_bbpress_widgetized_noresults_content', 5);
    }
    // end-if bbPress template part check
    /** Let bbPress take over its templates again */
    return $templates;
}
Example #21
0
 function get_sidebar($post_id)
 {
     if (is_page() || is_home()) {
         $sidebar = $this->sidebar_names['page'];
     }
     if (is_search()) {
         $sidebar = $this->sidebar_names["search"];
     }
     if (is_404()) {
         $sidebar = $this->sidebar_names["404"];
     }
     if (is_archive()) {
         $sidebar = $this->sidebar_names["archive"];
     }
     if (is_singular('post')) {
         $sidebar = $this->sidebar_names['single_post'];
     }
     if (is_singular('portfolio')) {
         $sidebar = $this->sidebar_names['single_portfolio'];
     }
     if (is_singular('news')) {
         $sidebar = $this->sidebar_names['single_news'];
     }
     if (is_archive()) {
         $sidebar = $this->sidebar_names["archive"];
     }
     if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
         $sidebar = $this->sidebar_names["woocommerce"];
     }
     if (function_exists('is_woocommerce') && is_woocommerce() && is_single()) {
         $sidebar = $this->sidebar_names["woocommerce_single"];
     }
     if (function_exists('is_bbpress') && is_bbpress()) {
         $sidebar = $this->sidebar_names['page'];
     }
     if (!empty($post_id)) {
         $custom = get_post_meta($post_id, '_sidebar', true);
         if (!empty($custom)) {
             $sidebar = $custom;
         }
     }
     if (isset($sidebar)) {
         dynamic_sidebar($sidebar);
     }
 }
/**
 * Check if the user is allowed to view the content (forum/topic/post)
 * Show a 404 error if the user does not have a permission to access the content
 */
function tehnik_bpp_enforce_permissions()
{
    // Bail if not viewing a bbPress item
    if (!is_bbpress()) {
        return;
    }
    // Bail if not viewing a single item or if user has caps
    if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_hidden_forums')) {
        return;
    }
    if (!tehnik_bpp_can_user_view_post()) {
        if (!is_user_logged_in()) {
            auth_redirect();
        } else {
            bbp_set_404();
        }
    }
}
Example #23
0
 static function nav_menu_css_class($classes, $item, $args, $depth)
 {
     if ($item->object == bbp_get_forum_post_type() && is_bbpress()) {
         if (bbp_is_topic_edit() || bbp_is_single_topic()) {
             $forum_id = bbp_get_topic_forum_id();
             if ($forum_id == $item->object_id) {
                 $classes[] = 'current-menu-parent';
                 $classes[] = 'current-' . bbp_get_topic_post_type() . '-parent';
             } elseif ($ancestors = self::forum_ancestors($forum_id, array())) {
                 if (in_array($item->object_id, $ancestors)) {
                     $classes[] = 'current-menu-ancestor';
                     $classes[] = 'current-' . bbp_get_topic_post_type() . '-ancestor';
                 }
             }
         } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
             $forum_id = bbp_get_reply_forum_id();
         }
     }
     return $classes;
 }
Example #24
0
 static function user_has_cap($allcaps, $caps, $args, $user)
 {
     static $doing = false;
     // bypass if non-bbpress contents and avoid infinite loop
     if ($doing === true || !did_action('wp') || !is_bbpress()) {
         return $allcaps;
     }
     $bbp_allcaps = bbp_get_caps_for_role(bbp_get_keymaster_role());
     $check_caps = array_intersect(array_values($caps), array_keys($bbp_allcaps));
     if (!$check_caps && in_array('upload_files', $caps)) {
         $check_caps = array('upload_files');
     }
     // bypass non bbpress caps
     if (!$check_caps || in_array('keep_gate', $check_caps)) {
         return $allcaps;
     }
     $doing = true;
     if (!($forum_id = bbp_get_forum_id())) {
         $doing = false;
         return $allcaps;
     }
     // Give all modorator capabilities to optional forum moderators per forum
     $moderators = bbpresskr()->forum_option('moderators', $forum_id);
     if (in_array($user->ID, $moderators) && ($new_caps = bbp_get_caps_for_role(bbp_get_moderator_role()))) {
         // remove all bbpress capabilities and append for asigned role only
         $_allcaps = array_diff_assoc($allcaps, $bbp_allcaps);
         $allcaps = array_merge($_allcaps, $new_caps);
         $allcaps['upload_files'] = true;
     }
     // In case we use usermeta for forum moderator setting
     /*$metakey = "forum_role_{$forum_id}";
     		// Dobule check forum role still exists. Role may excluded by plugin or updates.
     		if ( isset( $user->$metakey ) && ($new_caps = bbp_get_caps_for_role( $user->$metakey )) ) {
     			// remove all bbpress capabilities and append for asigned role only
     			$_allcaps = array_diff_assoc( $allcaps, $bbp_allcaps );
     			$allcaps = array_merge( $_allcaps, $new_caps );
     			$allcaps['upload_files'] = true;
     		}*/
     $doing = false;
     return $allcaps;
 }
Example #25
0
function memberful_wp_regulate_access_to_bbpress()
{
    if (!is_bbpress()) {
        return;
    }
    if (!memberful_wp_bbpress_protect_forums()) {
        return;
    }
    if (current_user_can('moderate')) {
        return;
    }
    if (memberful_wp_bbpress_restricted_to_registered_users() && is_user_logged_in()) {
        return;
    }
    $has_required_plan = memberful_wp_user_has_subscription_to_plans(get_current_user_id(), memberful_wp_bbpress_required_subscription_plans());
    $has_required_download = memberful_wp_user_has_downloads(get_current_user_id(), memberful_wp_bbpress_required_downloads());
    if ($has_required_plan || $has_required_download) {
        return;
    }
    wp_safe_redirect(memberful_wp_bbpress_unauthorized_user_landing_page());
    exit;
}
Example #26
0
 protected function onWidget(array $args, \Drone\HTML &$html)
 {
     if (($page = get_post((int) $this->wo('page'))) !== null) {
         if (function_exists('bbp_version') && is_bbpress()) {
             bbp_restore_all_filters('the_content');
         }
         $html->add(Func::wpProcessContent($page->post_content));
     }
 }
 /**
  * Alter the main loop to hide download using pre_get_posts
  * We're not using ! is_main_query because no matter what the query is on the page we want to hide them
  * @since 1.0
  */
 function pre_get_posts($query)
 {
     if (!isset($query)) {
         return;
     }
     if ($query->is_single || function_exists('is_bbpress') && is_bbpress() || is_admin()) {
         return;
     }
     // if a download is hidden, prevent it from being hidden on the FES vendor dashboard page
     if (function_exists('EDD_FES') && is_page(EDD_FES()->helper->get_option('fes-vendor-dashboard-page', false))) {
         return;
     }
     // hide downloads from all queries except singular pages, which will 404 without the conditional
     // is_singular('download') doesn't work inside pre_get_posts
     if (!$query->is_single) {
         $excluded_ids = isset($query->query_vars['post__not_in']) ? $query->query_vars['post__not_in'] : array();
         // make sure we're merging with existing post__not_in so we do not override it
         $query->set('post__not_in', array_merge($excluded_ids, $this->get_hidden_downloads()));
     }
 }
Example #28
0
    }
    $title_tag = is_front_page() ? 'h2' : 'h1';
    ?>
            <div id="title-bar-wrap" class="title-bar-layout-normal title-bar-page <?php 
    echo esc_attr($page_photo_class);
    ?>
" style="<?php 
    echo esc_attr($page_photo_css);
    ?>
">
                <div id="title-bar" class="container">                    
                    <div id="title-bar-text" class="container">
                        <div class="row">
                            <div class="span8">
                                <?php 
    if (function_exists('is_bbpress') && is_bbpress()) {
        ?>
                                <<?php 
        echo tag_escape($title_tag);
        ?>
><?php 
        echo '<a href="' . esc_url(get_permalink()) . '">';
        echo trim($ts_page_title) ? esc_html($ts_page_title) : get_the_title();
        echo '</a>';
        ?>
</<?php 
        echo tag_escape($title_tag);
        ?>
>
                                <?php 
    } elseif (is_single()) {
Example #29
0
function x_is_bbpress()
{
    if (function_exists('is_bbpress') && is_bbpress()) {
        return true;
    } else {
        return false;
    }
}
Example #30
0
function avada_current_page_title_bar($post_id)
{
    global $smof_data;
    ob_start();
    if ($smof_data['breadcrumb']) {
        if ($smof_data['page_title_bar_bs'] == 'Breadcrumbs') {
            if (class_exists('Woocommerce') && is_woocommerce() || (is_tax('product_cat') || is_tax('product_tag'))) {
                woocommerce_breadcrumb(array('wrap_before' => '<ul class="breadcrumbs">', 'wrap_after' => '</ul>', 'before' => '<li>', 'after' => '</li>', 'delimiter' => ''));
            } else {
                if (class_exists('bbPress') && is_bbpress()) {
                    bbp_breadcrumb(array('before' => '<ul class="breadcrumbs">', 'after' => '</ul>', 'sep' => ' ', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'home_text' => __('Home', 'Avada')));
                } else {
                    themefusion_breadcrumb();
                }
            }
        } else {
            get_search_form();
        }
    }
    $secondary_content = ob_get_contents();
    ob_get_clean();
    $title = '';
    $subtitle = '';
    if (get_post_meta($post_id, 'pyre_page_title_custom_text', true) != '') {
        $title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
    }
    if (get_post_meta($post_id, 'pyre_page_title_custom_subheader', true) != '') {
        $subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
    }
    if (!$title) {
        $title = get_the_title();
        if (is_home()) {
            $title = $smof_data['blog_title'];
        }
        if (is_search()) {
            $title = __('Rezultati pretrage za:', 'Avada') . get_search_query();
        }
        if (is_404()) {
            $title = __('Error 404 Page', 'Avada');
        }
        if (class_exists('TribeEvents') && tribe_is_event() && !is_single() || class_exists('TribeEvents') && is_events_archive() && is_404()) {
            $title = tribe_get_events_title();
        }
        if (is_archive() && !is_bbpress()) {
            if (is_day()) {
                $title = __('Dnevna arhiva:', 'Avada') . '<span> ' . get_the_date() . '</span>';
            } else {
                if (is_month()) {
                    $title = __('Mjesečna arhiva:', 'Avada') . '<span> ' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>';
                } elseif (is_year()) {
                    $title = __('Godišnja arhiva:', 'Avada') . '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>';
                } elseif (is_author()) {
                    $curauth = get_user_by('id', get_query_var('author'));
                    $title = $curauth->nickname;
                } else {
                    $title = single_cat_title('', false);
                }
            }
        }
        if (class_exists('Woocommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
            if (!is_product()) {
                $title = woocommerce_page_title(false);
            }
        }
    }
    if (!$subtitle) {
        if (is_home()) {
            $subtitle = $smof_data['blog_subtitle'];
        }
    }
    if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
        if (get_post_meta($post_id, 'pyre_page_title', true) == 'yes' || $smof_data['page_title_bar'] && get_post_meta($post_id, 'pyre_page_title', true) != 'no') {
            if (get_post_meta($post_id, 'pyre_page_title_text', true) == 'no') {
                $title = '';
                $subtitle = '';
            }
            if (is_home() && is_front_page() && !$smof_data['blog_show_page_title_bar']) {
                // do nothing
            } else {
                avada_page_title_bar($title, $subtitle, $secondary_content);
            }
        }
    } else {
        if (is_home() && !$smof_data['blog_show_page_title_bar']) {
            // do nothing
        } else {
            if ($smof_data['page_title_bar']) {
                avada_page_title_bar($title, $subtitle, $secondary_content);
            }
        }
    }
}