Version Description
- Resolved custom capabilities bug
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.1.11 |
Comparing to | |
See all releases |
Code changes from version 2.1.10 to 2.1.11
- classes/class-mtphr-dnt-roles.php +124 -0
- ditty-news-ticker.php +7 -109
- includes/install.php +135 -0
- includes/post-types.php +6 -19
- includes/settings.php +2 -2
- readme.txt +6 -3
classes/class-mtphr-dnt-roles.php
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* MTPHR_DNT Roles and Capabilities
|
5 |
+
*
|
6 |
+
* @package MTPHR_DNT
|
7 |
+
* @subpackage Classes/MTPHR_DNT Roles
|
8 |
+
* @copyright Copyright (c) 2017, Metaphor Creations
|
9 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
+
* @since 2.1.11
|
11 |
+
*/
|
12 |
+
class MTPHR_DNT_Roles {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get things going
|
16 |
+
*
|
17 |
+
* @since 2.1.11
|
18 |
+
*/
|
19 |
+
public function __construct() {
|
20 |
+
}
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add new News Ticker specific capabilities
|
25 |
+
*
|
26 |
+
* @access public
|
27 |
+
* @since 2.1.11
|
28 |
+
* @global WP_Roles $wp_roles
|
29 |
+
* @return void
|
30 |
+
*/
|
31 |
+
public function add_caps() {
|
32 |
+
global $wp_roles;
|
33 |
+
|
34 |
+
if( class_exists('WP_Roles') ) {
|
35 |
+
if( !isset( $wp_roles ) ) {
|
36 |
+
$wp_roles = new WP_Roles();
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
if( is_object($wp_roles) ) {
|
41 |
+
|
42 |
+
/** Site Administrator Capabilities */
|
43 |
+
$wp_roles->add_cap( 'administrator', 'manage_ditty_news_ticker_settings' );
|
44 |
+
|
45 |
+
// Add the main post type capabilities
|
46 |
+
$capabilities = $this->get_core_caps();
|
47 |
+
foreach( $capabilities as $cap_group ) {
|
48 |
+
foreach( $cap_group as $cap ) {
|
49 |
+
$wp_roles->add_cap( 'administrator', $cap );
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Gets the core post type capabilities
|
58 |
+
*
|
59 |
+
* @access public
|
60 |
+
* @since 2.1.11
|
61 |
+
* @return array $capabilities Core post type capabilities
|
62 |
+
*/
|
63 |
+
public function get_core_caps() {
|
64 |
+
$capabilities = array();
|
65 |
+
|
66 |
+
$capability_types = array( 'ditty_news_ticker' );
|
67 |
+
|
68 |
+
foreach ( $capability_types as $capability_type ) {
|
69 |
+
$capabilities[ $capability_type ] = array(
|
70 |
+
// Post type
|
71 |
+
"edit_{$capability_type}",
|
72 |
+
"read_{$capability_type}",
|
73 |
+
"delete_{$capability_type}",
|
74 |
+
"edit_{$capability_type}s",
|
75 |
+
"edit_others_{$capability_type}s",
|
76 |
+
"publish_{$capability_type}s",
|
77 |
+
"read_private_{$capability_type}s",
|
78 |
+
"delete_{$capability_type}s",
|
79 |
+
"delete_private_{$capability_type}s",
|
80 |
+
"delete_published_{$capability_type}s",
|
81 |
+
"delete_others_{$capability_type}s",
|
82 |
+
"edit_private_{$capability_type}s",
|
83 |
+
"edit_published_{$capability_type}s",
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
return $capabilities;
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Remove core post type capabilities (called on uninstall)
|
93 |
+
*
|
94 |
+
* @access public
|
95 |
+
* @since 2.1.11
|
96 |
+
* @return void
|
97 |
+
*/
|
98 |
+
public function remove_caps() {
|
99 |
+
|
100 |
+
global $wp_roles;
|
101 |
+
|
102 |
+
if( class_exists('WP_Roles') ) {
|
103 |
+
if( !isset($wp_roles) ) {
|
104 |
+
$wp_roles = new WP_Roles();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
if( is_object($wp_roles) ) {
|
109 |
+
|
110 |
+
/** Administrator Capabilities */
|
111 |
+
$wp_roles->remove_cap( 'administrator', 'icc_manage_ticket_settings' );
|
112 |
+
|
113 |
+
/** Remove the Main Post Type Capabilities */
|
114 |
+
$capabilities = $this->get_core_caps();
|
115 |
+
|
116 |
+
foreach ( $capabilities as $cap_group ) {
|
117 |
+
foreach ( $cap_group as $cap ) {
|
118 |
+
$wp_roles->remove_cap( 'administrator', $cap );
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
}
|
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.1.
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
@@ -13,7 +13,7 @@ License: GPL2
|
|
13 |
*/
|
14 |
|
15 |
/*
|
16 |
-
Copyright
|
17 |
|
18 |
This program is free software; you can redistribute it and/or modify
|
19 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -31,8 +31,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
31 |
|
32 |
|
33 |
|
34 |
-
define
|
35 |
-
define
|
|
|
36 |
|
37 |
|
38 |
/* --------------------------------------------------------- */
|
@@ -72,29 +73,8 @@ if( is_admin() ) {
|
|
72 |
require_once( MTPHR_DNT_DIR.'includes/templates.php' );
|
73 |
}
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
/* --------------------------------------------------------- */
|
78 |
-
/* !Register the post type & flush the rewrite rules - 1.4.6 */
|
79 |
-
/* --------------------------------------------------------- */
|
80 |
-
|
81 |
-
function mtphr_dnt_activation() {
|
82 |
-
mtphr_dnt_posttype();
|
83 |
-
mtphr_dnt_custom_caps();
|
84 |
-
flush_rewrite_rules();
|
85 |
-
}
|
86 |
-
register_activation_hook( __FILE__, 'mtphr_dnt_activation' );
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
/* --------------------------------------------------------- */
|
91 |
-
/* !Flush the rewrite rules - 1.4.6 */
|
92 |
-
/* --------------------------------------------------------- */
|
93 |
-
|
94 |
-
function mtphr_dnt_deactivation() {
|
95 |
-
flush_rewrite_rules();
|
96 |
-
}
|
97 |
-
register_deactivation_hook( __FILE__, 'mtphr_dnt_deactivation' );
|
98 |
|
99 |
|
100 |
|
@@ -118,85 +98,3 @@ function mtphr_dnt_unyson_extension( $locations ) {
|
|
118 |
return $locations;
|
119 |
}
|
120 |
add_filter( 'fw_extensions_locations', 'mtphr_dnt_unyson_extension' );
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
/* --------------------------------------------------------- */
|
125 |
-
/* !Add capabilities - 2.1.0 */
|
126 |
-
/* --------------------------------------------------------- */
|
127 |
-
|
128 |
-
function mtphr_dnt_custom_caps() {
|
129 |
-
|
130 |
-
$caps_added = get_option( 'mtphr_dnt_caps', false );
|
131 |
-
if( !$caps_added ) {
|
132 |
-
|
133 |
-
$admins = get_role( 'administrator' );
|
134 |
-
$editors = get_role( 'editor' );
|
135 |
-
$authors = get_role( 'author' );
|
136 |
-
$contributors = get_role( 'contributor' );
|
137 |
-
$subscribers = get_role( 'subscriber' );
|
138 |
-
|
139 |
-
if( $admins ) {
|
140 |
-
$admins->add_cap( 'edit_ditty_news_tickers' );
|
141 |
-
$admins->add_cap( 'edit_others_ditty_news_tickers' );
|
142 |
-
$admins->add_cap( 'publish_ditty_news_tickers' );
|
143 |
-
$admins->add_cap( 'read_private_ditty_news_tickers' );
|
144 |
-
$admins->add_cap( 'read_ditty_news_tickers' );
|
145 |
-
$admins->add_cap( 'delete_ditty_news_tickers' );
|
146 |
-
$admins->add_cap( 'delete_private_ditty_news_tickers' );
|
147 |
-
$admins->add_cap( 'delete_published_ditty_news_tickers' );
|
148 |
-
$admins->add_cap( 'delete_others_ditty_news_tickers' );
|
149 |
-
$admins->add_cap( 'edit_private_ditty_news_tickers' );
|
150 |
-
$admins->add_cap( 'edit_published_ditty_news_tickers' );
|
151 |
-
$admins->add_cap( 'edit_published_ditty_news_tickers' );
|
152 |
-
$admins->add_cap( 'modify_ditty_news_ticker_settings' );
|
153 |
-
}
|
154 |
-
|
155 |
-
if( $editors ) {
|
156 |
-
$editors->add_cap( 'edit_ditty_news_tickers' );
|
157 |
-
$editors->add_cap( 'edit_others_ditty_news_tickers' );
|
158 |
-
$editors->add_cap( 'publish_ditty_news_tickers' );
|
159 |
-
$editors->add_cap( 'read_private_ditty_news_tickers' );
|
160 |
-
$editors->add_cap( 'read_ditty_news_tickers' );
|
161 |
-
$editors->add_cap( 'delete_ditty_news_tickers' );
|
162 |
-
$editors->add_cap( 'delete_private_ditty_news_tickers' );
|
163 |
-
$editors->add_cap( 'delete_published_ditty_news_tickers' );
|
164 |
-
$editors->add_cap( 'delete_others_ditty_news_tickers' );
|
165 |
-
$editors->add_cap( 'edit_private_ditty_news_tickers' );
|
166 |
-
$editors->add_cap( 'edit_published_ditty_news_tickers' );
|
167 |
-
}
|
168 |
-
|
169 |
-
if( $authors ) {
|
170 |
-
$authors->add_cap( 'edit_ditty_news_tickers' );
|
171 |
-
$authors->add_cap( 'publish_ditty_news_tickers' );
|
172 |
-
$authors->add_cap( 'read_ditty_news_tickers' );
|
173 |
-
$authors->add_cap( 'delete_ditty_news_tickers' );
|
174 |
-
$authors->add_cap( 'delete_published_ditty_news_tickers' );
|
175 |
-
$authors->add_cap( 'edit_published_ditty_news_tickers' );
|
176 |
-
}
|
177 |
-
|
178 |
-
if( $contributors ) {
|
179 |
-
$contributors->add_cap( 'edit_ditty_news_tickers' );
|
180 |
-
$contributors->add_cap( 'read_ditty_news_tickers' );
|
181 |
-
$contributors->add_cap( 'delete_ditty_news_tickers' );
|
182 |
-
}
|
183 |
-
|
184 |
-
if( $subscribers ) {
|
185 |
-
$subscribers->add_cap( 'read_ditty_news_tickers' );
|
186 |
-
}
|
187 |
-
|
188 |
-
update_option( 'mtphr_dnt_caps', 'added' );
|
189 |
-
}
|
190 |
-
|
191 |
-
if( $caps_added != '2_1_1' ) {
|
192 |
-
|
193 |
-
$admins = get_role( 'administrator' );
|
194 |
-
if( $admins ) {
|
195 |
-
$admins->add_cap( 'modify_ditty_news_ticker_settings' );
|
196 |
-
}
|
197 |
-
|
198 |
-
update_option( 'mtphr_dnt_caps', '2_1_1' );
|
199 |
-
}
|
200 |
-
}
|
201 |
-
add_action( 'init', 'mtphr_dnt_custom_caps');
|
202 |
-
|
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.11
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
13 |
*/
|
14 |
|
15 |
/*
|
16 |
+
Copyright 2018 Metaphor Creations (email : joe@metaphorcreations.com)
|
17 |
|
18 |
This program is free software; you can redistribute it and/or modify
|
19 |
it under the terms of the GNU General Public License, version 2, as
|
31 |
|
32 |
|
33 |
|
34 |
+
define( 'MTPHR_DNT_VERSION', '2.1.11' );
|
35 |
+
define( 'MTPHR_DNT_DIR', trailingslashit(plugin_dir_path( __FILE__ )) );
|
36 |
+
define( 'MTPHR_DNT_FILE', trailingslashit( __FILE__ ) );
|
37 |
|
38 |
|
39 |
/* --------------------------------------------------------- */
|
73 |
require_once( MTPHR_DNT_DIR.'includes/templates.php' );
|
74 |
}
|
75 |
|
76 |
+
require_once MTPHR_DNT_DIR.'classes/class-mtphr-dnt-roles.php';
|
77 |
+
require_once MTPHR_DNT_DIR.'includes/install.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
|
80 |
|
98 |
return $locations;
|
99 |
}
|
100 |
add_filter( 'fw_extensions_locations', 'mtphr_dnt_unyson_extension' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/install.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Install Function
|
4 |
+
*
|
5 |
+
* @package MTPHR_DNT
|
6 |
+
* @subpackage Functions/Install
|
7 |
+
* @copyright Copyright (c) 2017, Intrycks
|
8 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
+
* @since 2.1.11
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Install
|
17 |
+
*
|
18 |
+
* Runs on plugin install by setting up the post types, custom taxonomies,
|
19 |
+
* flushing rewrite rules to initiate the new 'mtphr_dnt_ticket' slug and also
|
20 |
+
* creates the plugin and populates the settings fields for those plugin
|
21 |
+
* pages. After successful install, the user is redirected to the MTPHR_DNT Welcome
|
22 |
+
* screen.
|
23 |
+
*
|
24 |
+
* @since 1.0
|
25 |
+
* @global $wpdb
|
26 |
+
* @global $mtphr_dnt_options
|
27 |
+
* @param bool $network_side If the plugin is being network-activated
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
+
|
31 |
+
|
32 |
+
function mtphr_dnt_install( $network_wide = false ) {
|
33 |
+
global $wpdb;
|
34 |
+
|
35 |
+
if( is_multisite() && $network_wide ) {
|
36 |
+
|
37 |
+
foreach( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
|
38 |
+
|
39 |
+
switch_to_blog( $blog_id );
|
40 |
+
mtphr_dnt_run_install();
|
41 |
+
restore_current_blog();
|
42 |
+
}
|
43 |
+
|
44 |
+
} else {
|
45 |
+
|
46 |
+
mtphr_dnt_run_install();
|
47 |
+
}
|
48 |
+
}
|
49 |
+
register_activation_hook( MTPHR_DNT_PLUGIN_FILE, 'mtphr_dnt_install' );
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Run the MTPHR_DNT Install process
|
54 |
+
*
|
55 |
+
* @since 2.1.11
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
+
function mtphr_dnt_run_install() {
|
59 |
+
|
60 |
+
global $wpdb, $mtphr_dnt_options;
|
61 |
+
|
62 |
+
if( empty($mtphr_dnt_options) ) {
|
63 |
+
$mtphr_dnt_options = array();
|
64 |
+
}
|
65 |
+
|
66 |
+
// Setup the MTPHR_DNT Custom Post Types
|
67 |
+
mtphr_dnt_setup_post_types();
|
68 |
+
|
69 |
+
// Clear the permalinks
|
70 |
+
flush_rewrite_rules( false );
|
71 |
+
|
72 |
+
// Add Upgraded From Option
|
73 |
+
$current_version = get_option( 'mtphr_dnt_version' );
|
74 |
+
if( $current_version ) {
|
75 |
+
update_option( 'mtphr_dnt_version_upgraded_from', $current_version );
|
76 |
+
}
|
77 |
+
|
78 |
+
update_option( 'mtphr_dnt_version', MTPHR_DNT_VERSION );
|
79 |
+
|
80 |
+
// Create MTPHR_DNT roles
|
81 |
+
$roles = new MTPHR_DNT_Roles;
|
82 |
+
//$roles->add_roles();
|
83 |
+
$roles->add_caps();
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* When a new Blog is created in multisite, see if MTPHR_DNT is network activated, and run the installer
|
89 |
+
*
|
90 |
+
* @since 2.1.11
|
91 |
+
* @param int $blog_id The Blog ID created
|
92 |
+
* @param int $user_id The User ID set as the admin
|
93 |
+
* @param string $domain The URL
|
94 |
+
* @param string $path Site Path
|
95 |
+
* @param int $site_id The Site ID
|
96 |
+
* @param array $meta Blog Meta
|
97 |
+
* @return void
|
98 |
+
*/
|
99 |
+
function mtphr_dnt_new_blog_created( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
|
100 |
+
|
101 |
+
if( is_plugin_active_for_network(plugin_basename(MTPHR_DNT_PLUGIN_FILE)) ) {
|
102 |
+
|
103 |
+
switch_to_blog( $blog_id );
|
104 |
+
mtphr_dnt_install();
|
105 |
+
restore_current_blog();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
add_action( 'wpmu_new_blog', 'mtphr_dnt_new_blog_created', 10, 6 );
|
109 |
+
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Install user roles on sub-sites of a network
|
113 |
+
*
|
114 |
+
* Roles do not get created when MTPHR_DNT is network activation so we need to create them during admin_init
|
115 |
+
*
|
116 |
+
* @since 2.1.11
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
function mtphr_dnt_install_roles_on_network() {
|
120 |
+
|
121 |
+
global $wp_roles;
|
122 |
+
|
123 |
+
if( !is_object($wp_roles) ) {
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
if( empty($wp_roles->roles) || !array_key_exists('mtphr_dnt_ticket_agent', $wp_roles->roles) ) {
|
128 |
+
|
129 |
+
// Create MTPHR_DNT roles
|
130 |
+
$roles = new MTPHR_DNT_Roles;
|
131 |
+
//$roles->add_roles();
|
132 |
+
$roles->add_caps();
|
133 |
+
}
|
134 |
+
}
|
135 |
+
add_action( 'admin_init', 'mtphr_dnt_install_roles_on_network' );
|
includes/post-types.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
|
3 |
|
4 |
/* --------------------------------------------------------- */
|
5 |
-
/* !Add the post type - 2.1.
|
6 |
/* --------------------------------------------------------- */
|
7 |
|
8 |
-
function
|
9 |
|
10 |
$labels = array(
|
11 |
'name' => __( 'News Tickers', 'ditty-news-ticker' ),
|
@@ -28,7 +28,9 @@ function mtphr_dnt_posttype() {
|
|
28 |
'public' => true,
|
29 |
'publicly_queryable' => true,
|
30 |
'exclude_from_search' => true,
|
31 |
-
'show_ui' => true,
|
|
|
|
|
32 |
'show_in_menu' => true,
|
33 |
'query_var' => true,
|
34 |
'rewrite' => true,
|
@@ -36,26 +38,11 @@ function mtphr_dnt_posttype() {
|
|
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 );
|
57 |
}
|
58 |
-
add_action( 'init','
|
59 |
|
60 |
|
61 |
|
2 |
|
3 |
|
4 |
/* --------------------------------------------------------- */
|
5 |
+
/* !Add the post type - 2.1.11 */
|
6 |
/* --------------------------------------------------------- */
|
7 |
|
8 |
+
function mtphr_dnt_setup_post_types() {
|
9 |
|
10 |
$labels = array(
|
11 |
'name' => __( 'News Tickers', 'ditty-news-ticker' ),
|
28 |
'public' => true,
|
29 |
'publicly_queryable' => true,
|
30 |
'exclude_from_search' => true,
|
31 |
+
'show_ui' => true,
|
32 |
+
'capability_type' => 'ditty_news_ticker',
|
33 |
+
'map_meta_cap' => true,
|
34 |
'show_in_menu' => true,
|
35 |
'query_var' => true,
|
36 |
'rewrite' => true,
|
38 |
'supports' => array( 'title', 'author' ),
|
39 |
'rewrite' => array( 'slug' => __( 'ticker', 'ditty-news-ticker' ) ),
|
40 |
'show_in_nav_menus' => true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
);
|
42 |
|
43 |
register_post_type( 'ditty_news_ticker', $args );
|
44 |
}
|
45 |
+
add_action( 'init','mtphr_dnt_setup_post_types' );
|
46 |
|
47 |
|
48 |
|
includes/settings.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/* --------------------------------------------------------- */
|
4 |
-
/* !Create the settings page - 1.
|
5 |
/* --------------------------------------------------------- */
|
6 |
|
7 |
function mtphr_dnt_settings_menu() {
|
@@ -10,7 +10,7 @@ function mtphr_dnt_settings_menu() {
|
|
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 |
-
'
|
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 |
);
|
1 |
<?php
|
2 |
|
3 |
/* --------------------------------------------------------- */
|
4 |
+
/* !Create the settings page - 2.1.11 */
|
5 |
/* --------------------------------------------------------- */
|
6 |
|
7 |
function mtphr_dnt_settings_menu() {
|
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 |
+
'manage_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
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: metaphorcreations
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
Tags: ticker, news, news ticker, rotator, data rotator, lists, data
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.
|
7 |
Stable tag: /trunk/
|
8 |
License: GPL2
|
9 |
|
@@ -72,6 +72,9 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
75 |
= 2.1.10 =
|
76 |
* Added option to hide ticker if no ticks exist
|
77 |
* Added option to hide widget if no ticks exist
|
@@ -436,4 +439,4 @@ The most common cause for an unresponsive ticker (when using scroll or rotate mo
|
|
436 |
|
437 |
== Upgrade Notice ==
|
438 |
|
439 |
-
|
2 |
Contributors: metaphorcreations
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FUZKZGAJSBAE6
|
4 |
Tags: ticker, news, news ticker, rotator, data rotator, lists, data
|
5 |
+
Requires at least: 4.5
|
6 |
+
Tested up to: 4.9.2
|
7 |
Stable tag: /trunk/
|
8 |
License: GPL2
|
9 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 2.1.11 =
|
76 |
+
* Resolved custom capabilities bug
|
77 |
+
|
78 |
= 2.1.10 =
|
79 |
* Added option to hide ticker if no ticks exist
|
80 |
* Added option to hide widget if no ticks exist
|
439 |
|
440 |
== Upgrade Notice ==
|
441 |
|
442 |
+
Resolved custom capabilities bug
|