Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • I think he refers to having option to use both on comment and bbpress input areas… would be really nice addition to have it work with bbpress as well 🙂

    Cheers!

    Any update on this? 🙂

    Nginx is becoming extremely popular webserver (I moved completely to nginx on all my VPS’s and servers) so added support for it out of the box would be extremely useful.

    Thread Starter teknoledge

    (@teknoledge)

    Anyone?

    Thread Starter teknoledge

    (@teknoledge)

    I figured out that this has nothing to do with wordpress, it’s server/hosting security flaw that need’s to be checked. The same peace of code I found on couple of .NET coded websites so it’s definitely hosting related issue.

    Forum: Plugins
    In reply to: post expire plugin issue
    Thread Starter teknoledge

    (@teknoledge)

    bump 🙂

    Forum: Plugins
    In reply to: post expire plugin issue
    Thread Starter teknoledge

    (@teknoledge)

    This is the plugin code:

    <?php
    /*
    Plugin Name: Posts Expire
    Description: Adds an expiry date to posts.
    Author: Michael O'Connell
    Version: 1.02
    Author URI: http://wunder-ful.com/
    
    	This plugin is released under version 2 of the GPL:
    	http://www.opensource.org/licenses/gpl-license.php
    */
    class posts_expire
    {
    	function posts_expire()
    	{
    		global $wpdb;
    		if ( !get_settings('posts_have_end_date') )
    		{
    			$wpdb->query("ALTER TABLE <code>$wpdb->posts</code> ADD <code>post_end_date</code> DATE AFTER <code>post_date</code>");
    			update_option('posts_have_end_date', 1);
    		}
    
    		add_filter('posts_where', array(&$this, 'add_where_clause'));
    		add_filter('posts_orderby', array(&$this, 'add_orderby')); //bypass orderby safety check
    		add_action('simple_edit_form', array(&$this, 'add_end_date_input'));
    		add_action('edit_form_advanced', array(&$this, 'add_end_date_input'));
    		add_action('edit_page_form', array(&$this, 'add_end_date_input'));
    		add_action('save_post', array(&$this, 'add_update_statement'));
    	}
    
    	function add_where_clause($where)
    	{
    		if(get_settings('show_expired_posts') || is_admin() || is_single())
    			return $where;
    
    		//exclude nulls when getting a list of posts that expire soon
    		$include_nulls = !($_GET['orderby'] == 'post_end_date');	
    
    		$now = date('Y-m-d') . ' 23:59:59'; //timezone not taken into consideration...
    
    		$where = $where . " AND (post_end_date >= '$now'";
    		if($include_nulls)
    			$where = $where . ' OR  post_end_date IS NULL';
    		$where = $where . ')';
    
    		return $where;
    	}
    
    	function add_orderby($orderby)
    	{
    		if($_GET['orderby'] == 'post_end_date')
    			return '<code>post_end_date</code> ASC';
    		else
    			return $orderby;
    	}
    
    	function add_end_date_input()
    	{
    		$end_date = get_end_date();
    		echo "<div>Enter a end date (yyyy-mm-dd): <input type='text' name='end_date' value='$end_date'></input></div>";
    	}
    
    	function add_update_statement($post_ID)
    	{
    		global $wpdb;
    
    		$end_date = $_POST['end_date'];
    
    		if($end_date)
    			$wpdb->query("UPDATE <code>$wpdb->posts</code> SET <code>post_end_date</code> = '$end_date' WHERE <code>ID</code> =$post_ID LIMIT 1 ;");
    		else //remove existing end date if user blanks field
    			$wpdb->query("UPDATE <code>$wpdb->posts</code> SET <code>post_end_date</code> = NULL WHERE <code>ID</code> =$post_ID LIMIT 1 ;");
    	}
    }
    
    $posts_expire =& new posts_expire();
    
    function the_end_date($prefix = '')
    {
    	$end_date = mysql2date(get_settings('date_format'),get_end_date());
    
    	if(!$prefix)
    		$prefix = __('Expires ');
    
    	if(function_exists('get_begin_date') && get_begin_date())
    		$prefix = ', ' . $prefix;
    
    	if($end_date)
    		echo $prefix . $end_date;
    	else
    		echo __('Expiration Unknown');
    }
    
    function get_end_date()
    {
    	global $post;
    	return $post->post_end_date;
    }
    ?>

    I guess I should remove the filter “posts_where” for pages I want to show expired posts also, something like:

    remove_filter(‘posts_where’, ‘add_where_clause’); ??

    Thread Starter teknoledge

    (@teknoledge)

    I’m running 2.6.3. Thanks for the quick reply!

    Thread Starter teknoledge

    (@teknoledge)

    This seems like it can solve the problem. Thanks! 🙂

    Thread Starter teknoledge

    (@teknoledge)

    I’m using Flutter plugin to add custom fields to posts and I introduced new field called “Type” for all new post entries. Type field is dropdown with 2 possible values “code” and “offer”. For all new entries “Type” is defined with one of the 2 possible values but for older entries it’s undefined and because I have around 1000+ entries it’s impossible to edit each one to add and define new custom field. I set if the “Type” is not defined I take it as “code”.

    What I want to achieve is to have one query that will fetch all entries and have “Type” field values at the end:

    1) if “Type” is not set return meta_value = NULL at the end of the recordset
    2) if “Type” is “Code” return meta_value = Code at the end of the recordset
    3) if “Type” is “Offer” return meta_value = Offer at the end of the recordset

    This way I can identify each entry and act accordingly. Hope this makes sense

    Thread Starter teknoledge

    (@teknoledge)

    I used get_post_custom($post_id) instead and it works

    Thread Starter teknoledge

    (@teknoledge)

    @alexrabe
    Ah, exactly what I was looking for. 🙂

    @williwaw
    I was thinking more about permalinks for images e.g.

    wp-content/gallery/whatever/image-file-name-jpg/

    instead of:

    wp-content/gallery/whatever/image file name.jpg

    Also it would be good to add replacement of spaces (‘ ‘) with hyphens for uploaded images in the feature versions of NGG, I’m sure it’s not a big job.

    Cheers! 🙂

    Thread Starter teknoledge

    (@teknoledge)

    I was looking for a similar plugin but since I couldn’t find it decided to develop it 😉

    http://www.flairpair.com/blog/wordpress/category-custom-fields

    Supports WordPress 2.3+

    Forum: Plugins
    In reply to: Comments on category page
    Thread Starter teknoledge

    (@teknoledge)

    Works! Again, thanks a lot!

    Forum: Plugins
    In reply to: Comments on category page
    Thread Starter teknoledge

    (@teknoledge)

    One more thing :), I want to have 2 different comment templates, one for category.php and one for single.php page.

    This is working:
    <?php
    $wp_query->is_single = true;
    comments_template();
    $wp_query->is_single = false;
    ?>

    But this is not working:
    <?php
    $wp_query->is_single = true;
    include (TEMPLATEPATH . ‘/comments-slide.php’);
    $wp_query->is_single = false;
    ?>

    Any tip?

Viewing 15 replies - 1 through 15 (of 17 total)