当前位置: 首页>>代码示例>>PHP>>正文


PHP Subscription::Delete方法代码示例

本文整理汇总了PHP中Subscription::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::Delete方法的具体用法?PHP Subscription::Delete怎么用?PHP Subscription::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

        $data = array('member' => $member->user_id, 'user_id' => $user->user_id);
        if (!Subscription::Exist($data)) {
            $subscribed = Subscription::Create($data);
            Plugin::Trigger('subscribe.ajax.subscribe');
            echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_subscribed', array('username' => $member->username)), 'other' => (string) Language::GetText('unsubscribe')));
            exit;
        } else {
            echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_subscribe_duplicate')));
            exit;
        }
        ### Handle unsubscribe user from a member
    ### Handle unsubscribe user from a member
    case 'unsubscribe':
        // Verify user is logged in
        if (!$logged_in) {
            echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_subscribe_login')));
            exit;
        }
        // Delete subscription if one exists
        $subscription_id = Subscription::Exist(array('user_id' => $user->user_id, 'member' => $member->user_id));
        if ($subscription_id) {
            Subscription::Delete($subscription_id);
            Plugin::Trigger('subscribe.ajax.unsubscribe');
            echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_unsubscribed', array('username' => $member->username)), 'other' => (string) Language::GetText('subscribe')));
            exit;
        } else {
            echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_subscribe_noexist')));
            exit;
        }
}
// END action switch
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:subscribe.ajax.php

示例2: Delete

 /**
  * Delete a record
  * @param integer $id ID of record to be deleted
  * @return void Record is deleted from database
  */
 static function Delete($id)
 {
     App::LoadClass('Privacy');
     App::LoadClass('Avatar');
     App::LoadClass('Video');
     App::LoadClass('Subscription');
     App::LoadClass('Rating');
     App::LoadClass('Flag');
     App::LoadClass('Favorite');
     App::LoadClass('Comment');
     App::LoadClass('Post');
     App::LoadClass('Message');
     $db = Database::GetInstance();
     $user = new self($id);
     Plugin::Trigger('user.delete');
     // Delete Avatar
     if (!empty($user->avatar)) {
         Avatar::Delete($user->avatar);
     }
     // Delete Privacy Record
     $privacy_id = Privacy::Exist(array('user_id' => $id));
     Privacy::Delete($privacy_id);
     // Delete Comments
     $query = "SELECT comment_id FROM " . DB_PREFIX . "comments WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Comment::Delete($row->comment_id);
     }
     // Delete Ratings
     $query = "SELECT rating_id FROM " . DB_PREFIX . "ratings WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Rating::Delete($row->rating_id);
     }
     // Delete Favorites
     $query = "SELECT fav_id FROM " . DB_PREFIX . "favorites WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Favorite::Delete($row->fav_id);
     }
     // Delete Flags
     $query = "SELECT flag_id FROM " . DB_PREFIX . "flags WHERE id = {$id} AND type = 'user'";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Flag::Delete($row->flag_id);
     }
     // Delete Subscriptions
     $query = "SELECT sub_id FROM " . DB_PREFIX . "subscriptions WHERE user_id = {$id} OR member = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Subscription::Delete($row->sub_id);
     }
     // Delete Posts
     $query = "SELECT post_id FROM " . DB_PREFIX . "posts WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Post::Delete($row->post_id);
     }
     // Delete Messages
     $query = "SELECT message_id FROM " . DB_PREFIX . "messages WHERE user_id = {$id} OR recipient = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Message::Delete($row->message_id);
     }
     // Delete Videos
     $query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Video::Delete($row->video_id);
     }
     // Delete Privacy
     $query = "SELECT privacy_id FROM " . DB_PREFIX . "privacy WHERE user_id = {$id}";
     $result = $db->Query($query);
     while ($row = $db->FetchObj($result)) {
         Privacy::Delete($row->privacy_id);
     }
     // Delete User
     $query = "DELETE FROM " . DB_PREFIX . self::$table . " WHERE " . self::$id_name . " = {$id}";
     $db->Query($query);
 }
开发者ID:KmServer,项目名称:CumulusClips,代码行数:85,代码来源:User.php

示例3: User

View::InitView('subscriptions');
Plugin::Trigger('subscriptions.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 9;
$url = HOST . '/myaccount/subscriptions';
View::$vars->message = null;
/***********************
Handle Form if submitted
***********************/
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $data = array('user_id' => View::$vars->user->user_id, 'member' => $_GET['id']);
    $id = Subscription::Exist($data);
    if ($id) {
        $subscribed_user = new User($_GET['id']);
        Subscription::Delete($id);
        View::$vars->message = Language::GetText('success_unsubscribed', array('username' => $subscribed_user->username));
        View::$vars->message_type = 'success';
        Plugin::Trigger('subscriptions.unsubscribe');
    }
}
/******************
Prepare page to run
******************/
// Retrieve total count
$query = "SELECT sub_id FROM " . DB_PREFIX . "subscriptions WHERE user_id = " . View::$vars->user->user_id;
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:subscriptions.php


注:本文中的Subscription::Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。