├── .gitmodules ├── sql.txt ├── changelog.txt ├── README.md ├── languages └── tips.pot └── tips.php /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/dash-notice"] 2 | path = external/dash-notice 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /sql.txt: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `wp_tips` ( 2 | `tip_ID` bigint(20) unsigned NOT NULL auto_increment, 3 | `tip_site_ID` int(20) NOT NULL default '0', 4 | `tip_content` TEXT CHARACTER SET utf8, 5 | `tip_added` varchar(255), 6 | `tip_status` int(1) NOT NULL default '1', 7 | PRIMARY KEY (`tip_ID`) 8 | ) ENGINE=MyISAM CHARSET=utf8 AUTO_INCREMENT=1; 9 | -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | === Admin Panel Tips === 2 | 3 | == Changelog == 4 | 5 | = 1.0.7.7 = 6 | * Fix: PHP error : Trying to get property of non-object 7 | 8 | = 1.0.7.6 = 9 | * Tips not working in single 10 | 11 | = 1.0.7.5 = 12 | * Fix: Tips still showing when turned off in profile settings in some setups 13 | * Fix: Make hide link actually turn off permanently in profile 14 | * Fix: Various code cleaning/compatibility 15 | 16 | = 1.0.7.4 = 17 | * Fixed: Tip is published even when I select the draft status 18 | 19 | = 1.0.7.3 = 20 | * WordPress 3.8 compatibility 21 | * Fixed: Dismiss cookie name 22 | * i18n improvements 23 | 24 | = 1.0.7.2 = 25 | * Fixed: Tips still showing when turned off in profile settings 26 | 27 | = 1.0.7.1 = 28 | * Update SQL 29 | 30 | = 1.0.7 = 31 | * Dismiss Tips 32 | 33 | = 1.0.6 = 34 | * DB Upgrades not applying 35 | 36 | = 1.0.5 = 37 | * Unpublish tips instead of deleting them 38 | 39 | = 1.0.3 = 40 | * Compatibility update for WordPress 3.1 41 | 42 | = 1.0.2 = 43 | * Multilanguage support 44 | * Internationalization 45 | 46 | = 1.0.1 = 47 | * Compatibility update for WordPress 3.0 48 | 49 | = 1.0.0 = 50 | * Initial Release -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Admin Panel Tips 2 | 3 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.** 4 | 5 | ## Translations 6 | 7 | Translation files can be found at https://github.com/wpmudev/translations 8 | 9 | ## Admin Panel Tips displays tips at random on the top of every page in the WordPress dashboard. 10 | 11 | This plugin provides an effective way of sharing tips and tricks to all the registered users on a Multisite network. 12 | 13 | ### Quick Setup 14 | 15 | Simply visit the new 'Tips' tab under Settings in the network admin dashboard to enter in as many different tips, news, promotions or whatever you choose. Tips are fully HTML compatible and give you options to edit, add to, save as draft or delete later – so you maintain complete control. 16 | 17 | ![image](http://premium.wpmudev.org/wp-content/uploads/2009/03/tips61.jpg) 18 | 19 | Add tips from an easy-to-use interface 20 | 21 | As users navigate the dashboard, active tips display in a random order at the top of each page. 22 | 23 | ![image](http://premium.wpmudev.org/wp-content/uploads/2009/03/tips63.jpg) 24 | 25 | Clear list manager for quick control 26 | 27 | Give your users the choice – allow users to toggle tips display on their profile for a cleaner user experience. 28 | 29 | ![image](http://premium.wpmudev.org/wp-content/uploads/2009/03/tips62.jpg) 30 | 31 | Let users control if tips display 32 | 33 | ### The Complete Dashboard Notification Solution 34 | 35 | For a complete WordPress rebranding suite including the power of Admin Panel Tips check out [Ultimate Branding](https://premium.wpmudev.org/project/ultimate-branding/). Make WordPress yours from the front end to the back end. 36 | 37 | ## Usage 38 | 39 | For help with installing plugins please refer to our [Plugin installation guide.](https://premium.wpmudev.org/wpmu-manual/installing-regular-plugins-on-wpmu/) 40 | 41 | ### To Use: 42 | 43 | 1\. Install the Admin Panel Tips Plugin. 44 | 45 | 2\. Navigate to Plugins in the network admin dashboard and Network Activate the plugin. 46 | 47 | 3\. Go to **Settings -> Tips** (or **Settings -> Tips** in regular WP) 48 | 49 | 4\. Click **New** 50 | 51 | 5\. Write your tip 52 | 53 | ![image](https://premium.wpmudev.org/wp-content/uploads/2009/03/tips61.jpg) 54 | 55 | 6\. Click **Save Changes** 56 | 57 | ![image](https://premium.wpmudev.org/wp-content/uploads/2009/03/tips63.jpg) 58 | -------------------------------------------------------------------------------- /languages/tips.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 Admin Panel Tips 2 | # This file is distributed under the same license as the Admin Panel Tips package. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: Admin Panel Tips 1.0.7.3\n" 6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/tips\n" 7 | "POT-Creation-Date: 2013-12-17 19:05:03+00:00\n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Type: text/plain; charset=UTF-8\n" 10 | "Content-Transfer-Encoding: 8bit\n" 11 | "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | 15 | #: tips.php:167 tips.php:239 16 | msgid "Tips" 17 | msgstr "" 18 | 19 | #: tips.php:197 20 | msgid "Dismiss" 21 | msgstr "" 22 | 23 | #: tips.php:197 24 | msgid "Hide" 25 | msgstr "" 26 | 27 | #: tips.php:211 tips.php:222 28 | msgid "Saving..." 29 | msgstr "" 30 | 31 | #: tips.php:242 32 | msgid "Show Tips" 33 | msgstr "" 34 | 35 | #: tips.php:245 36 | msgid "Yes" 37 | msgstr "" 38 | 39 | #: tips.php:246 40 | msgid "No" 41 | msgstr "" 42 | 43 | #: tips.php:262 44 | msgid "Nice Try..." 45 | msgstr "" 46 | 47 | #: tips.php:278 48 | msgid "Manage Tips" 49 | msgstr "" 50 | 51 | #: tips.php:278 52 | msgid "New" 53 | msgstr "" 54 | 55 | #: tips.php:282 56 | msgid "Click " 57 | msgstr "" 58 | 59 | #: tips.php:282 60 | msgid "here" 61 | msgstr "" 62 | 63 | #: tips.php:282 64 | msgid " to add a new tip." 65 | msgstr "" 66 | 67 | #: tips.php:290 68 | msgid "Content" 69 | msgstr "" 70 | 71 | #: tips.php:291 72 | msgid "Added" 73 | msgstr "" 74 | 75 | #: tips.php:292 tips.php:338 tips.php:363 tips.php:397 76 | msgid "Status" 77 | msgstr "" 78 | 79 | #: tips.php:293 80 | msgid "Actions" 81 | msgstr "" 82 | 83 | #: tips.php:307 tips.php:339 tips.php:364 tips.php:398 84 | msgid "Published" 85 | msgstr "" 86 | 87 | #: tips.php:307 tips.php:340 tips.php:365 tips.php:399 88 | msgid "Draft" 89 | msgstr "" 90 | 91 | #: tips.php:308 92 | msgid "Edit" 93 | msgstr "" 94 | 95 | #: tips.php:309 96 | msgid "Remove" 97 | msgstr "" 98 | 99 | #: tips.php:311 100 | msgid "Un-publish" 101 | msgstr "" 102 | 103 | #: tips.php:313 104 | msgid "Publish" 105 | msgstr "" 106 | 107 | #: tips.php:329 tips.php:354 108 | msgid "New Tip" 109 | msgstr "" 110 | 111 | #: tips.php:333 112 | msgid "Tip:" 113 | msgstr "" 114 | 115 | #: tips.php:345 tips.php:370 116 | msgid "Save" 117 | msgstr "" 118 | 119 | #: tips.php:358 tips.php:392 tips.php:420 120 | msgid "Tip" 121 | msgstr "" 122 | 123 | #: tips.php:378 124 | msgid "Tip Added!" 125 | msgstr "" 126 | 127 | #: tips.php:387 tips.php:415 128 | msgid "Edit Tip" 129 | msgstr "" 130 | 131 | #: tips.php:404 tips.php:426 132 | msgid "Save Changes" 133 | msgstr "" 134 | 135 | #: tips.php:434 136 | msgid "Settings saved." 137 | msgstr "" 138 | 139 | #: tips.php:444 140 | msgid "Tip Un-published." 141 | msgstr "" 142 | 143 | #: tips.php:452 144 | msgid "Tip Published." 145 | msgstr "" 146 | 147 | #: tips.php:461 148 | msgid "Tip Removed." 149 | msgstr "" 150 | 151 | #. Plugin Name of the plugin/theme 152 | msgid "Admin Panel Tips" 153 | msgstr "" 154 | 155 | #. Plugin URI of the plugin/theme 156 | msgid "http://premium.wpmudev.org/project/admin-panel-tips" 157 | msgstr "" 158 | 159 | #. Description of the plugin/theme 160 | msgid "" 161 | "Provide your users with helpful random tips (or promotions/news) in their " 162 | "admin panels." 163 | msgstr "" 164 | 165 | #. Author of the plugin/theme 166 | msgid "Ivan Shaovchev & Andrew Billits (Incsub), S H Mohanjith (Incsub)" 167 | msgstr "" 168 | 169 | #. Author URI of the plugin/theme 170 | msgid "http://premium.wpmudev.org" 171 | msgstr "" 172 | -------------------------------------------------------------------------------- /tips.php: -------------------------------------------------------------------------------- 1 | ID, 'show_tips', 'no'); 77 | wp_safe_redirect(wp_get_referer()); 78 | exit(); 79 | } 80 | 81 | function tips_enqueue_scripts() { 82 | wp_enqueue_script('jquery'); 83 | } 84 | 85 | function tips_make_current() { 86 | global $wpdb, $tips_current_version; 87 | if ( '' === get_site_option( "tips_version" )) { 88 | add_site_option( 'tips_version', '0.0.0' ); 89 | } 90 | tips_global_install(); 91 | if (get_site_option( "tips_version" ) === $tips_current_version) { 92 | // do nothing 93 | } else { 94 | //update to current version 95 | update_site_option( "tips_version", $tips_current_version ); 96 | } 97 | //--------------------------------------------------// 98 | if (get_option( "tips_version" ) == '') { 99 | add_option( 'tips_version', '0.0.0' ); 100 | } 101 | 102 | if (get_option( "tips_version" ) === $tips_current_version) { 103 | // do nothing 104 | } else { 105 | //update to current version 106 | update_option( "tips_version", $tips_current_version ); 107 | tips_blog_install(); 108 | } 109 | } 110 | 111 | function tips_blog_install() { 112 | global $wpdb, $tips_current_version; 113 | } 114 | 115 | function tips_global_init() { 116 | if (preg_match('/mu\-plugin/', PLUGINDIR) > 0) { 117 | load_muplugin_textdomain(TIPS_LANG_DOMAIN, false, dirname(plugin_basename(__FILE__)).'/languages'); 118 | } else { 119 | load_plugin_textdomain(TIPS_LANG_DOMAIN, false, dirname(plugin_basename(__FILE__)).'/languages'); 120 | } 121 | } 122 | 123 | function tips_global_install() { 124 | global $wpdb, $tips_current_version; 125 | 126 | // Get the correct character collate 127 | if ( ! empty($wpdb->charset) ) 128 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 129 | if ( ! empty($wpdb->collate) ) 130 | $charset_collate .= " COLLATE $wpdb->collate"; 131 | 132 | if (get_site_option( "tips_installed" ) == '') { 133 | add_site_option( 'tips_installed', 'no' ); 134 | } 135 | 136 | if (get_site_option( "tips_installed" ) == "yes") { 137 | if ( version_compare("1.0.4", get_site_option( "tips_version" )) >= 0) { 138 | $tips_table1 = "ALTER TABLE `" . $wpdb->base_prefix . "tips` ADD `tip_status` INT( 1 ) NOT NULL DEFAULT '1' AFTER `tip_added` ;"; 139 | $wpdb->query( $tips_table1 ); 140 | } 141 | } else { 142 | $tips_table1 = "CREATE TABLE IF NOT EXISTS `" . $wpdb->base_prefix . "tips` ( 143 | `tip_ID` bigint(20) unsigned NOT NULL auto_increment, 144 | `tip_site_ID` int(20) NOT NULL default '0', 145 | `tip_content` TEXT CHARACTER SET utf8, 146 | `tip_added` varchar(255), 147 | `tip_status` int(1) NOT NULL default '1', 148 | PRIMARY KEY (`tip_ID`) 149 | ) ENGINE=MyISAM {$charset_collate};"; 150 | 151 | $wpdb->query( $tips_table1 ); 152 | update_site_option( "tips_installed", "yes" ); 153 | } 154 | } 155 | 156 | function tips_plug_pages() { 157 | global $tips_menu_slug; 158 | 159 | if (is_super_admin()) 160 | add_submenu_page( $tips_menu_slug, __('Tips', TIPS_LANG_DOMAIN), __('Tips', TIPS_LANG_DOMAIN), 'manage_options', 'manage-tips', 'tips_manage_output' ); 161 | } 162 | 163 | function tips_profile_option_update() { 164 | global $user_id; 165 | if ( $_POST['show_tips'] != '' ) { 166 | update_user_meta($user_id, 'show_tips', $_POST['show_tips']); 167 | } 168 | } 169 | 170 | //------------------------------------------------------------------------// 171 | //---Output Functions-----------------------------------------------------// 172 | //------------------------------------------------------------------------// 173 | 174 | function tips_output() { 175 | global $wpdb, $current_site, $tmp_tips_prefix, $tmp_tips_suffix, $current_user; 176 | 177 | //hide if turned off 178 | $show_tips = get_user_meta($current_user->ID,'show_tips', true); 179 | if ( 'no' === $show_tips ) return; 180 | 181 | 182 | $dismissed_tips = isset($_COOKIE['tips_dismissed'])?maybe_unserialize(stripslashes($_COOKIE['tips_dismissed'])):array(); 183 | if (count($dismissed_tips) > 0) { 184 | $dismissed_tips_sql = "AND tip_ID NOT IN(" . join(',', $dismissed_tips) . ")"; 185 | } else { 186 | $dismissed_tips_sql = ""; 187 | } 188 | $tmp_tips_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "tips WHERE tip_site_ID = '" . $wpdb->siteid . "' AND tip_status = 1 {$dismissed_tips_sql} "); 189 | if ($tmp_tips_count > 0){ 190 | $tmp_tip = $wpdb->get_row("SELECT tip_ID, tip_content FROM " . $wpdb->base_prefix . "tips WHERE tip_site_ID = '" . $wpdb->siteid . "' AND tip_status = 1 {$dismissed_tips_sql} ORDER BY RAND() LIMIT 1"); 191 | $tmp_tip_content = $tmp_tips_prefix . $tmp_tip->tip_content . $tmp_tips_suffix; 192 | ?> 193 |

[ ]

[ ]

194 | 200 | 226 | 234 |

235 | 236 | 237 | 238 | 244 | 245 |
239 | 243 |
246 | " . __('Nice Try...', TIPS_LANG_DOMAIN) . "

"; //If accessed properly, this message doesn't appear. 258 | return; 259 | } 260 | if (isset($_GET['updated'])) { 261 | ?>

'; 264 | if (!isset($_GET[ 'action' ])) { 265 | $_GET[ 'action' ] = ''; 266 | } 267 | switch( $_GET[ 'action' ] ) { 268 | //---------------------------------------------------// 269 | default: 270 | $tmp_tips_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "tips WHERE tip_site_ID = '" . $wpdb->siteid . "'"); 271 | ?> 272 | 273 |

():

274 | 277 |

278 | base_prefix . "tips WHERE tip_site_ID = '" . $wpdb->siteid . "' ORDER BY tip_status, tip_ID DESC"; 281 | $tmp_tips = $wpdb->get_results( $query, ARRAY_A ); 282 | echo " 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | "; 294 | $class = ''; 295 | if (count($tmp_tips) > 0){ 296 | $class = ('alternate' == $class) ? '' : 'alternate'; 297 | foreach ($tmp_tips as $tmp_tip){ 298 | //=========================================================// 299 | echo ""; 300 | echo ""; 301 | echo ""; 302 | echo ""; 303 | echo '"; 304 | echo '"; 305 | if ($tmp_tip['tip_status'] == 1) { 306 | echo '"; 307 | } else { 308 | echo '"; 309 | } 310 | echo ""; 311 | $class = ('alternate' == $class) ? '' : 'alternate'; 312 | //=========================================================// 313 | } 314 | } 315 | ?> 316 |
".__('Content', TIPS_LANG_DOMAIN)."".__('Added', TIPS_LANG_DOMAIN)."".__('Status', TIPS_LANG_DOMAIN)."".__('Actions', TIPS_LANG_DOMAIN)."
" . $tmp_tip['tip_content'] . "" . date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tmp_tip['tip_added']) . "" . (($tmp_tip['tip_status'] == 1)?__('Published', TIPS_LANG_DOMAIN):__('Draft', TIPS_LANG_DOMAIN)) . "" . __('Edit', TIPS_LANG_DOMAIN) . "" . __('Remove', TIPS_LANG_DOMAIN) . "" . __('Un-publish', TIPS_LANG_DOMAIN) . "" . __('Publish', TIPS_LANG_DOMAIN) . "
317 | 324 |

325 |
326 | 327 | 328 | 329 | 331 | 332 | 333 | 334 | 337 | 338 |
330 |
335 | 336 |
339 |

340 | 341 |

342 |
343 | 349 |

350 |
351 | 352 | 353 | 354 | 356 | 357 | 358 | 359 | 362 | 363 |
355 |
360 | 361 |
364 |

365 | 366 |

367 |
368 | query( "INSERT INTO " . $wpdb->base_prefix . "tips (tip_site_ID, tip_content, tip_added, tip_status) VALUES ( '" . $wpdb->siteid . "', '" . $_POST['tip_content'] . "' , '" . time() . "', '" . $_POST['tip_status'] . "')" ); 371 | echo " 372 | 375 | "; 376 | } 377 | break; 378 | //---------------------------------------------------// 379 | case "edit_tip": 380 | $tmp_tip = $wpdb->get_row("SELECT tip_content, tip_status FROM " . $wpdb->base_prefix . "tips WHERE tip_ID = '" . $_GET['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'"); 381 | ?> 382 |

383 |
384 | 385 | 386 | 387 | 388 | 390 | 391 | 392 | 393 | 396 | 397 |
389 |
394 | 395 |
398 |

399 | 400 |

401 |
402 | get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "tips WHERE tip_ID = '" . $_POST['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'"); 407 | if ($tmp_tip_count > 0){ 408 | if ($_POST['tip_content'] == ''){ 409 | ?> 410 |

411 |
412 | 413 | 414 | 415 | 416 | 418 | 419 |
417 |
420 |

421 | 422 |

423 |
424 | query( "UPDATE " . $wpdb->base_prefix . "tips SET tip_content = '" . $_POST['tip_content'] . "', tip_status = " . $_POST['tip_status'] . " WHERE tip_ID = '" . $_POST['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'" ); 427 | echo " 428 | 431 | "; 432 | } 433 | } 434 | break; 435 | case "unpublish_tip": 436 | $wpdb->query( "UPDATE " . $wpdb->base_prefix . "tips SET tip_status = 0 WHERE tip_ID = '" . $_GET['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'" ); 437 | echo " 438 | 441 | "; 442 | break; 443 | case "publish_tip": 444 | $wpdb->query( "UPDATE " . $wpdb->base_prefix . "tips SET tip_status = 1 WHERE tip_ID = '" . $_GET['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'" ); 445 | echo " 446 | 449 | "; 450 | break; 451 | //---------------------------------------------------// 452 | case "delete_tip": 453 | $wpdb->query( "DELETE FROM " . $wpdb->base_prefix . "tips WHERE tip_ID = '" . $_GET['tid'] . "' AND tip_site_ID = '" . $wpdb->siteid . "'" ); 454 | echo " 455 | 458 | "; 459 | break; 460 | //---------------------------------------------------// 461 | } 462 | echo ''; 463 | } 464 | 465 | /* 466 | * Update Notifications Notice 467 | */ 468 | global $wpmudev_notices; 469 | $wpmudev_notices[] = array( 'id'=> 61, 'name'=> 'Admin Panel Tips', 'screens' => array( 'settings_page_manage-tips-network', 'settings_page_manage-tips' ) ); 470 | --------------------------------------------------------------------------------