本文整理汇总了PHP中ap_delete_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP ap_delete_meta函数的具体用法?PHP ap_delete_meta怎么用?PHP ap_delete_meta使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ap_delete_meta函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ap_remove_vote
/**
* @param string $type
*/
function ap_remove_vote($type, $userid, $actionid, $receiving_userid)
{
$row = ap_delete_meta(array('apmeta_type' => $type, 'apmeta_userid' => $userid, 'apmeta_actionid' => $actionid));
if ($row !== false) {
do_action('ap_vote_removed', $userid, $type, $actionid, $receiving_userid);
}
return $row;
}
示例2: ap_remove_follower
/**
* Remove a follower
* @param integer $current_user_id Current user id
* @param integer $user_to_follow user id to unfollow
* @return boolean|integer
*/
function ap_remove_follower($current_user_id, $user_to_follow)
{
$row = ap_delete_meta(array('apmeta_type' => 'follower', 'apmeta_userid' => $current_user_id, 'apmeta_actionid' => $user_to_follow));
if ($row !== false) {
do_action('ap_removed_follower', $current_user_id, $user_to_follow);
}
return $row;
}
示例3: ap_remove_parti
function ap_remove_parti($post_id, $user_id = false, $value = false)
{
$where = array('apmeta_type' => 'parti', 'apmeta_actionid' => $post_id, 'apmeta_userid' => $user_id);
if ($value !== false) {
$where['apmeta_value'] = $value;
}
$rows = ap_delete_meta($where);
/* Update the meta only if successfully deleted */
if ($rows !== false) {
$current_parti = ap_get_parti($post_id, true);
update_post_meta($post_id, ANSPRESS_PARTI_META, $current_parti);
}
}
示例4: ap_delete_flag
/**
* Delete post flag
*/
public function ap_delete_flag()
{
$id = (int) sanitize_text_field($_POST['id']);
if (wp_verify_nonce($_POST['__nonce'], 'flag_delete' . $id) && current_user_can('manage_options')) {
return ap_delete_meta(false, $id);
}
die;
}
示例5: ap_delete_notification
function ap_delete_notification($meta_id = false, $current_user_id = false, $affected_user_id = false, $type = false)
{
global $wpdb;
if ($meta_id !== false) {
$row = ap_delete_meta(false, $meta_id);
} else {
$row = $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->prefix . "ap_meta\r\r\n\t\t\t\t WHERE apmeta_actionid = %d\r\r\n\t\t\t\t AND apmeta_userid = %d\r\r\n\t\t\t\t AND apmeta_param = %s\r\r\n\t\t\t\t AND (apmeta_type = 'notification' OR apmeta_type = 'unread_notification')\r\r\n\t\t\t\t ", $affected_user_id, $current_user_id, $type));
}
if (FALSE !== $row) {
do_action('ap_delete_notification', $current_user_id, $affected_user_id, $type);
}
return $row;
}
示例6: ap_reputation_log_delete
/**
* @param string $type
*/
function ap_reputation_log_delete($type, $uid, $reputation = null, $data = null)
{
$new_reputation = ap_get_reputation($uid) - $reputation;
$row = ap_delete_meta(array('apmeta_type' => 'reputation', 'apmeta_userid' => $uid, 'apmeta_actionid' => $data, 'apmeta_value' => $reputation, 'apmeta_param' => $type));
update_user_meta($uid, 'ap_reputation', $new_reputation);
return $row;
}
示例7: trash_post_action
/**
* If a question is sent to trash, then move its answers to trash as well
* @param integer $post_id Post ID.
* @since 2.0.0
*/
public function trash_post_action($post_id)
{
$post = get_post($post_id);
if ($post->post_type == 'question') {
do_action('ap_trash_question', $post);
// Delete post ap_meta.
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $post->ID));
$ans = get_posts(array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => $post_id, 'showposts' => -1));
if ($ans > 0) {
foreach ($ans as $p) {
do_action('ap_trash_multi_answer', $p);
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $p->ID));
ap_remove_new_answer_history($p->ID);
wp_trash_post($p->ID);
}
}
}
if ($post->post_type == 'answer') {
$ans = ap_count_published_answers($post->post_parent);
$ans = $ans > 0 ? $ans - 1 : 0;
do_action('ap_trash_answer', $post);
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $post->ID));
ap_remove_question_subscriber($post->post_parent, $post->post_author);
ap_remove_new_answer_history($post->ID, $post->post_parent);
// Restore question history.
ap_restore_question_history($post->post_parent);
// Update answer count.
update_post_meta($post->post_parent, ANSPRESS_ANS_META, $ans);
}
}
示例8: trash_post_action
/**
* If a question is sent to trash, then move its answers to trash as well
* @param integer $post_id Post ID.
* @since 2.0.0
*/
public function trash_post_action($post_id)
{
$post = get_post($post_id);
if ($post->post_type == 'question') {
do_action('ap_trash_question', $post->ID, $post);
// Delete post ap_meta.
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $post->ID));
$ans = get_posts(array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => $post_id, 'showposts' => -1));
if ($ans > 0) {
foreach ($ans as $p) {
do_action('ap_trash_answer', $p->ID, $p);
$selcted_answer = ap_selected_answer();
if ($selcted_answer == $p->ID) {
update_post_meta($p->post_parent, ANSPRESS_SELECTED_META, false);
}
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $p->ID));
wp_trash_post($p->ID);
}
}
}
if ($post->post_type == 'answer') {
$ans = ap_count_published_answers($post->post_parent);
$ans = $ans > 0 ? $ans - 1 : 0;
do_action('ap_trash_answer', $post->ID, $post);
ap_delete_meta(array('apmeta_type' => 'flag', 'apmeta_actionid' => $post->ID));
// Update answer count.
update_post_meta($post->post_parent, ANSPRESS_ANS_META, $ans);
}
}
示例9: ap_remove_new_answer_history
/**
* Remove new answer history from ap_meta table and update post meta history
* @param integer $answer_id
* @return integer|false
*/
function ap_remove_new_answer_history($answer_id)
{
$row = ap_delete_meta(array('apmeta_type' => 'history', 'apmeta_value' => $answer_id, 'apmeta_param' => 'new_answer'));
return $row;
}
示例10: ap_delete_history
function ap_delete_history($user_id, $action_id, $value, $param = null)
{
$row = ap_delete_meta(array('apmeta_userid' => $user_id, 'apmeta_type' => 'history', 'apmeta_actionid' => $action_id, 'apmeta_value' => $value, 'apmeta_param' => $param));
if ($row) {
$last_activity = ap_get_latest_history($action_id);
update_post_meta($action_id, '__ap_history', array('type' => $last_activity['type'], 'user_id' => $last_activity['user_id'], 'time' => $last_activity['date']));
}
return $row;
}
示例11: ap_remove_vote
function ap_remove_vote($type, $userid, $actionid)
{
return ap_delete_meta(array('apmeta_type' => $type, 'apmeta_userid' => $userid, 'apmeta_actionid' => $actionid));
}
示例12: ap_point_log_delete
function ap_point_log_delete($type, $uid, $points = NULL, $data = NULL)
{
$new_point = ap_get_points($uid) - $points;
$row = ap_delete_meta(array('apmeta_type' => 'point', 'apmeta_userid' => $uid, 'apmeta_actionid' => $data, 'apmeta_value' => $points, 'apmeta_param' => $type));
update_user_meta($uid, 'ap_points', $new_point);
}
示例13: ap_delete_all_post_flags
/**
* Delete all flags vote of a post.
* @param integer $post_id Post id.
* @return boolean
*/
function ap_delete_all_post_flags($post_id)
{
return ap_delete_meta(array('apmeta_actionid' => (int) $post_id, 'apmeta_type' => 'flag'));
}
示例14: es_delete_history
function es_delete_history($user_id, $action_id, $value, $param = null)
{
return ap_delete_meta(array('apmeta_userid' => $user_id, 'apmeta_type' => 'history', 'apmeta_actionid' => $action_id, 'apmeta_value' => $value, 'apmeta_param' => $param));
}