Plugin Directory

Changeset 2855607


Ignore:
Timestamp:
01/27/2023 04:48:53 AM (3 years ago)
Author:
mi13
Message:

update plugin

Location:
mi13-comment-user-edit/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mi13-comment-user-edit/trunk/mi13-comment-user-edit.php

    r2827436 r2855607  
    22/*
    33Plugin Name: mi13 comment user edit
    4 Version: 1.0
     4Version: 1.1
    55Plugin URI: https://wordpress.org/plugins/mi13-comment-user-edit/
    66Description: This plugin allows guests to edit their comments on your site.
     
    108108                <tr>
    109109                    <th style="padding-left:8px" scope="row">Code Snippet:</th>
    110                     <td><p  class="description"> <strong>&lt;?php if( function_exists( 'mi13_comment_user_edit_button' ) ) echo mi13_comment_user_edit_button( get_comment_ID() ); ?&gt;</strong></p></td>
     110                    <td><p  class="description"> <strong>&lt;?php if( function_exists( 'mi13_comment_user_edit_button' ) ) echo mi13_comment_user_edit_button( get_comment_ID() ); ?&gt;</strong><br>/The second parameter is optional (your comment_content); Default empty./</p></td>
    111111                </tr>
    112112                <tr>
     
    134134}
    135135
    136 function mi13_comment_user_edit_button($comment_id) {
     136function mi13_comment_user_edit_button($comment_id, $comment_content='') {
    137137    $button = '';
    138138    $comment = get_comment($comment_id);
    139     if( is_singular() && ( $comment->comment_type == 'comment' ) && ( $comment->comment_approved == '1' ) && ( strpos( $comment->comment_content, '<!--mi13-comment-user-edit-not-edit-->' ) === false ) ) {
    140         $button = get_option('mi13_comment_user_edit')['button'];
    141         $on_click_function = 'mi13commentedit(\'' . esc_js( __('Edit') ) . '\', \'' . esc_js($comment_id) . '\', \'' . esc_js($comment->comment_content) . '\');';
    142         $button = str_replace( 'ON_CLICK_FUNCTION', $on_click_function, $button );
    143         $button = str_replace( 'GET_EDIT_TEXT', __('Edit'), $button );
     139    if( $comment ) {
     140        if( empty($comment_content) ) {
     141            $comment_content = $comment->comment_content;
     142        }
     143        if( is_singular() && ( $comment->comment_type == 'comment' ) && ( $comment->comment_approved == '1' ) && ( strpos( $comment_content, '<!--mi13-comment-user-edit-not-edit-->' ) === false ) ) {
     144            $button = get_option('mi13_comment_user_edit')['button'];
     145            $on_click_function = 'mi13commentedit(\'' . esc_js( __('Edit') ) . '\', \'' . esc_js($comment_id) . '\', \'' . esc_js($comment_content) . '\');';
     146            $button = str_replace( 'ON_CLICK_FUNCTION', $on_click_function, $button );
     147            $button = str_replace( 'GET_EDIT_TEXT', __('Edit'), $button );
     148        }
    144149    }
    145150    return $button;
  • mi13-comment-user-edit/trunk/readme.txt

    r2827441 r2855607  
    44Requires at least: 4.7
    55Tested up to: 6.1.1
    6 Stable tag: 1.0
     6Stable tag: 1.1
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
    88License: GPL v2 or later
     
    23233. That's it.
    2424
     25== Screenshots ==
     261. Settings Screen
     27
    2528== Changelog ==
    2629** 1 - The first version in the repository.
     30** 1.1 - Added a second parameter to the button for markdown parser.
Note: See TracChangeset for help on using the changeset viewer.