Plugin Directory

Changeset 952024


Ignore:
Timestamp:
07/21/2014 07:43:06 AM (12 years ago)
Author:
gchokeen
Message:

Shortcode added to display subscriber favourite author posts

Location:
wp-subscribe-author/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-subscribe-author/trunk/classes/Model/wpsa_model.php

    r924385 r952024  
    122122    } 
    123123
     124    /*
     125     * @method getFavouriteAuthors will extract the favourite author ids of subscriber
     126     * @param int $subscriber_id
     127     * @since 1.6.5
     128     * @return object
     129     */
     130    public function getFavouriteAuthors($subscriber_id){       
     131        global $wpdb;
     132       
     133        return $authors = $wpdb->get_results($wpdb->prepare( "SELECT author_id FROM $this->tbl_wpsa_subscribe_author WHERE subscriber_id = %d AND status = %s",$subscriber_id,'active'));
    124134
     135    }
    125136   
    126137
  • wp-subscribe-author/trunk/classes/wpsa_shortcode.php

    r873932 r952024  
     1<?php
     2
     3if (!class_exists('WPSA_Shortcode')) {
     4   
     5    class WPSA_Shortcode{
     6       
     7        private $wpsamodel = null;
     8       
     9        function __construct(){
     10       
     11            ## Register shortcodes
     12            add_shortcode( 'favourite-author-posts', array(&$this, 'favourite_author_posts_handler' ) );
     13           
     14            $this->wpsamodel = new Wpsa_Model();
     15       
     16        }   
     17
     18        public function  favourite_author_posts_handler($atts){
     19       
     20            $html = '';
     21            $user_id = get_current_user_id();
     22           
     23            if(!empty($user_id)){
     24
     25               
     26                $authors = $this->wpsamodel->getFavouriteAuthors($user_id);
     27               
     28                if(count($authors)){
     29                   
     30                $author_ids = array();
     31                foreach($authors as $author){
     32                    $author_ids[] = $author->author_id;
     33                }
     34
     35                $args = array( 'author__in' => $author_ids );
     36               
     37               
     38                // the query
     39                $author_query = new WP_Query( $args ); ?>
     40               
     41                <?php if ( $author_query->have_posts() ) : ?>
     42
     43                  <?php while ( $author_query->have_posts() ) : $author_query->the_post(); ?>
     44                    <?php $html .= $this->load_template_part('content','favourite-author-posts'); ?>
     45                  <?php endwhile; ?>
     46
     47                  <?php wp_reset_postdata(); ?>
     48               
     49                <?php else:  ?>
     50                    <p><?php _e( 'Sorry, no posts found from your favourite authors.' ); ?></p>
     51                <?php endif;   
     52
     53                }
     54           
     55            }
     56            return $html;
     57        }
     58
     59       
     60        private function load_template_part($template_name, $part_name=null) {
     61            ob_start();
     62            get_template_part($template_name, $part_name);
     63            $var = ob_get_contents();
     64            ob_end_clean();
     65            return $var;
     66        }
     67       
     68       
     69       
     70    }
     71   
     72   
     73    $wpsa_shortcode =new WPSA_Shortcode();
     74   
     75}
  • wp-subscribe-author/trunk/readme.txt

    r937731 r952024  
    55Requires at least: 2.8
    66Tested up to: 3.9.1
    7 Stable tag: 1.6.1
     7Stable tag: 1.6.5
    88License: GPLv2
    99
     
    1616
    1717Please check the FAQ section.
     18
     19Display subscriber favourite author posts using this shortcode **[favourite-author-posts]** - It will work only for logged in subscribers!
    1820
    1921
     
    3739
    3840= Can Guest user subcribe author post ? =
    39  yep, plugin supports guest user subscription option from verion 1.6 .
     41Yes, plugin supports guest user subscription option from verion 1.6 .
    4042 
     43 = Can I customize the favourite author posts template ? =
     44 Yes, we can customize the template. You can create your custom code template on your active theme with the name **content-favourite-author-posts.php**. If you don't create this file, plugin will find the **content.php** from your active
     45 wordpress theme.
    4146 
    4247
     
    4651* Initial release.
    4752= 1.1 =
    48 * english translation support added.
     53* English translation support added.
    4954= 1.5 =
    5055* Object Oriented Programming style.
     
    5661= 1.6.1 =
    5762* Bug fix: ajax loading text added
    58 
     63= 1.6.5 =
     64* Shortcode added to display subscriber favourite author posts
    5965
    6066== Upgrade Notice ==
  • wp-subscribe-author/trunk/wp-subscribe-author.php

    r937731 r952024  
    44Plugin URI: http://wordpress.org/extend/plugins/wp-subscribe-author/
    55Description: Wp Subscribe Author plugin is help subscriber to follow his/her favourite author. Once subscriber starts follow the author, he will get notified all new post of author by email.
    6 Version: 1.6.1
     6Version: 1.6.5
    77Author: Gowri Sankar Ramasamy
    88Author URI: http://code-cocktail.in/author/gowrisankar/
     
    1313
    1414/* 
    15     Copyright 2012  Gowri Sankar Ramasamy  (email : [email protected])
     15    Copyright 2014  Gowri Sankar Ramasamy  (email : [email protected])
    1616
    1717    This program is free software; you can redistribute it and/or modify
     
    3636require_once (dirname(__FILE__) . '/classes/Model/wpsa_model.php');
    3737require_once (dirname(__FILE__) . '/classes/wpsa_template.php');
    38 //require_once (dirname(__FILE__) . '/classes/wpsa_shortcode.php');
     38require_once (dirname(__FILE__) . '/classes/wpsa_shortcode.php');
    3939
    4040require_once (dirname(__FILE__) . '/wpsa-ajax.php');
     
    4444define('WPSA_PLUGIN_NAME', plugin_basename(__FILE__));
    4545define('WPSA_PLUGIN_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
    46 define('WPSA_PLUGIN_VERSION','2.0');
     46define('WPSA_PLUGIN_VERSION','1.6.5');
    4747
    4848if (!class_exists('Wp_Subscribe_Author')) {
Note: See TracChangeset for help on using the changeset viewer.