Plugin Directory

Changeset 1833370


Ignore:
Timestamp:
03/05/2018 02:27:54 AM (8 years ago)
Author:
broobe_dev
Message:

version 2.7

Location:
social-articles/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • social-articles/trunk/includes/admin/assets/css/sa-admin-settings.css

    r1821721 r1833370  
    627627    opacity: .6;
    628628}
     629
     630
     631#addons-tab{
     632    float:right;
     633}
  • social-articles/trunk/includes/admin/social-articles-options.php

    r1821721 r1833370  
    2121        $options['allow_author_adition'] = isset($_POST['allow_author_adition']) ? $_POST['allow_author_adition'] : '';
    2222        $options['allow_author_deletion'] = isset($_POST['allow_author_deletion']) ? $_POST['allow_author_deletion'] : '';
     23        $options['show_to_logged_out_users'] = isset($_POST['show_to_logged_out_users']) ? $_POST['show_to_logged_out_users'] : '';
    2324
    2425        $options = apply_filters('saf_save_extra_settings',$options); //followers
    2526        $options = apply_filters('sa_save_extra_settings',$options); //toolbox
    26        
     27
    2728        update_option('social_articles_options', $options);
    2829
  • social-articles/trunk/includes/admin/tabs/social-articles-general-settings.php

    r1821721 r1833370  
    1515    $status = "";
    1616    $msg = "";
    17     if(!function_exists("friends_get_friend_user_ids")){
     17    if(!function_exists("friends_get_friend_user_ids") || !function_exists('bp_notifications_add_notification')){
    1818        $status="disabled";
    19         $msg=__("To use this feature, you need to activate bb Friend Connections module.", "social-articles");
     19        $msg=__("To use this feature, you need to activate BP Friend Connections module and Notifications module.", "social-articles");
    2020    }
    2121
     
    5454    );
    5555
     56    $rows[] = array(
     57        'id'      => 'show_to_logged_out_users',
     58        'label'   => __('Show articles in logged out users profile','social-articles'),
     59        'content' => $socialArticles->select( 'show_to_logged_out_users', array(
     60            'false' => __('False', 'social-articles'),
     61            'true'  => __('True', 'social-articles'),
     62        ), false
     63        ),
     64    );
     65
    5666    $rows = apply_filters('sa_add_extra_settings',$rows,$socialArticles);
    5767   
  • social-articles/trunk/includes/social-articles-functions.php

    r1821721 r1833370  
    6464    global $bp, $socialArticles;
    6565
    66     $savedPost = get_post($id);
    67     $notification_already_sent = get_post_meta($id, 'notification_already_sent', true);
    68     if(empty($notification_already_sent) &&
    69         $savedPost->post_status == "publish" &&
    70         $savedPost->post_type=="post" &&
    71         !wp_is_post_revision($id)):
    72 
    73         $friends = array();
    74         if (function_exists("friends_get_friend_user_ids") &&
    75             $socialArticles->options['bp_notifications'] == "true"){
    76             $friends = friends_get_friend_user_ids($savedPost->post_author);
    77         }
    78 
    79         $friends = apply_filters('saf_add_extra_friends', $friends, $savedPost->post_author, $socialArticles);
    80 
    81         foreach($friends as $friend):
    82             bp_notifications_add_notification(array(
    83                 'user_id'           => $friend,
    84                 'item_id'           => $savedPost->ID,
    85                 'secondary_item_id' => $savedPost->post_author,
    86                 'component_name'    => $bp->social_articles->id,
    87                 'component_action'  => 'new_article'.$savedPost->ID,
    88                 'date_notified'     =>  bp_core_current_time(),
    89                 'is_new'            => 1,
    90                 'allow_duplicate'   => false,
    91             ));
    92         endforeach;
    93 
    94         if(!isDirectWorkflow()) {
    95             bp_notifications_add_notification(array(
    96                 'user_id' => $savedPost->post_author,
    97                 'item_id' => $savedPost->ID,
    98                 'secondary_item_id' => -1,
    99                 'component_name' => $bp->social_articles->id,
    100                 'component_action' => 'new_article' . $savedPost->ID,
    101                 'date_notified' => bp_core_current_time(),
    102                 'is_new' => 1,
    103                 'allow_duplicate' => false,
    104             ));
    105         }
    106         update_post_meta($id, 'notification_already_sent', true);
    107 
    108     endif;
     66    if(function_exists('bp_notifications_add_notification')) {
     67        $savedPost = get_post($id);
     68        $notification_already_sent = get_post_meta($id, 'notification_already_sent', true);
     69        if (empty($notification_already_sent) &&
     70            $savedPost->post_status == "publish" &&
     71            $savedPost->post_type == "post" &&
     72            !wp_is_post_revision($id)
     73        ):
     74
     75            $friends = array();
     76            if (function_exists("friends_get_friend_user_ids") &&
     77                $socialArticles->options['bp_notifications'] == "true"
     78            ) {
     79                $friends = friends_get_friend_user_ids($savedPost->post_author);
     80            }
     81
     82            $friends = apply_filters('saf_add_extra_friends', $friends, $savedPost->post_author, $socialArticles);
     83
     84            foreach ($friends as $friend):
     85                bp_notifications_add_notification(array(
     86                    'user_id' => $friend,
     87                    'item_id' => $savedPost->ID,
     88                    'secondary_item_id' => $savedPost->post_author,
     89                    'component_name' => $bp->social_articles->id,
     90                    'component_action' => 'new_article' . $savedPost->ID,
     91                    'date_notified' => bp_core_current_time(),
     92                    'is_new' => 1,
     93                    'allow_duplicate' => false,
     94                ));
     95            endforeach;
     96
     97            if (!isDirectWorkflow()) {
     98                bp_notifications_add_notification(array(
     99                    'user_id' => $savedPost->post_author,
     100                    'item_id' => $savedPost->ID,
     101                    'secondary_item_id' => -1,
     102                    'component_name' => $bp->social_articles->id,
     103                    'component_action' => 'new_article' . $savedPost->ID,
     104                    'date_notified' => bp_core_current_time(),
     105                    'is_new' => 1,
     106                    'allow_duplicate' => false,
     107                ));
     108            }
     109            update_post_meta($id, 'notification_already_sent', true);
     110
     111        endif;
     112    }
    109113}
    110114
  • social-articles/trunk/includes/social-articles-load.php

    r1821721 r1833370  
    7070       
    7171        $user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
     72        $publishCount = '';
     73        $pendingCount = '';
     74        $draftCount = '';
    7275
    7376        if(bp_displayed_user_id()==bp_loggedin_user_id()){
    74 
    75             $publishCount = '';
    76             $pendingCount = '';
    77             $draftCount = '';
    78 
    7977            $sub_nav[] = array(
    8078                'name'            =>  sprintf( __("Published", "social-articles").'<span>%s</span>', $publishCount),
     
    113111                'position'        => 40
    114112            );
     113        }else {
     114            if ($options['show_to_logged_out_users'] == 'true'){
     115                $sub_nav[] = array(
     116                    'name' => '',
     117                    'slug' => 'articles',
     118                    'parent_url' => $social_articles_link,
     119                    'parent_slug' => SA_SLUG,
     120                    'screen_function' => 'my_articles_screen',
     121                    'position' => 10
     122                );
     123            }
    115124        }
    116125        if($this->check_visibility()){
    117126            parent::setup_nav( $main_nav, $sub_nav );
     127        }else{
     128            if ($options['show_to_logged_out_users'] == 'true') {
     129                parent::setup_nav($main_nav, $sub_nav);
     130            }
    118131        }
    119132    }
     
    150163            $wp_admin_nav[] = array(
    151164                'parent' => 'my-account-social-articles',
     165                'id'=>'article-new-item',
    152166                'title'  => sprintf( __( 'New Article', 'social-articles' )),
    153167                'href'   => trailingslashit( $user_domain.'articles/new' )
  • social-articles/trunk/readme.txt

    r1821759 r1833370  
    66Tested up to: 4.9.4
    77Requires PHP: 5.6
    8 Stable tag: 2.6
     8Stable tag: 2.7
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7575
    7676== Changelog ==
     77
     78= 2.7 =
     79* New option to show articles in not logged in users profile
     80* Bug Fixing: Check that notification module is active
     81* Bug Fixing: Clean some debug errors
    7782
    7883= 2.6 =
  • social-articles/trunk/social-articles.php

    r1821721 r1833370  
    33 Plugin Name: Social Articles
    44 Description: This is the first BuddyPress plugin that let you to create and manage posts from your profile. It supports all buddypres themes, so you don't need to be an expert to use it!
    5  Version: 2.6
     5 Version: 2.7
    66 Author: Broobe
    77 Author URI: http://www.broobe.com
     
    7878            spl_autoload_register('sa_fields_autoload');
    7979
    80             define('SA_PLUGIN_VERSION', '2.5');
     80            define('SA_PLUGIN_VERSION', '2.7');
    8181            define('SA_PLUGIN_DIR', dirname(__FILE__));
    8282            define('SA_SLUG', 'articles');
     
    135135                $options['published_post_counter'] = 'true';
    136136
     137            if (!isset($options['show_to_logged_out_users']))
     138                $options['show_to_logged_out_users'] = 'true';
     139
     140
    137141            update_option('social_articles_options', $options);
    138142        }
Note: See TracChangeset for help on using the changeset viewer.