Analytics
7 months ago
Database
9 months ago
Elementor_Enhancer.php
1 year ago
EmbedPress_Core_Installer.php
6 years ago
EmbedPress_Notice.php
2 years ago
EmbedPress_Plugin_Usage_Tracker.php
1 year ago
Extend_CustomPlayer_Controls.php
1 year ago
Extend_Elementor_Controls.php
1 year ago
FeatureNoticeManager.php
8 months ago
FeatureNotices.php
8 months ago
Feature_Enhancer.php
9 months ago
Helper.php
6 months ago
PermalinkHelper.php
10 months ago
README_FEATURE_NOTICES.md
8 months ago
README_FEATURE_NOTICES.md
190 lines
| 1 | # Feature Notices - Quick Guide |
| 2 | |
| 3 | ## 📍 Location |
| 4 | |
| 5 | All feature notices are now registered in a **single, dedicated file**: |
| 6 | |
| 7 | ``` |
| 8 | wp-content/plugins/embedpress/EmbedPress/Includes/Classes/FeatureNotices.php |
| 9 | ``` |
| 10 | |
| 11 | ## 🚀 How to Add a New Notice |
| 12 | |
| 13 | 1. Open `FeatureNotices.php` |
| 14 | 2. Find the `register_all_notices()` method |
| 15 | 3. Add your notice using the `register_notice()` method |
| 16 | |
| 17 | ### Basic Example |
| 18 | |
| 19 | ```php |
| 20 | $notice_manager->register_notice('my_unique_notice_id', [ |
| 21 | 'title' => 'New Features', |
| 22 | 'icon' => '🎉', |
| 23 | 'message' => '<strong>Exciting Update!</strong> Check out our new features.', |
| 24 | 'button_text' => 'Learn More', |
| 25 | 'button_url' => admin_url('admin.php?page=embedpress'), |
| 26 | 'skip_text' => 'Skip', |
| 27 | ]); |
| 28 | ``` |
| 29 | |
| 30 | ## 📋 Available Parameters |
| 31 | |
| 32 | | Parameter | Type | Required | Default | Description | |
| 33 | |-----------|------|----------|---------|-------------| |
| 34 | | `title` | string | No | 'New Features' | Notice title | |
| 35 | | `icon` | string | No | '🎉' | Emoji icon | |
| 36 | | `message` | string | Yes | - | Notice message (HTML allowed) | |
| 37 | | `button_text` | string | No | 'Learn More' | Primary button text | |
| 38 | | `button_url` | string | No | '' | Primary button URL | |
| 39 | | `button_target` | string | No | '_self' | Link target (`_self` or `_blank`) | |
| 40 | | `skip_text` | string | No | 'Skip' | Skip button text | |
| 41 | | `screens` | array | No | [] | Show on specific screens (empty = all pages) | |
| 42 | | `capability` | string | No | 'manage_options' | Required user capability | |
| 43 | | `start_date` | string | No | null | Start showing from this date (Y-m-d) | |
| 44 | | `end_date` | string | No | null | Stop showing after this date (Y-m-d) | |
| 45 | | `priority` | int | No | 10 | Display priority (lower = higher priority) | |
| 46 | | `type` | string | No | 'info' | Notice type: `info`, `success`, `warning`, `error` | |
| 47 | |
| 48 | ## 🎨 Notice Types |
| 49 | |
| 50 | - **info** - Blue theme (default) |
| 51 | - **success** - Green theme |
| 52 | - **warning** - Orange/yellow theme |
| 53 | - **error** - Red theme |
| 54 | |
| 55 | ## � |
| 56 | Date-Based Notices |
| 57 | |
| 58 | Show notices only during specific time periods: |
| 59 | |
| 60 | ```php |
| 61 | $notice_manager->register_notice('black_friday_2024', [ |
| 62 | 'title' => 'Limited Time Offer', |
| 63 | 'icon' => '🎁', |
| 64 | 'message' => '<strong>Black Friday Sale!</strong> Get 50% off.', |
| 65 | 'button_text' => 'Claim Discount', |
| 66 | 'button_url' => 'https://embedpress.com/pricing', |
| 67 | 'start_date' => '2024-11-25', |
| 68 | 'end_date' => '2024-12-02', |
| 69 | 'priority' => 1, |
| 70 | ]); |
| 71 | ``` |
| 72 | |
| 73 | ## 🎯 Screen-Specific Notices |
| 74 | |
| 75 | Show notices only on specific admin pages: |
| 76 | |
| 77 | ```php |
| 78 | $notice_manager->register_notice('settings_update', [ |
| 79 | 'title' => 'Update Required', |
| 80 | 'message' => 'Please update your settings.', |
| 81 | 'screens' => ['toplevel_page_embedpress'], // Only on EmbedPress main page |
| 82 | ]); |
| 83 | ``` |
| 84 | |
| 85 | ### Common Screen IDs |
| 86 | |
| 87 | - `toplevel_page_embedpress` - EmbedPress main page |
| 88 | - `dashboard` - WordPress dashboard |
| 89 | - `plugins` - Plugins page |
| 90 | - Leave empty `[]` to show on all admin pages |
| 91 | |
| 92 | ## 🔔 Priority System |
| 93 | |
| 94 | Lower numbers = higher priority (shown first): |
| 95 | |
| 96 | ```php |
| 97 | // High priority (shown first) |
| 98 | $notice_manager->register_notice('urgent_notice', [ |
| 99 | 'priority' => 1, |
| 100 | // ... |
| 101 | ]); |
| 102 | |
| 103 | // Normal priority |
| 104 | $notice_manager->register_notice('normal_notice', [ |
| 105 | 'priority' => 10, |
| 106 | // ... |
| 107 | ]); |
| 108 | |
| 109 | // Low priority (shown last) |
| 110 | $notice_manager->register_notice('low_priority', [ |
| 111 | 'priority' => 20, |
| 112 | // ... |
| 113 | ]); |
| 114 | ``` |
| 115 | |
| 116 | ## 🎭 User Capabilities |
| 117 | |
| 118 | Control who can see the notice: |
| 119 | |
| 120 | ```php |
| 121 | $notice_manager->register_notice('admin_only', [ |
| 122 | 'capability' => 'manage_options', // Only admins |
| 123 | // ... |
| 124 | ]); |
| 125 | |
| 126 | $notice_manager->register_notice('editor_and_above', [ |
| 127 | 'capability' => 'edit_pages', // Editors and admins |
| 128 | // ... |
| 129 | ]); |
| 130 | ``` |
| 131 | |
| 132 | ## 💡 Tips |
| 133 | |
| 134 | 1. **Unique IDs**: Always use unique notice IDs to avoid conflicts |
| 135 | 2. **HTML in Messages**: You can use HTML in the message field |
| 136 | 3. **External Links**: Set `button_target` to `'_blank'` for external URLs |
| 137 | 4. **Testing**: Comment out old notices instead of deleting them |
| 138 | 5. **Organization**: Keep active notices at the top, examples at the bottom |
| 139 | |
| 140 | ## 🔄 User Actions |
| 141 | |
| 142 | Users can interact with notices in two ways: |
| 143 | |
| 144 | 1. **Dismiss** (X button) - Permanently hides the notice |
| 145 | 2. **Skip** - Hides for 7 days, then shows again |
| 146 | |
| 147 | ## 📝 Complete Example |
| 148 | |
| 149 | ```php |
| 150 | $notice_manager->register_notice('analytics_launch_2024', [ |
| 151 | 'title' => 'New Features', |
| 152 | 'icon' => '📊', |
| 153 | 'message' => '<strong>New In EmbedPress:</strong> Introducing Analytics dashboard to track every embed performance; see total counts, views, clicks, geo insights, etc.', |
| 154 | 'button_text' => 'View Analytics', |
| 155 | 'button_url' => admin_url('admin.php?page=embedpress&page_type=analytics'), |
| 156 | 'button_target' => '_self', |
| 157 | 'skip_text' => 'Maybe Later', |
| 158 | 'screens' => [], // Show on all admin pages |
| 159 | 'capability' => 'manage_options', |
| 160 | 'start_date' => '2024-01-01', |
| 161 | 'end_date' => '2025-12-31', |
| 162 | 'priority' => 10, |
| 163 | 'type' => 'info', |
| 164 | ]); |
| 165 | ``` |
| 166 | |
| 167 | ## 🛠️ Helper Method |
| 168 | |
| 169 | Use the built-in helper for EmbedPress URLs: |
| 170 | |
| 171 | ```php |
| 172 | // Instead of: |
| 173 | 'button_url' => admin_url('admin.php?page=embedpress&page_type=analytics'), |
| 174 | |
| 175 | // You can use: |
| 176 | 'button_url' => $this->get_embedpress_url('analytics'), |
| 177 | ``` |
| 178 | |
| 179 | ## 📚 More Information |
| 180 | |
| 181 | For detailed documentation, see: |
| 182 | - `docs/README_FEATURE_NOTICES.md` - Full documentation |
| 183 | - `docs/feature-notice-system.md` - System architecture |
| 184 | - `FeatureNoticeManager.php` - Core implementation |
| 185 | |
| 186 | --- |
| 187 | |
| 188 | **Need Help?** Check the commented examples in `FeatureNotices.php` for more use cases! |
| 189 | |
| 190 |