Changeset 2855607
- Timestamp:
- 01/27/2023 04:48:53 AM (3 years ago)
- Location:
- mi13-comment-user-edit/trunk
- Files:
-
- 2 edited
-
mi13-comment-user-edit.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mi13-comment-user-edit/trunk/mi13-comment-user-edit.php
r2827436 r2855607 2 2 /* 3 3 Plugin Name: mi13 comment user edit 4 Version: 1. 04 Version: 1.1 5 5 Plugin URI: https://wordpress.org/plugins/mi13-comment-user-edit/ 6 6 Description: This plugin allows guests to edit their comments on your site. … … 108 108 <tr> 109 109 <th style="padding-left:8px" scope="row">Code Snippet:</th> 110 <td><p class="description"> <strong><?php if( function_exists( 'mi13_comment_user_edit_button' ) ) echo mi13_comment_user_edit_button( get_comment_ID() ); ?></strong>< /p></td>110 <td><p class="description"> <strong><?php if( function_exists( 'mi13_comment_user_edit_button' ) ) echo mi13_comment_user_edit_button( get_comment_ID() ); ?></strong><br>/The second parameter is optional (your comment_content); Default empty./</p></td> 111 111 </tr> 112 112 <tr> … … 134 134 } 135 135 136 function mi13_comment_user_edit_button($comment_id ) {136 function mi13_comment_user_edit_button($comment_id, $comment_content='') { 137 137 $button = ''; 138 138 $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 } 144 149 } 145 150 return $button; -
mi13-comment-user-edit/trunk/readme.txt
r2827441 r2855607 4 4 Requires at least: 4.7 5 5 Tested up to: 6.1.1 6 Stable tag: 1. 06 Stable tag: 1.1 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html 8 8 License: GPL v2 or later … … 23 23 3. That's it. 24 24 25 == Screenshots == 26 1. Settings Screen 27 25 28 == Changelog == 26 29 ** 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.