本文整理汇总了PHP中BP_Messages_Thread::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Messages_Thread::delete方法的具体用法?PHP BP_Messages_Thread::delete怎么用?PHP BP_Messages_Thread::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Messages_Thread
的用法示例。
在下文中一共展示了BP_Messages_Thread::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: messages_ajax_delete
function messages_ajax_delete()
{
global $bp;
if (!isset($_POST['thread_ids'])) {
echo "-1[[split]]" . __('There was a problem deleting messages.', 'buddypress');
} else {
$thread_ids = explode(',', $_POST['thread_ids']);
for ($i = 0; $i < count($thread_ids); $i++) {
BP_Messages_Thread::delete($thread_ids[$i]);
}
_e('Messages deleted.', 'buddypress');
}
}
示例2: bp_dtheme_ajax_messages_delete
function bp_dtheme_ajax_messages_delete()
{
global $bp;
if (!isset($_POST['thread_ids'])) {
echo "-1<div id='message' class='error'><p>" . __('There was a problem deleting messages.', 'buddypress') . '</p></div>';
} else {
$thread_ids = explode(',', $_POST['thread_ids']);
for ($i = 0, $count = count($thread_ids); $i < $count; ++$i) {
BP_Messages_Thread::delete($thread_ids[$i]);
}
_e('Messages deleted.', 'buddypress');
}
}
示例3: messages_delete_thread
function messages_delete_thread( $thread_ids ) {
if ( is_array($thread_ids) ) {
$error = 0;
for ( $i = 0; $i < count($thread_ids); $i++ ) {
if ( !$status = BP_Messages_Thread::delete($thread_ids[$i]) )
$error = 1;
}
if ( $error )
return false;
do_action( 'messages_delete_thread', $thread_ids );
return true;
} else {
if ( !BP_Messages_Thread::delete($thread_ids) )
return false;
do_action( 'messages_delete_thread', $thread_ids );
return true;
}
}
示例4: bp_dtheme_ajax_messages_delete
function bp_dtheme_ajax_messages_delete()
{
// Bail if not a POST action
if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
return;
}
if (!isset($_POST['thread_ids'])) {
echo "-1<div id='message' class='error'><p>" . __('There was a problem deleting messages.', 'buddypress') . '</p></div>';
} else {
$thread_ids = explode(',', $_POST['thread_ids']);
for ($i = 0, $count = count($thread_ids); $i < $count; ++$i) {
BP_Messages_Thread::delete($thread_ids[$i]);
}
_e('Messages deleted.', 'buddypress');
}
}
示例5: messages_delete_thread
function messages_delete_thread($thread_ids)
{
if (!check_admin_referer('messages_delete_thread')) {
return false;
}
if (is_array($thread_ids)) {
$error = 0;
for ($i = 0; $i < count($thread_ids); $i++) {
if (!($status = BP_Messages_Thread::delete($thread_ids[$i]))) {
$error = 1;
}
}
if ($error) {
return false;
}
do_action('messages_delete_thread', $thread_ids);
return true;
} else {
if (!BP_Messages_Thread::delete($thread_ids)) {
return false;
}
do_action('messages_delete_thread', $thread_ids);
return true;
}
}
示例6: messages_delete_thread
function messages_delete_thread($thread_ids)
{
do_action('messages_before_delete_thread', $thread_ids);
if (is_array($thread_ids)) {
$error = 0;
for ($i = 0, $count = count($thread_ids); $i < $count; ++$i) {
if (!($status = BP_Messages_Thread::delete($thread_ids[$i]))) {
$error = 1;
}
}
if (!empty($error)) {
return false;
}
do_action('messages_delete_thread', $thread_ids);
return true;
} else {
if (!BP_Messages_Thread::delete($thread_ids)) {
return false;
}
do_action('messages_delete_thread', $thread_ids);
return true;
}
}
示例7: messages_delete_thread
/**
* Deletes message thread(s) for a given user.
*
* Note that "deleting" a thread for a user means removing it from the user's
* message boxes. A thread is not deleted from the database until it's been
* "deleted" by all recipients.
*
* @since 2.7.0 The $user_id parameter was added. Previously the current user
* was always assumed.
*
* @param int|array $thread_ids Thread ID or array of thread IDs.
* @param int $user_id ID of the user to delete the threads for. Defaults
* to the current logged-in user.
* @return bool True on success, false on failure.
*/
function messages_delete_thread($thread_ids, $user_id = 0)
{
if (empty($user_id)) {
$user_id = bp_loggedin_user_id();
}
/**
* Fires before specified thread IDs have been deleted.
*
* @since 1.5.0
* @since 2.7.0 The $user_id parameter was added.
*
* @param int|array $thread_ids Thread ID or array of thread IDs to be deleted.
* @param int $user_id ID of the user the threads are being deleted for.
*/
do_action('messages_before_delete_thread', $thread_ids, $user_id);
if (is_array($thread_ids)) {
$error = 0;
for ($i = 0, $count = count($thread_ids); $i < $count; ++$i) {
if (!BP_Messages_Thread::delete($thread_ids[$i], $user_id)) {
$error = 1;
}
}
if (!empty($error)) {
return false;
}
/**
* Fires after specified thread IDs have been deleted.
*
* @since 1.0.0
* @since 2.7.0 The $user_id parameter was added.
*
* @param int|array Thread ID or array of thread IDs that were deleted.
* @param int ID of the user that the threads were deleted for.
*/
do_action('messages_delete_thread', $thread_ids, $user_id);
return true;
} else {
if (!BP_Messages_Thread::delete($thread_ids, $user_id)) {
return false;
}
/** This action is documented in bp-messages/bp-messages-functions.php */
do_action('messages_delete_thread', $thread_ids, $user_id);
return true;
}
}
示例8: messages_delete_thread
/**
* Delete message thread(s).
*
* @param int|array Thread ID or array of thread IDs.
*
* @return bool True on success, false on failure.
*/
function messages_delete_thread($thread_ids)
{
/**
* Fires before specified thread IDs have been deleted.
*
* @since BuddyPress (1.5.0)
*
* @param int|array Thread ID or array of thread IDs that were deleted.
*/
do_action('messages_before_delete_thread', $thread_ids);
if (is_array($thread_ids)) {
$error = 0;
for ($i = 0, $count = count($thread_ids); $i < $count; ++$i) {
if (!BP_Messages_Thread::delete($thread_ids[$i])) {
$error = 1;
}
}
if (!empty($error)) {
return false;
}
/**
* Fires after specified thread IDs have been deleted.
*
* @since BuddyPress (1.0.0)
*
* @param int|array Thread ID or array of thread IDs that were deleted.
*/
do_action('messages_delete_thread', $thread_ids);
return true;
} else {
if (!BP_Messages_Thread::delete($thread_ids)) {
return false;
}
/** This action is documented in bp-messages/bp-messages-functions.php */
do_action('messages_delete_thread', $thread_ids);
return true;
}
}