Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Shaun

    (@shaunco)

    Thread Starter Shaun

    (@shaunco)

    I managed to piece the following hook together. Please note that I had to modify UM/core/class-access.php to have both $allow_access and $redirect_handler be public, as the setting allow_access to false does absolutely nothing if redirect_handler is false.

    
    // Modern Event Calendar is members only
    add_filter("um_access_check_global_settings","um_access_check_for_MEC", 9999 );
    function um_access_check_for_MEC(){
        $current_url = UM()->permalinks()->get_current_url(get_option('permalink_structure'));
       
        // Are we are somewhere in a MEC page (/events/, /events/*, or /event-category/*)?
        if(strpos($current_url,'/events/') !== false || strpos($current_url,'/event-category/') !== false) { 
    
            // Check if the user is a member
            $user = wp_get_current_user();
            if(!isset($user) || !in_array('um_member', (array) $user->roles)) {
                // User is not not logged in or is not a member, prevent access
                UM()->access()->allow_access = false;
                UM()->access()->redirect_handler = UM()->access()->set_referer(esc_url(add_query_arg('redirect_to', urlencode_deep($current_url), um_get_core_page('login'))), 'global');
            }
        }
    }
    

    They are getting an internal server error because allow_access is a private member of the access class. There doesn’t seem to be getter or setter methods for allow_access, so I’m guessing allow_access was meant to be public.

    • This reply was modified 4 years, 8 months ago by Shaun.
    Thread Starter Shaun

    (@shaunco)

    It looks like MEC doesn’t play well with Qode. Qode rewrites the content_inner div to have the title prior to the main-content div, along with a few other things, and MEC seems to be somehow bypassing Qode’s rewriting…

    MEC Archive Page:

    
    <div class="content_inner">
        <section id="main-content" class="container">
            <h1>Events</h1>
            <div id="mec_skin_793" class="mec-wrap">
                <div class="mec-calendar ">
                    <!-- Calendar here -->
                </div>
            </div>
        </section>
    </div>
    

    Normal (Qode processed) Page:

    
    <div class="content_inner">
        <div class="title_outer title_without_animation" data-height="150">
            <div class="title title_size_large  position_center " style="height:150px;">
                <div class="image not_responsive"></div>
                <div class="title_holder" style="padding-top:68px;height:82px;">
                    <div class="container">
                        <div class="container_inner clearfix">
                            <div class="title_subtitle_holder">
                                <h1><span>Events</span></h1>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="container_inner default_template_holder clearfix page_container_inner">
                <div id="mec_skin_268" class="mec-wrap">
                    <div class="mec-calendar mec-box-calendar">
                        <!-- Calendar here -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    Thread Starter Shaun

    (@shaunco)

    Yes, this is still not answered. The “Archive” page that ends up in the main /events/ slug takes over the entire browser area, no matter what template I use, whereas the exact same template used on a custom WP page does not.

    Thread Starter Shaun

    (@shaunco)

    Ok, I found the “Archive Page Skin” options… but still, any view/skin I choose still results in /events/ having the calendar take over the whole page.

    Putting the same shortcode on a new WP Page behaves just fine.

    The issue is that get_option(‘siteurl’) is not filtered using is_ssl() to ensure the proper URL scheme. This means that any plugin (or theme or whatever) that makes use of a defined URL will always reference http instead of properly switching to https, since the defined URLs are always based on WP_CONTENT_URL (such as WP_PLUGIN_URL).

    The proper fix for this would be for WP to modify their ‘wp-includes/default-filters.php’ file to have the filter listed below, but for now the easiest thing for you to do is to paste the code below in to your wp-settings.php file, just above the first reference to “WP_CONTENT_URL” (which is line 390 in WP ver 2.9).

    Search for:

    if ( !defined('WP_CONTENT_URL') )
    	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up

    Replace with:

    // Fix the URL root for SSL
    function fix_ssl_siteurl($url) {
    	$scheme = (is_ssl() ? 'https' : 'http');
    	if(0 === strpos($url, 'http')) {
    		if(is_ssl())
    			$url = str_replace('https://', "{$scheme}://", $url);
    	}
    
        return $url;
    }
    add_filter('option_siteurl', fix_ssl_siteurl);
    add_filter('option_home', fix_ssl_siteurl);
    
    if ( !defined('WP_CONTENT_URL') )
    	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up

    Forum: Plugins
    In reply to: Admin SSL & Nextgen-gallery

    The issue is that get_option(‘siteurl’) is not filtered using is_ssl() to ensure the proper URL scheme. This means that any plugin (or theme or whatever) that makes use of a defined URL will always reference http instead of properly switching to https, since the defined URLs are always based on WP_CONTENT_URL (such as WP_PLUGIN_URL).

    The proper fix for this would be for WP to modify their ‘wp-includes/default-filters.php’ file to have the filter listed below, but for now the easiest thing for you to do is to paste the code below in to your wp-settings.php file, just above the first reference to “WP_CONTENT_URL” (which is line 390 in WP ver 2.9).

    Search for:

    if ( !defined('WP_CONTENT_URL') )
    	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up

    Replace with:

    // Fix the URL root for SSL
    function fix_ssl_siteurl($url) {
    	$scheme = (is_ssl() ? 'https' : 'http');
    	if(0 === strpos($url, 'http')) {
    		if(is_ssl())
    			$url = str_replace('https://', "{$scheme}://", $url);
    	}
    
        return $url;
    }
    add_filter('option_siteurl', fix_ssl_siteurl);
    add_filter('option_home', fix_ssl_siteurl);
    
    if ( !defined('WP_CONTENT_URL') )
    	define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up

    From WP-Admin, click Gallery, then Options, then on the Thumbnails tab. Change the dimensions to what you want and click “Save Changes”.

    Now, you have to do this for each gallery:
    Click Manage Gallery (on the left), click on the title of a gallery, check the checkbox at the top of the images (which will check all images), then from the dropdown that reads “no action”, choose “Create New Thumbnails”, and then click “Apply” (just to the right of the dropdown).

    The gallery edit page will refresh with a progress bar at the top… Let the progress bar get to 100% before you navigate away (not sure if this is required, but best to watch it).

Viewing 9 replies - 1 through 9 (of 9 total)