Plugin Directory

Changeset 3093593


Ignore:
Timestamp:
05/28/2024 04:00:33 AM (22 months ago)
Author:
sweepwidget
Message:

Update to new version

Location:
sweepwidget/tags/2.0.4/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sweepwidget/tags/2.0.4/trunk/readme.txt

    r3093586 r3093593  
    214214= 2.0.3 =
    215215* More seamless plugin installation.
     216
     217= 2.0.4 =
     218* Fixed a bug on the main page.
     219
     220= 2.0.5 =
     221* Redirect user to plugin on activation. Update URL path for SweepWidget plugin.
  • sweepwidget/tags/2.0.4/trunk/sweepwidget.php

    r3093586 r3093593  
    1414*/
    1515
    16 function sweepwidget_add_menu() {
    17 
    18     add_menu_page(  'SweepWidget Contests',
    19                     'SweepWidget Contests',
    20                     'manage_options',
    21                     'account',
    22                     'sweepwidget_admin_menu_main',
    23                     'dashicons-awards',
    24                     21);
    25 
     16function sweepwidget_add_menu()
     17{
     18
     19    add_menu_page(
     20        'SweepWidget Contests',
     21        'SweepWidget Contests',
     22        'manage_options',
     23        'account',
     24        'sweepwidget_admin_menu_main',
     25        'dashicons-awards',
     26        21
     27    );
    2628}
    2729
    2830add_action('admin_menu', 'sweepwidget_add_menu');
     31
     32// Hook into the admin initialization process
     33add_action('admin_init', 'sweepwidget_redirect_to_admin');
     34
     35function sweepwidget_redirect_to_admin()
     36{
     37    // Check if our option is set
     38    if (get_option('sweepwidget_plugin_activated', false)) {
     39        // Delete the option to prevent the redirect on every admin page load
     40        delete_option('sweepwidget_plugin_activated');
     41
     42        // Perform the redirect
     43        wp_redirect(admin_url('admin.php?page=sweepwidget'));
     44        exit;
     45    }
     46}
     47
     48// Hook into the activation process
     49register_activation_hook(__FILE__, 'sweepwidget_activate');
     50
     51function sweepwidget_activate()
     52{
     53    // Set an option to trigger the redirect
     54    add_option('sweepwidget_plugin_activated', true);
     55}
    2956
    3057// Convert language abbr to full text
Note: See TracChangeset for help on using the changeset viewer.