• Resolved nikasama83

    (@nikasama83)


    hi there, we came across the most weird behavior for Event manager.

    We have a theme with several custom types, we are also using event manager with this website.

    We found the most weird behavior: after saving event manager settings the pretty permalink for all other custom types create by us give me 404 (apparently this also happens to other users when editing an event the permalinks for other custom types will give 404 afterwards). This is weird, very weird, but not a mayor issue because i forced the permalink rules flush from the functions.php. Problem solved.

    Now here is THE problem. All of this happened on our DEV server, today we moved the site to its final hosting and event manager will make the permalink setting page blank. after that wordpress will suck up all the memory and eventually we get error 500. This sort of website moves is something we do all the time and paths and urls are correct on the DB.

    Here is a list of thing we have tried, all with same permalink page blank result:
    – removed permalink rule flush
    – deactivated all other plugins
    – deactivated/activated event manager several times
    – change permalink structure value in the DB

    The only way to get our permalink page back is deactivating event manager.

    We have used event manager in previous websites and this never happened. Have this ever happened to anyone else? Why would event manager hate the permalink page so much? Any idea on why or how to fix this would be great.

    Thanks in advance and ask away for more info if needed.

    https://www.ads-software.com/extend/plugins/events-manager/

Viewing 14 replies - 1 through 14 (of 14 total)
  • agelonwl

    (@angelonwl)

    permalink for others custom types

    Is this using another plugin and can I know what plugin is this?

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Maybe because you’re not creating your custom post types on or after the init hook. https://codex.www.ads-software.com/Post_Types#Custom_Types

    This worked for someone, try creating the post types with a plugin like Custom Post Type UI, which works fine with any post type created (provided it’s not ‘event’ and ‘location’ which we use of course.

    To test that it’s your other post types doing this, try deactivating other plugins and/or your theme or even your code that creates those post types and see if EM works.

    Thread Starter nikasama83

    (@nikasama83)

    oh, no plugin for that just creating their rewrite rules when registering the custom type

    'rewrite' => array('slug' => 'song' , 'with_front' => false )
    'has_archive' => true,

    What i meant is that after saving event manager settings https://www.website.com/song/ or https://www.website.com/song/song-name/ would give me 404 and we get a blank permalink page.

    Thread Starter nikasama83

    (@nikasama83)

    all custom types declared by us used init, and yes they have unique names.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    There must be something you’re missing, as I’ve done this before without a problem.

    This worked for someone a while back: Try creating the same custom post type with Custom Post Type UI and see if it works.

    Thread Starter nikasama83

    (@nikasama83)

    Mhhh… i will give it a try as soon as i can. Thanks

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    whilst I’m not sure it’ll work, may be worth trying the latest dev versions. I’ve changed the way we work with the parse_query action which may just help.

    ericwied

    (@ericwied)

    Hi I am receiving the same problem with my current theme
    It is for reference here.
    balance.weblusive.com

    When I create a portfolio item (custom post type)
    and I proceed to click the portfolio item expecting to be transferred to the portfolio item information page, I get a 404 error.

    Note: I had a previous problem with Events manager and just regular posts where the footer was getting thrown above the main content of the site.

    I fixed this by cutting and pasting the get footer request above the last ending </div> tag. in the single.php file.

    If events manager is turned off the previous problem with footer moving up was not in effect. ( I know that it was in fact the theme designer being sloopy with this problem, so i fixed it for my self) The same result of everything working fine, happens for portfolio items as well when events manager is de activated.

    What I have not done to remedy this problem is create a single-event.php page because i don’t believe that will effect the problem.

    I have tried both pages and posts in the settings as well as with out formatting and with formatting.

    I am going to try the dev version you suggested Marcus and see if the problem has been resolved.

    Brb

    ericwied

    (@ericwied)

    Nope it didn’t change a thing

    Ok so since I have access to the theme files and can copy the ones that you need to deduce the problem i am going to past them here for you to see and try and find the solution to the problem.

    Here it goes

    single.php

    <?php
    /**
     * The Template for displaying all single posts.
     */
    
    get_header(); ?>
    <?php $al_options = get_option('al_general_settings'); ?>	
    
    <div class="box">
    	<!-- Title -->
    	<div class="headertext">
    		<?php the_title() ?>
    		<?php $headline = get_post_meta($post->ID, "_headline", $single = false);?>
    		<?php if(!empty($headline[0]) ):?>
    			<span><?php echo $headline[0] ?></span>
    		<?php endif?>
    	</div>
    	<div class="clearsmall"></div>
    	<div class="container_12">
    		<?php if($al_options['al_fullwidth_single'] == '1'): ?>
    			<div class="grid_9">
    		<?php else: ?>
    			<div class="grid_12">
    		<?php endif ?>
    			<?php
    				$postcounter = 1;
    				$attachedImages = array();
    
    				while ( have_posts() ) : the_post();
    
    				$argsThumb = array(
    					'order'          => 'ASC',
    					'post_type'      => 'attachment',
    					'post_parent'    => $post->ID,
    					'post_mime_type' => 'image',
    					'post_status'    => null,
    					'exclude' => get_post_thumbnail_id()
    				);
    				$video =  get_post_custom_values("_post_video");
    				$type = get_post_custom_values("_post_listing_type");
    				if ($type) $type = $type[0];
    				$full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false);
    			?>
    
    				<!--Blog Post-->
    				<article <?php post_class('blogpost'); ?> id="post-<?php the_ID();?>">
    					<?php if ($type == 3): ?>
    						 <div class="hover_video">
    							<a href="https://vimeo.com/<?php echo $video[0]?>?width=800&height=450" data-rel="prettyPhoto[blogvideo<?php the_ID();?>]" title="<?php the_title()?>">
    								<?php the_post_thumbnail('blog-list2', array('class'=>'')); ?>
    							</a>
    						</div>
    
    					<?php elseif($type==2):?>
    						<div class="hover_slideshow">
    							<a href="<?php echo $full_image[0]; ?>" title="<?php the_title()?>" data-rel="prettyPhoto[blog<?php the_ID();?>]">
    								<?php the_post_thumbnail('blog-list2', array('class'=>'')); ?>
    							</a>
    							<?php
    								$attachments = get_posts($argsThumb);
    
    								if ($attachments) {
    									foreach ($attachments as $attachment) {
    										//echo apply_filters('the_title', $attachment->post_title);
    										echo '<a href="'.wp_get_attachment_url($attachment->ID, 'thumbnail', false, false).'" data-rel="prettyPhoto[blog'.$post->ID.']" title="'.get_the_title($post->ID).'"></a>';
    
    									}
    								}
    							?>
    						</div>
    					<?php else: ?>
    						<div class="hover_link">
    							<a href="<?php the_permalink() ?>" title="<?php the_title()?>">
    								<?php the_post_thumbnail('blog-list2', array('class'=>'')); ?>
    							</a>
    						</div>
    					<?php endif ?>
    					<div class="blog_box">
    						<div class="grid_2">
    							<!-- Show Date -->
    							<?php if($al_options['al_blog_show_date']): ?>
    								<h4><?php the_time('M jS, Y'); ?></h4>
    							<?php endif ?>
    							<div class="dividerslim"></div>
    
    							<?php if($al_options['al_blog_show_author']): ?>
    								<h6 class="post-author">
    
    									<?php printf( __( 'Author: %1$s', 'Balance' ),  '<span class="color">'.get_the_author().'</span>') ?>
    
    								</h6>
    							<?php endif?>
    
    							<!-- Show Comments amount -->
    							<?php if( 'open' == $post->comment_status && $al_options['al_blog_show_comments']) : ?>
    								<h6 class="single-comments">
    									<?php _e('Comments: ', 'Balance') ?>
    									<?php comments_popup_link('0', '1', '%'); ?>
    								</h6>
    							<?php endif; ?>
    
    							 <!-- Show Categories -->
    							<?php if($al_options['al_blog_show_cats']): ?>
    								<h6>
    									<?php if ( count( get_the_category() ) ) : ?>
    										<?php $category = get_the_category();  if($category[0]):?>
    											<?php _e('Category: ', 'Balance') ?><a href="<?php echo get_category_link($category[0]->term_id )?>" class="color"><?php echo $category[0]->cat_name?></a>
    										<?php endif?>
    									<?php endif; ?>
    								</h6>
    							<?php endif?>
    
    							<div class="dividerslim"></div>
    						</div>
    						<div class="grid_6">
    							<h4>
    								<a href="<?php the_permalink(); ?>" class="post-title"><?php the_title()?></a>
    							</h4>
    							<?php the_content() ?>
    						</div>
    
    						<div class="clearsmall"></div>
    						<div class="dividerslim"></div>
    
    						<?php $tags_list = get_the_tag_list( '', '' );
    							if ( $tags_list ) : ?>
    							<div class="tagcloud single-cloud">Tags: <?php printf( __( '%s', 'Balance' ), $tags_list ); ?></div>
    						<?php endif; ?>   
    
    						<div class="clearsmall"></div>
    					</div>
    					<!--End Blog Post-->
    				</article>
    				<div class="clear"></div>
    
    			<?php $postcounter++; endwhile; // End the loop. Whew. ?>
    
    			<?php comments_template( '', true ); ?>
    			<?php $test = false; if ($test) {comment_form(); wp_link_pages( $args );} ?>
    			<div class="clearsmall"></div>
    
    		</div>
    		<?php if($al_options['al_fullwidth_single'] == '1'): ?>
    			<aside class="grid_3 sidebarright alignright">
    			   <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Global Sidebar") ) : ?> <?php   endif;?>
    			</aside>
    		<?php endif?>
    		<div class="clearfix"></div>
    
    	</div>
    <?php get_footer(); ?>
    </div>

    single-portfolio.php

    <?php
    /**
     * Portfolio Single Posts template.
     */
    
    get_header(); ?>
    
    <?php  $al_options = get_option('al_general_settings'); ?>
    <!-- Title -->
    <div class="box">
    	<!-- Title -->
    	<div class="headertext">
    		<?php the_title() ?>
    		<?php $headline = get_post_meta($post->ID, "_headline", $single = false);?>
    		<?php if(!empty($headline[0]) ):?>
    			<span><?php echo $headline[0] ?></span>
    		<?php endif?>
    	</div>
    	<div class="clearsmall"></div>
    	<div class="container_12">
        	<div class="grid_12_no_margin">
    			<?php if ( have_posts() ) while ( have_posts() ) :   the_post();  ?>
    				<?php the_content();  ?>
                <?php  endwhile ?>
    			<?php //comments_template( '', true ); ?>
    			<!--<div class="clear"></div>-->
            </div>
            <div class="clearnospacing"></div>
    	</div>
    <?php get_footer(); ?>
    </div>

    These are pieces that are being effected. not so much the Single.php as i have fixed the little error. But the single-portfolio.php won’t even who the page and i get a 404.

    Please help that would amazing.

    ericwied

    (@ericwied)

    Also Note based on the confusion of the conversation that was had above that Events manager works fully, and that it is effecting my theme is the issue I am also researching the init possibility.

    ericwied

    (@ericwied)

    I specifically found this in my functions.php relating to the custom post types and calling them. Maybe you see a discrepancy or conflict with the plugin here.

    /*-- Get page content (Used for pages with custom post types) --*/
    if(!function_exists('getPageContent'))
    {
    	function getPageContent($pageId)
    	{
    		if(!is_numeric($pageId))
    		{
    			return;
    		}
    		global $wpdb;
    		$sql_query = 'SELECT DISTINCT * FROM ' . $wpdb->posts .
    		' WHERE ' . $wpdb->posts . '.ID=' . $pageId;
    		$posts = $wpdb->get_results($sql_query);
    		if(!empty($posts))
    		{
    			foreach($posts as $post)
    			{
    				return nl2br($post->post_content);
    			}
    		}
    	}
    }
    
    /* -- Get page ID by Custom Field Value -- */
    function get_page_ID_by_custom_field_value($custom_field, $value)
    {
    	global $wpdb;
    	$page_ID = $wpdb->get_var("
    	    SELECT wposts.ID
        	FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
    	    WHERE wposts.ID = wpostmeta.post_id
        	AND wpostmeta.meta_key = '$custom_field'
    	    AND (wpostmeta.meta_value like '$value,%' OR wpostmeta.meta_value like '%,$value,%' OR wpostmeta.meta_value like '%,$value' OR wpostmeta.meta_value = '$value')
        	AND wposts.post_status = 'publish'
    	    AND wposts.post_type = 'page'
    		LIMIT 0, 1");
    
    	return $page_ID;
    }
    /*******************************************/

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    My suggestion is to use a plugin that creates custom post types, e.g.

    Custom Post Type UI (tested and has fixed this problem before)
    Pods – recently discovered, looks good.

    Create a custom post type ‘portafolio’, this shouldn’t clash with your theme, but it’ll create the post type in the right place and hopefully correct the problem whilst working in tandem with whatever features your theme adds to the CPT

    ericwied

    (@ericwied)

    Ok so im not sure if its the current updates of the new events manager plugin fixed the problem or not, but after installing custom post type ui I did exactly as you said and made a post type named “portafolio”, I then checked on the status of my regular custom post type of portfolio, and it turns out they now work.

    To ensure the plugin was the reason for the post types working I deactivated the cpt ui plugin and the original post types are still working.

    I am not sure if it was you guys marcus that made the post types working or if CPT UI somehow miraculously fixed some stuff after installing to fix all the post types again or not but it worked and I am happy.

    Although, I do need to mention that my theme and the problem i had if not being solved miraculously by itself after an installation of CPT, CPT would not solve my problem.

    Because my theme has built in hooks and information in the custom post type “portfolio” that it uses in the theme to make the intended result work, just a bit of info for you guys developing this plugin to think about.

    Finally after thanking you for your help marcus, I would like to make a suggestion to the plugin not related to this issue,

    In allowing the cancelation of bookings it would extremely beneficial if we can set the amount of time a user/guest has to cancel their booking, before the start of the event.

    IE customers can only cancel their booking if it is 12 hours before the start time of the event.

    So in recap CPT has “solved” my problem but not in the way it was intended to per your suggestion and other past use cases. At least not with my theme, as of now I don’t have the cpt plugin activated and my post types still work.

    Thanks again for your help Marcus

    Eric

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Hi Eric,

    My guess is if you try resaving your permalinks without the CPT ui plugin enabled, it’ll break. If not, well leave it at that then ??

    r.e. your suggestion, certainly something we’ll be considering in the future, but it’ll take a while given we have a lot of features to work through atm.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Event setting problem with permalink for others custom types’ is closed to new replies.