Ditty News Ticker - Version 2.1.0

Version Description

  • Added custom capabilities for the ditty_news_ticker post type and settings
Download this release

Release Info

Developer metaphorcreations
Plugin Icon 128x128 Ditty News Ticker
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.18 to 2.1.0

ditty-news-ticker.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
  Text Domain: ditty-news-ticker
7
  Domain Path: languages
8
- Version: 2.0.18
9
  Author: Metaphor Creations
10
  Author URI: http://www.metaphorcreations.com
11
  Contributors: metaphorcreations
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
 
32
 
33
 
34
- define ( 'MTPHR_DNT_VERSION', '2.0.18' );
35
  define ( 'MTPHR_DNT_DIR', trailingslashit(plugin_dir_path(__FILE__)) );
36
  define ( 'MTPHR_DNT_URL', trailingslashit(plugins_url()).'ditty-news-ticker/' );
37
 
@@ -81,6 +81,7 @@ if( is_admin() ) {
81
 
82
  function mtphr_dnt_activation() {
83
  mtphr_dnt_posttype();
 
84
  flush_rewrite_rules();
85
  }
86
  register_activation_hook( __FILE__, 'mtphr_dnt_activation' );
@@ -119,3 +120,63 @@ function mtphr_dnt_unyson_extension( $locations ) {
119
  }
120
  add_filter( 'fw_extensions_locations', 'mtphr_dnt_unyson_extension' );
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
  Text Domain: ditty-news-ticker
7
  Domain Path: languages
8
+ Version: 2.1.0
9
  Author: Metaphor Creations
10
  Author URI: http://www.metaphorcreations.com
11
  Contributors: metaphorcreations
31
 
32
 
33
 
34
+ define ( 'MTPHR_DNT_VERSION', '2.1.0' );
35
  define ( 'MTPHR_DNT_DIR', trailingslashit(plugin_dir_path(__FILE__)) );
36
  define ( 'MTPHR_DNT_URL', trailingslashit(plugins_url()).'ditty-news-ticker/' );
37
 
81
 
82
  function mtphr_dnt_activation() {
83
  mtphr_dnt_posttype();
84
+ mtphr_dnt_custom_caps();
85
  flush_rewrite_rules();
86
  }
87
  register_activation_hook( __FILE__, 'mtphr_dnt_activation' );
120
  }
121
  add_filter( 'fw_extensions_locations', 'mtphr_dnt_unyson_extension' );
122
 
123
+
124
+
125
+ /* --------------------------------------------------------- */
126
+ /* !Add capabilities - 2.1.0 */
127
+ /* --------------------------------------------------------- */
128
+
129
+ function mtphr_dnt_custom_caps() {
130
+
131
+ $caps_added = get_option( 'mtphr_dnt_caps', false );
132
+ if( !$caps_added ) {
133
+
134
+ // gets the administrator role
135
+ $admins = get_role( 'administrator' );
136
+ $editors = get_role( 'editor' );
137
+ $authors = get_role( 'author' );
138
+ $contributors = get_role( 'contributor' );
139
+ $subscribers = get_role( 'subscriber' );
140
+
141
+ $admins->add_cap( 'edit_ditty_news_tickers' );
142
+ $admins->add_cap( 'edit_others_ditty_news_tickers' );
143
+ $admins->add_cap( 'publish_ditty_news_tickers' );
144
+ $admins->add_cap( 'read_private_ditty_news_tickers' );
145
+ $admins->add_cap( 'read_ditty_news_tickers' );
146
+ $admins->add_cap( 'delete_ditty_news_tickers' );
147
+ $admins->add_cap( 'delete_private_ditty_news_tickers' );
148
+ $admins->add_cap( 'delete_published_ditty_news_tickers' );
149
+ $admins->add_cap( 'delete_others_ditty_news_tickers' );
150
+ $admins->add_cap( 'edit_private_ditty_news_tickers' );
151
+ $admins->add_cap( 'edit_published_ditty_news_tickers' );
152
+
153
+ $editors->add_cap( 'edit_ditty_news_tickers' );
154
+ $editors->add_cap( 'edit_others_ditty_news_tickers' );
155
+ $editors->add_cap( 'publish_ditty_news_tickers' );
156
+ $editors->add_cap( 'read_private_ditty_news_tickers' );
157
+ $editors->add_cap( 'read_ditty_news_tickers' );
158
+ $editors->add_cap( 'delete_ditty_news_tickers' );
159
+ $editors->add_cap( 'delete_private_ditty_news_tickers' );
160
+ $editors->add_cap( 'delete_published_ditty_news_tickers' );
161
+ $editors->add_cap( 'delete_others_ditty_news_tickers' );
162
+ $editors->add_cap( 'edit_private_ditty_news_tickers' );
163
+ $editors->add_cap( 'edit_published_ditty_news_tickers' );
164
+
165
+ $authors->add_cap( 'edit_ditty_news_tickers' );
166
+ $authors->add_cap( 'publish_ditty_news_tickers' );
167
+ $authors->add_cap( 'read_ditty_news_tickers' );
168
+ $authors->add_cap( 'delete_ditty_news_tickers' );
169
+ $authors->add_cap( 'delete_published_ditty_news_tickers' );
170
+ $authors->add_cap( 'edit_published_ditty_news_tickers' );
171
+
172
+ $contributors->add_cap( 'edit_ditty_news_tickers' );
173
+ $contributors->add_cap( 'read_ditty_news_tickers' );
174
+ $contributors->add_cap( 'delete_ditty_news_tickers' );
175
+
176
+ $subscribers->add_cap( 'read_ditty_news_tickers' );
177
+
178
+ update_option( 'mtphr_dnt_caps', 'added' );
179
+ }
180
+ }
181
+ add_action( 'init', 'mtphr_dnt_custom_caps');
182
+
includes/post-types.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
 
4
  /* --------------------------------------------------------- */
5
- /* !Add the post type - 1.4.4 */
6
  /* --------------------------------------------------------- */
7
 
8
  function mtphr_dnt_posttype() {
@@ -35,7 +35,22 @@ function mtphr_dnt_posttype() {
35
  'menu_icon' => 'dashicons-format-status',
36
  'supports' => array( 'title', 'author' ),
37
  'rewrite' => array( 'slug' => __( 'ticker', 'ditty-news-ticker' ) ),
38
- 'show_in_nav_menus' => true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  );
40
 
41
  register_post_type( 'ditty_news_ticker', $args );
2
 
3
 
4
  /* --------------------------------------------------------- */
5
+ /* !Add the post type - 2.1.0 */
6
  /* --------------------------------------------------------- */
7
 
8
  function mtphr_dnt_posttype() {
35
  'menu_icon' => 'dashicons-format-status',
36
  'supports' => array( 'title', 'author' ),
37
  'rewrite' => array( 'slug' => __( 'ticker', 'ditty-news-ticker' ) ),
38
+ 'show_in_nav_menus' => true,
39
+ 'capabilities' => array(
40
+ 'edit_posts' => 'edit_ditty_news_tickers',
41
+ 'edit_others_posts' => 'edit_others_ditty_news_tickers',
42
+ 'publish_posts' => 'publish_ditty_news_tickers',
43
+ 'read_private_posts' => 'read_private_ditty_news_tickers',
44
+ 'read' => 'read_ditty_news_tickers',
45
+ 'delete_posts' => 'delete_ditty_news_tickers',
46
+ 'delete_private_posts' => 'delete_private_ditty_news_tickers',
47
+ 'delete_published_posts' => 'delete_published_ditty_news_tickers',
48
+ 'delete_others_posts' => 'delete_others_ditty_news_tickers',
49
+ 'edit_private_posts' => 'edit_private_ditty_news_tickers',
50
+ 'edit_published_posts' => 'edit_published_ditty_news_tickers',
51
+ ),
52
+ // as pointed out by iEmanuele, adding map_meta_cap will map the meta correctly
53
+ 'map_meta_cap' => true
54
  );
55
 
56
  register_post_type( 'ditty_news_ticker', $args );
includes/settings.php CHANGED
@@ -8,9 +8,9 @@ function mtphr_dnt_settings_menu() {
8
 
9
  add_submenu_page(
10
  'edit.php?post_type=ditty_news_ticker', // The ID of the top-level menu page to which this submenu item belongs
11
- __( 'Settings', 'ditty-news-ticker' ), // The value used to populate the browser's title bar when the menu page is active
12
- __( 'Settings', 'ditty-news-ticker' ), // The label of this submenu item displayed in the menu
13
- 'administrator', // What roles are able to access this submenu item
14
  'mtphr_dnt_settings', // The ID used to represent this submenu item
15
  'mtphr_dnt_settings_display' // The callback function used to render the options for this submenu item
16
  );
8
 
9
  add_submenu_page(
10
  'edit.php?post_type=ditty_news_ticker', // The ID of the top-level menu page to which this submenu item belongs
11
+ __( 'Settings', 'ditty-news-ticker' ), // The value used to populate the browser's title bar when the menu page is active
12
+ __( 'Settings', 'ditty-news-ticker' ), // The label of this submenu item displayed in the menu
13
+ 'modify_ditty_news_ticker_settings', // What roles are able to access this submenu item
14
  'mtphr_dnt_settings', // The ID used to represent this submenu item
15
  'mtphr_dnt_settings_display' // The callback function used to render the options for this submenu item
16
  );
readme.txt CHANGED
@@ -68,6 +68,9 @@ Each individual Ticker post has multiple settings to customize.
68
 
69
  == Changelog ==
70
 
 
 
 
71
  = 2.0.18 =
72
  * .mtphr-dnt-image-container css display update
73
  * Metabox text update
@@ -387,4 +390,4 @@ Each individual Ticker post has multiple settings to customize.
387
 
388
  == Upgrade Notice ==
389
 
390
- .mtphr-dnt-image-container css display update & metabox text update
68
 
69
  == Changelog ==
70
 
71
+ = 2.1.0 =
72
+ * Added custom capabilities for the ditty_news_ticker post type and settings
73
+
74
  = 2.0.18 =
75
  * .mtphr-dnt-image-container css display update
76
  * Metabox text update
390
 
391
  == Upgrade Notice ==
392
 
393
+ Added custom capabilities for the ditty_news_ticker post type and settings