本文整理汇总了PHP中update_comment_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP update_comment_meta函数的具体用法?PHP update_comment_meta怎么用?PHP update_comment_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_comment_meta函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: evc_comments_add_comment
function evc_comments_add_comment($comment, $post_id, $widget_api_id, $comment_parent = null)
{
if (isset($comment['cid'])) {
$comment['id'] = $comment['cid'];
}
$vk_item_id = 'app' . $widget_api_id . '_' . $comment['id'];
$comment_wp_id = evc_get_wpid_by_vkid($vk_item_id, 'comment');
if ($comment_wp_id && isset($comment_wp_id[$vk_item_id])) {
return $comment_wp_id[$vk_item_id];
}
if (isset($comment['user']) && !empty($comment['user'])) {
$user_wp_id = evc_get_wpid_by_vkid($comment['user']['id'], 'user');
if (!$user_wp_id) {
$user_wp_id = evc_add_user($comment['user']);
if (!$user_wp_id) {
return false;
}
} else {
$user_wp_id = $user_wp_id[$comment['user']['id']];
}
} else {
return false;
}
$args = array('comment_post_ID' => $post_id, 'comment_content' => $comment['text'], 'user_id' => $user_wp_id, 'comment_date' => date('Y-m-d H:i:s', $comment['date'] + get_option('gmt_offset') * 3600), 'comment_approved' => 1, 'comment_author_IP' => preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']), 'comment_agent' => substr($_SERVER['HTTP_USER_AGENT'], 0, 254));
if (isset($comment_parent) && !empty($comment_parent)) {
$args['comment_parent'] = $comment_parent;
}
$args = apply_filters('evc_comments_add_comment_args', $args, $comment);
//print__r($args); //
$comment_wp_id = wp_insert_comment($args);
if ($comment_wp_id) {
update_comment_meta($comment_wp_id, 'vk_item_id', $vk_item_id);
}
return $comment_wp_id;
}
开发者ID:prosenjit-itobuz,项目名称:upages,代码行数:35,代码来源:evc-comments-seo.php
示例2: fre_create_invite
/**
* create a comment with type fre_invite
* @param int $user_id
* @param int $project
* @return int $invite_id
* @since 1.3.1
* @author Dakachi
*/
function fre_create_invite($user_id, $project_id)
{
global $user_ID, $current_user;
$invite_id = wp_insert_comment(array('comment_post_ID' => $project_id, 'comment_author' => $current_user->data->user_login, 'comment_author_email' => $current_user->data->user_email, 'comment_content' => sprintf(__("Invite %s to bid project", 'invites-backend'), get_the_author_meta('display_name', $user_id)), 'comment_type' => 'fre_invite', 'user_id' => $user_ID, 'comment_approved' => 1));
update_comment_meta($invite_id, 'invite', $user_id);
return $invite_id;
}
开发者ID:linniepinski,项目名称:perssistant,代码行数:15,代码来源:invites.php
示例3: test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template
/**
* @ticket 16894
*/
public function test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template()
{
global $wpdb;
$p = $this->factory->post->create(array('post_status' => 'publish'));
$comment_ids = $this->factory->comment->create_post_comments($p, 3);
foreach ($comment_ids as $cid) {
update_comment_meta($cid, 'sauce', 'fire');
}
$this->go_to(get_permalink($p));
if (have_posts()) {
while (have_posts()) {
the_post();
// Load comments with `comments_template()`.
$cform = get_echo('comments_template');
// First request will hit the database.
$num_queries = $wpdb->num_queries;
get_comment_meta($comment_ids[0], 'sauce');
$this->assertSame($num_queries + 1, $wpdb->num_queries);
// Second and third requests should be in cache.
get_comment_meta($comment_ids[1], 'sauce');
get_comment_meta($comment_ids[2], 'sauce');
$this->assertSame($num_queries + 1, $wpdb->num_queries);
}
}
}
开发者ID:plis197715,项目名称:wordpress-develop,代码行数:28,代码来源:metaCache.php
示例4: comment_posted
/**
* Executed comment posted
*
* @param int $comment_id
*/
public function comment_posted($comment_id)
{
$comment = get_comment($comment_id);
if ($this->is_thread(get_post_type($comment->comment_post_ID))) {
// This may anonymous comment.
if ($this->input->post('_nichancommentnonce') && $comment->user_id && $comment->user_id == $this->option->post_as) {
// Mark this as anonymous comment
update_comment_meta($comment_id, '_is_anonymous', 1);
// If hash exists, save it
if ($this->option->use_trip && ($trip = $this->input->post('trip'))) {
update_comment_meta($comment_id, '_trip', $this->hash->generate($trip));
}
// Put cookie for anonymous user.
if (isset($_COOKIE['nichan_posted'])) {
$cookies = explode('-', $_COOKIE['nichan_posted']);
} else {
$cookies = array();
}
if (false === array_search($comment->comment_post_ID, $cookies)) {
$cookies[] = $comment->comment_post_ID;
}
setcookie('nichan_posted', implode('-', $cookies), current_time('timestamp', true) + 60 * 30, '/');
}
}
}
开发者ID:hametuha,项目名称:2ch,代码行数:30,代码来源:Comment.php
示例5: delibera_update_comment
function delibera_update_comment($comment_id, $user_id, $text, $proposta)
{
$arrcomment = array('comment_ID' => intval($comment_id), 'comment_content' => $text, 'comment_date' => date("Y-m-d H:i:s"));
wp_update_comment($arrcomment);
$comment = get_comment($comment_id);
$proposta_antes = get_comment_meta($comment_id, 'delibera_comment_tipo', true);
if ($proposta != $proposta_antes) {
if ($proposta == 'encaminhamento') {
update_comment_meta($comment_id, 'delibera_comment_tipo', 'encaminhamento');
$nencaminhamentos = get_post_meta($comment->comment_post_ID, 'delibera_numero_comments_encaminhamentos', true);
$nencaminhamentos++;
update_post_meta($comment->comment_post_ID, 'delibera_numero_comments_encaminhamentos', $nencaminhamentos);
$ndiscussoes = get_post_meta($comment->comment_post_ID, 'delibera_numero_comments_discussoes', true);
$ndiscussoes--;
update_post_meta($comment->comment_post_ID, 'delibera_numero_comments_discussoes', $ndiscussoes);
} else {
update_comment_meta($comment_id, 'delibera_comment_tipo', 'discussao');
$ndiscussoes = get_post_meta($comment->comment_post_ID, 'delibera_numero_comments_discussoes', true);
$ndiscussoes++;
update_post_meta($comment->comment_post_ID, 'delibera_numero_comments_discussoes', $ndiscussoes);
$nencaminhamentos = get_post_meta($comment->comment_post_ID, 'delibera_numero_comments_encaminhamentos', true);
$nencaminhamentos--;
update_post_meta($comment->comment_post_ID, 'delibera_numero_comments_encaminhamentos', $nencaminhamentos);
}
}
return $text;
}
开发者ID:cabelotaina,项目名称:delibera,代码行数:27,代码来源:delibera_edit_comment.php
示例6: dln_social_login_add_comment_meta
function dln_social_login_add_comment_meta($comment_id)
{
$social_login_comment_via_provider = isset($_POST['social_login_comment_via_provider']) ? $_POST['social_login_comment_via_provider'] : '';
if ($social_login_comment_via_provider != '') {
update_comment_meta($comment_id, 'social_login_comment_via_provider', $social_login_comment_via_provider);
}
}
开发者ID:httvncoder,项目名称:151722441,代码行数:7,代码来源:ui.php
示例7: activity_log
function activity_log($wp_comment_id = "", $lf_comment_id = "", $lf_activity_id = "")
{
// Use meta keys that will allow us to lookup by Livefyre comment i
update_comment_meta($wp_comment_id, LF_CMETA_PREFIX . $lf_comment_id, $lf_comment_id);
update_comment_meta($wp_comment_id, LF_AMETA_PREFIX . $lf_activity_id, $lf_activity_id);
return false;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:7,代码来源:livefyre.php
示例8: testCommentWithMeta
function testCommentWithMeta()
{
$post_id = $this->factory->post->create();
$comment_id = $this->factory->comment->create(array('comment_post_ID' => $post_id));
update_comment_meta($comment_id, 'rebney', 'Winnebago Man');
update_comment_meta($comment_id, 'quote', 'Will you do me a kindness?');
$comment = new TimberComment($comment_id);
$this->assertEquals('Winnebago Man', $comment->rebney);
}
开发者ID:rpkoller,项目名称:timber,代码行数:9,代码来源:test-timber-comment.php
示例9: create_object
/**
* Create a mock webhook delivery.
*
* @since 2.2
* @see WP_UnitTest_Factory_For_comment::create_object()
* @param array $args
* @return int webhook delivery (comment) ID
*/
public function create_object($args)
{
$id = parent::create_object($args);
$comment_meta_args = array('_request_method' => 'POST', '_request_headers' => array('User-Agent', 'WooCommerce Hookshot'), '_request_body' => "webhook_id={$id}", '_response_code' => 200, '_response_messaage' => 'OK', '_response_headers' => array('server' => 'nginx'), '_response_body' => 'OK', '_duration' => '0.47976');
foreach ($comment_meta_args as $key => $value) {
update_comment_meta($id, $key, $value);
}
return $id;
}
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:17,代码来源:class-wc-unit-test-factory-for-webhook-delivery.php
示例10: update_comment
function update_comment($comment_id)
{
$comment = get_comment($comment_id);
$terms = $this->update_comment_terms($comment_id, $comment);
delete_comment_meta($comment_id, $this->meta_key);
foreach ($terms as $term) {
update_comment_meta($comment_id, $this->meta_key, $term);
}
$this->update_terms($comment->comment_post_ID);
}
开发者ID:rajbot,项目名称:tikirobot_p2,代码行数:10,代码来源:terms-in-comments.php
示例11: save
/**
* Save meta box data
*/
public static function save($location, $comment_id)
{
// Not allowed, return regular value without updating meta
if (!wp_verify_nonce($_POST['woocommerce_meta_nonce'], 'woocommerce_save_data') && !isset($_POST['rating'])) {
return $location;
}
// Update meta
update_comment_meta($comment_id, 'rating', intval($_POST['rating']));
// Return regular value after updating
return $location;
}
开发者ID:donpapa26,项目名称:bakancslistad,代码行数:14,代码来源:class-wc-meta-box-order-reviews.php
示例12: do_save
public function do_save($return_val, $params, $metas, $module)
{
$comment_id = wp_insert_comment($params);
if (!is_numeric($comment_id)) {
return false;
}
foreach ($metas as $key => $value) {
update_comment_meta($comment_id, $key, $value);
}
return $comment_id;
}
开发者ID:juanfra,项目名称:fakerpress,代码行数:11,代码来源:comment.php
示例13: tracker_set_comment_status
function tracker_set_comment_status()
{
global $_POST;
$commentid = $_POST['id'];
$status = $_POST['status'];
if (!current_user_can('edit_post', $commentid)) {
die("Sorry you can't do that.");
}
add_comment_meta($commentid, 'tracker_comment_status', $status, true) or update_comment_meta($commentid, 'tracker_comment_status', $status) or die("Failed to add or update status for comment.");
die("OK");
}
开发者ID:ahrencode,项目名称:WP-Response-Tracker,代码行数:11,代码来源:response-tracker.php
示例14: record_successful_outbound_message_batch
/**
*
* @since 2.0.0
*
* @param object $data
* @return $this
*/
protected function record_successful_outbound_message_batch($data)
{
if (empty($data->id)) {
Prompt_Logging::add_error(Prompt_Enum_Error_Codes::OUTBOUND, __('Got an unrecognized outbound message batch response.', 'Postmatic'), array('result' => $data, 'comment_id' => $this->comment->comment_ID));
return $this;
}
$sent_ids = get_comment_meta($this->comment->comment_ID, self::$outbound_message_batch_ids_meta_key, true);
$sent_ids = $sent_ids ? $sent_ids : array();
$sent_ids[] = $data->id;
update_comment_meta($this->comment->comment_ID, self::$outbound_message_batch_ids_meta_key, $sent_ids);
return $this;
}
开发者ID:postmatic,项目名称:beta-dist,代码行数:19,代码来源:comment-mailer.php
示例15: wpad_edit_comment_saved
function wpad_edit_comment_saved()
{
$ignore = array('comment_status', 'comment_id', 'comment', 'action');
foreach ($_POST as $key => $value) {
if (!in_array($key, $ignore)) {
update_comment_meta($_POST['comment_id'], $key, $value);
}
}
$this->set_comment_status($_POST['comment_id'], $_POST['comment_status']);
$this->update_comment($_POST);
die;
}
开发者ID:dss-web,项目名称:erklaringmothatytringer-wp-advance-comment,代码行数:12,代码来源:saved-comment-edit.php
示例16: hocwp_comment_likes_ajax_callback
function hocwp_comment_likes_ajax_callback()
{
$result = array();
$likes = isset($_POST['likes']) ? absint($_POST['likes']) : 0;
$comment_id = isset($_POST['comment_id']) ? absint($_POST['comment_id']) : 0;
$likes++;
update_comment_meta($comment_id, 'likes', $likes);
$result['likes'] = hocwp_number_format($likes);
$_SESSION['comment_' . $comment_id . '_likes'] = 1;
echo json_encode($result);
die;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:ajax.php
示例17: save_comment_wpse_82317
/**
* Save Custom Comment Field
* This hook deals with the redirect after saving, we are only taking advantage of it
*/
function save_comment_wpse_82317($location, $comment_id)
{
// Not allowed, return regular value without updating meta
if (!wp_verify_nonce($_POST['noncename_wpse_82317'], plugin_basename(__FILE__)) && !isset($_POST['meta_comment_field'])) {
return $location;
}
// Convert text field into array splitted by comma
$tags = array_map('trim', explode(',', $_POST['meta_tag_field']));
$tags = array_map('sanitize_text_field', $tags);
// Update meta
update_comment_meta($comment_id, 'meta_tag_field', implode(',', $tags));
// Return regular value after updating
return $location;
}
开发者ID:josafafilho,项目名称:marcocivil-tema,代码行数:18,代码来源:functions.php
示例18: Save
/**
* Save opinion
* @return bool $status
*/
function Save()
{
if (!empty($this->opinion_post_ID) && !empty($this->author_id) && !empty($this->opinion_content)) {
$post_type = get_post_type($this->opinion_post_ID);
// If element is a product or a product variation, we accept to save opinion
if ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT || $post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
/** Insert comment **/
$data = array('comment_post_ID' => $this->opinion_post_ID, 'comment_author_IP' => $this->author_IP, 'comment_author' => $this->author, 'comment_author_email' => $this->author_email, 'comment_content' => $this->opinion_content, 'comment_date' => $this->opinion_date, 'user_id' => $this->author_id, 'comment_approved' => $this->opinion_approved, 'comment_type' => WPS_OPINION_ID);
$this->id = wp_insert_comment($data);
if (!empty($this->id)) {
$status = update_comment_meta($this->id, '_wps_customer_rate', $this->opinion_rate);
}
}
}
return $status;
}
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:20,代码来源:wps_opinion_model.php
示例19: rate_comment
function rate_comment($comment_id, $rating)
{
$rating = substr(trim($rating), 0, 1);
$metastring = get_comment_meta($comment_id, 'qans_ratingmeta');
//use a string <averagerating>:<#ofratings>
$metadata = explode(":", $metastring[0]);
if ($metadata[1] == 0) {
$metastring = $rating . ":1";
$newrating = $rating;
} else {
$newrating = ($metadata[0] * $metadata[1] + $rating) / ($metadata[1] + 1);
$metadata[1]++;
$metastring = $newrating . ":" . $metadata[1];
}
update_comment_meta($comment_id, 'qans_ratingmeta', $metastring);
//update the database
$ratinghtml = "Average Rating:" . substr($newrating, 0, 3) . "/5 Your rating: " . $rating . "/5";
return $ratinghtml;
//return the string
}
开发者ID:rongandat,项目名称:cyarevfoods,代码行数:20,代码来源:rateanswer.php
示例20: check_for_spam
/**
* Check if the comment is spam or not
*
* @param $id
* @param $comment
*/
public function check_for_spam($id, $comment)
{
$url = 'https://spamlytics.com/?api_action=comment_verify&api_key=' . $this->settings['api_key'];
$response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 10, 'blocking' => true, 'body' => array('comment' => $comment->comment_content, 'name' => $comment->comment_author, 'email' => $comment->comment_author_email, 'website' => $comment->comment_author_url, 'ip' => $comment->comment_author_IP)));
if (isset($response['body'])) {
$result = json_decode($response['body']);
update_comment_meta($id, 'spamlytics_result', $result->result);
update_comment_meta($id, 'spamlytics_points', $result->points);
if ($result->result === 'ok') {
$comment = (array) $comment;
$comment['comment_approved'] = 1;
wp_update_comment($comment);
}
if ($result->result === 'spam') {
$comment = (array) $comment;
$comment['comment_approved'] = 'spam';
wp_update_comment($comment);
}
}
}
开发者ID:SpamLytics,项目名称:Spam-Prevention-by-SpamLytics,代码行数:26,代码来源:class-comments.php
注:本文中的update_comment_meta函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论