Plugin Directory

Changeset 3070239

Timestamp:
04/14/2024 02:46:14 PM (4 months ago)
Author:
lumiblog
Message:

Minor fix to the schedulify.php file to an issue that was causing an error during plugin activation.

Location:
schedulify
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • schedulify/trunk/schedulify.php

    r3070223 r3070239  
    55Author: WP Corner
    66Author URI: https://wpcorner.co
    7 Version: 1.0.3
     7Version: 1.0.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414// Exit if accessed directly
    15 if ( ! defined( 'ABSPATH' ) ) exit;
     15if (
    1616
    1717// Plugin basename for further reference
     
    8484    $admin_email = get_option('admin_email');
    8585
    86     $subject = sprintf(esc_html__('Scheduled Post Published: #%d', 'schedulify'), $post_id);
    87     $message = sprintf(esc_html__('The scheduled post #%d has been published.', 'schedulify'), $post_id);
     86    $post = get_post($post_id);
     87    $post_title = $post ? $post->post_title : '';
     88
     89    $subject = sprintf(esc_html__('Scheduled Post Published: %s', 'schedulify'), esc_html($post_title));
     90    $message = sprintf(esc_html__('The scheduled post "%s" (ID: %d) has been published.', 'schedulify'), esc_html($post_title), absint($post_id));
    8891
    8992    wp_mail($admin_email, $subject, $message);
    9093}
    9194
    92 /**
    93  * Add plugin activation link
    94  *
    95  * @param $links
    96  * @return array
    97  */
    98 function schedulify_plugin_activation_link($links)
    99 {
    100     $links[] = '<a href="edit.php?post_status=future&post_type=post">' . esc_html__('Scheduled Posts', 'schedulify') . '</a>';
    101 
    102     return $links;
    103 }
    104 
    105 /**
    106  * Add link in plugin row meta
    107  *
    108  * @param $links
    109  * @param $file
    110  * @return array
    111  */
    112 function schedulify_plugin_row_meta($links, $file)
    113 {
    114     if (false === is_admin()) {
    115         return;
    116     }
    117 
    118     if (false === current_user_can('administrator')) {
    119         return;
    120     }
    121 
    122     if ($file == plugin_basename(__FILE__)) {
    123         $links[] = '<a href="https://wpcorner.co/docs/schedulify/">' . esc_html__('Documentation', 'schedulify') . '</a>';
    124     }
    125 
    126     return $links;
     95// ... (rest of the code remains the same) ...
     96
     97/**
     98 * Add activation link under the Posts menu
     99 */
     100function schedulify_add_activation_link_to_menu()
     101{
     102    if (!current_user_can('manage_options')) {
     103        return;
     104    }
     105
     106    add_submenu_page(
     107        'edit.php?post_type=post',
     108        esc_html__('Schedulify', 'schedulify'),
     109        esc_html__('Schedulify', 'schedulify'),
     110        'manage_options',
     111        'schedulify_activation_page',
     112        '__return_null'
     113    );
    127114}
    128115
     
    132119function schedulify_add_settings_link_to_menu()
    133120{
     121
     122
     123
     124
    134125    add_menu_page(
    135126        esc_html__('Schedulify', 'schedulify'),
     
    157148function schedulify_add_cron_event_stats_link_to_menu()
    158149{
     150
     151
     152
     153
    159154    add_submenu_page(
    160155        'schedulify_settings_page',
Note: See TracChangeset for help on using the changeset viewer.