edit_comment [ WordPress Function ]
edit_comment ( No parameters )
| Defined at: |
|
Update a comment with values provided in $_POST.
Source
<?php
function edit_comment() {
if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
$_POST['comment_author'] = $_POST['newcomment_author'];
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
$_POST['comment_approved'] = $_POST['comment_status'];
$_POST['comment_content'] = $_POST['content'];
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
$_POST['edit_date'] = '1';
break;
}
}
if ( !empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ($jj > 31 ) ? 31 : $jj;
$hh = ($hh > 23 ) ? $hh -24 : $hh;
$mn = ($mn > 59 ) ? $mn -60 : $mn;
$ss = ($ss > 59 ) ? $ss -60 : $ss;
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
wp_update_comment( $_POST );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- edit_comment Wordpress hook details -- Adam Brown, BYU Political ...
Detailed information about every action hook and filter used in WordPress. Makes Plugin API easier to use. Lists appearance, file location, and deprecation data ...
adambrown.info - #14520 (Introduce edit_comment meta cap) – WordPress Trac
Description. Currently, the edit_post meta cap is used to determine wether a user is allowed to edit a comment or not. This makes it difficult to restrict editing on a ...
core.trac.wordpress.org - edit_comment | A HitchHackers guide through WordPress
Feb 11, 2011 ... function edit_comment() { if ( ! current_user_can( 'edit_comment', (int) $_POST[' comment_ID'] ) ) wp_die ( __( 'You are not allowed to edit ...
hitchhackerguide.com - edit_comment (WordPress Function) - WPSeek.com
WordPress lookup for edit_comment, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com