本文整理汇总了PHP中wpdb::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP wpdb::delete方法的具体用法?PHP wpdb::delete怎么用?PHP wpdb::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpdb
的用法示例。
在下文中一共展示了wpdb::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteRuleset
/**
* Delete a specfic ruleset from database.
*
* @param int $rulesetId Primary key of the ruleset.
* @return bool True if ruleset was deleted or false otherwise.
*/
public function deleteRuleset($rulesetId)
{
if (empty($rulesetId)) {
return false;
}
$deleteResult = $this->wpdb->delete($this->wpdb->rulesets, array('id' => (int) $rulesetId));
return $deleteResult === false ? false : true;
}
示例2: delete
/**
* Delete entity from database.
*
* @return int|false
*/
public function delete()
{
if ($this->values['id']) {
return $this->wpdb->delete($this->table_name, array('id' => $this->values['id']), array('%d'));
}
return false;
}
示例3: save
public function save()
{
$staff_id = $this->data['staff_id'];
if ($staff_id) {
$this->wpdb->delete(AB_StaffService::getTableName(), array('staff_id' => $staff_id), array('%d'));
if (isset($this->data['service'])) {
foreach ($this->data['service'] as $service_id) {
$staffService = new AB_StaffService();
$staffService->set('service_id', $service_id);
$staffService->set('staff_id', $staff_id);
$staffService->set('price', $this->data['price'][$service_id]);
$staffService->set('capacity', $this->data['capacity'][$service_id]);
$staffService->save();
}
}
}
}
示例4: remove
/**
* Deletes the record of the passed ID
*
* @since 2.0.0
*
* @param int $id ID of the record to delete
*
* @return bool
* @throws Exception
*/
public function remove($id)
{
// Make sure the ID passed is an integer.
if (!is_int($id)) {
throw new Exception(__('A numerical ID must be passed.', 'optin-monster'));
}
// Setup the WHERE clause.
$where = array('lead_id' => $id);
// Delete the record.
if (false == $this->db->delete($this->table, $where)) {
throw new Exception(__('There was an error deleting the lead.', 'optin-monster'));
} else {
return true;
}
}
示例5: delete_relation
/**
* @param int $source_site_id
* @param int $target_site_id
* @param int $source_content_id post_id or term_taxonomy_id
* @param int $target_content_id
* @param string $type
* @return int Number of deleted rows
*/
public function delete_relation($source_site_id, $target_site_id, $source_content_id, $target_content_id = 0, $type = 'post')
{
$where = array('ml_source_blogid' => $source_site_id, 'ml_source_elementid' => $source_content_id, 'ml_type' => $type);
$where_format = array('%d', '%d', '%s');
if (0 < $target_site_id) {
$where['ml_blogid'] = $target_site_id;
$where_format[] = '%d';
}
if (0 < $target_content_id) {
$where['ml_elementid'] = $target_content_id;
$where_format[] = '%d';
}
$result = (int) $this->wpdb->delete($this->link_table, $where, $where_format);
do_action('mlp_debug', current_filter() . '/' . __METHOD__ . '/' . __LINE__ . " - {$this->wpdb->last_query}");
return $result;
}
示例6: drop_subscription
public function drop_subscription($fromsub_id)
{
if (!apply_filters('pre_membership_drop_subscription', true, $fromsub_id, $this->ID) || !$this->on_sub($fromsub_id)) {
return false;
}
// Get the level for this subscription before removing it
$fromlevel_id = $this->get_level_for_sub($fromsub_id);
$this->_wpdb->delete(MEMBERSHIP_TABLE_RELATIONS, array('user_id' => $this->ID, 'sub_id' => $fromsub_id), array('%d', '%d'));
// Update users start and expiry meta
delete_user_meta($this->ID, 'start_current_' . $fromsub_id);
delete_user_meta($this->ID, 'expire_current_' . $fromsub_id);
delete_user_meta($this->ID, 'sent_msgs_' . $fromsub_id);
delete_user_meta($this->ID, 'using_gateway_' . $fromsub_id);
$expiring = get_user_meta($this->ID, '_membership_expire_next', true);
if ($expiring == $fromsub_id) {
delete_user_meta($this->ID, '_membership_expire_next');
}
$this->set_role(get_option('default_role'));
do_action('membership_drop_subscription', $fromsub_id, $fromlevel_id, $this->ID);
return true;
}
示例7: actionUnlicenseSite
protected function actionUnlicenseSite($productSlug, $licenseKey = null, $token = null)
{
$this->requireRequestMethod('POST');
$license = $this->validateLicenseRequest($productSlug, $licenseKey, $token, $this->post);
$siteUrl = $this->sanitizeSiteUrl(isset($this->post['site_url']) ? strval($this->post['site_url']) : '');
$usingToken = !empty($token);
$response = array('license' => $this->prepareLicenseForOutput($license, $usingToken));
if (!$usingToken) {
$token = $this->wpdb->get_var($this->wpdb->prepare("SELECT token FROM `{$this->tablePrefix}tokens` WHERE site_url = %s AND license_id = %d", $siteUrl, $license['license_id']));
}
if (empty($token)) {
//The user tried to un-license a site that wasn't licensed in the first place. Still,
//the desired end state - site not licensed - has ben achieved, so treat it as a success.
$response['notice'] = "The specified site wasn't licensed in the first place.";
} else {
$this->wpdb->delete($this->tablePrefix . 'tokens', array('token' => $token, 'license_id' => $license['license_id']));
//Reload the license to ensure the site list is correct.
$license = $this->loadLicense($license['license_key']);
$response['license'] = $this->prepareLicenseForOutput($license, $usingToken);
$response = array_merge($response, array('site_token_removed' => $token, 'site_url' => $siteUrl));
}
$this->outputResponse($response);
}
示例8: removeSubscriber
/**
*
* @param string $email
* @param string $name
*
* @return false|int|void
*/
public function removeSubscriber($id)
{
return $this->wpdb->delete($this->table, ['id' => $id]);
}
示例9: delete
/**
*
* @return $this
*/
public function delete()
{
$this->tm_records->icl_translation_status_by_translation_id($this->translation_id)->delete();
$this->wpdb->delete($this->wpdb->prefix . $this->table, $this->get_args());
return $this;
}
示例10: deleteRow
/**
* Delete a row in the table
*
* @see wpdb::delete()
*/
public function deleteRow($where, $where_format = null)
{
return $this->db->delete($this->schema->table_name, $where, $where_format);
}
示例11: foreach
function remove_level_members($id, $levels)
{
foreach ($levels as $level) {
$this->db->delete(MEMBERSHIP_TABLE_RELATIONS, array('sub_id' => $this->id, 'level_id' => $level->id), array('%d', '%d'));
}
}
示例12: delete_form
/**
* Delete a form.
*
* @author Jeremy Pry
*
* @param int $form_id The form ID to delete.
*
* @return bool Whether the form was successfully deleted.
*/
public function delete_form($form_id)
{
return (bool) $this->wpdb->delete($this->prefixed_table_name, array('id' => $form_id), '%d');
}
开发者ID:yikesinc,项目名称:yikes-inc-easy-mailchimp-extender,代码行数:13,代码来源:class-yikes-inc-easy-mailchimp-extender-forms.php
示例13: delete
function delete()
{
return $this->db->delete(MEMBERSHIP_TABLE_COMMUNICATIONS, array('id' => $this->id), array('%d'));
}
示例14: delete
/**
* Delete taxonomy meta
*
* @param int $term_id
* @param string $key
* @return int
*/
public function delete($term_id, $key)
{
wp_cache_delete($this->_get_cache_key($term_id, $key), 'taxonomy-meta');
return $this->_db->delete($this->_table, ['term_id' => $term_id, 'meta_key' => $key]);
}
示例15: wpdb
<h2>Star Citizen Ships</h2>
<p>Cool Ship Stuff!</p>
<?php
// saves data
$scdb = new wpdb(DB_USER, DB_PASSWORD, "uolttorg_sc_data", DB_HOST);
if (isset($_POST['delete_ship'])) {
foreach ($_POST['delete_ship'] as $id) {
$scdb->delete("ships", array("shipUID" => $id));
}
unset($_POST['delete_ship']);
}
if (isset($_POST['add_edit_ship'])) {
if ($_POST['add_edit_ship'] == "add") {
unset($_POST['add_edit_ship']);
$err_c = 0;
foreach ($_POST as $k => $v) {
if (empty($v)) {
echo '<div class="error notice"><p>Please set the "' . $k . '" field!</p></div>';
$err_c++;
}
}
if ($err_c == 0) {
$scdb->insert("ships", $_POST);
}
} elseif ($_POST['add_edit_ship'] != "add" && $_POST['add_edit_ship'] != "") {
$data = array();
foreach ($_POST as $k => $v) {
if ($v != "" && $k != "add_edit_ship") {
$data[$k] = $v;