Changeset 5055 for trunk/includes/replies/functions.php
- Timestamp:
- 07/29/2013 01:41:36 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/includes/replies/functions.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/replies/functions.php
r5036 r5055 169 169 170 170 // Topic does not exist 171 } elseif ( ! get_post( $posted_topic_id ) ) {171 } elseif ( ! bbp_get_topic( $posted_topic_id ) ) { 172 172 bbp_add_error( 'bbp_reply_topic_id', __( '<strong>ERROR</strong>: Topic does not exist.', 'bbpress' ) ); 173 173 … … 210 210 211 211 // Forum does not exist 212 } elseif ( ! get_post( $posted_forum_id ) ) {212 } elseif ( ! bbp_get_forum( $posted_forum_id ) ) { 213 213 bbp_add_error( 'bbp_topic_forum_id', __( '<strong>ERROR</strong>: Forum does not exist.', 'bbpress' ) ); 214 214 … … 1626 1626 * 1627 1627 * @param int $reply_id Reply id 1628 * @uses get_post() To get the reply1628 * @uses bbp_get_reply() To get the reply 1629 1629 * @uses do_action() Calls 'bbp_spam_reply' with the reply ID 1630 1630 * @uses add_post_meta() To add the previous status to a meta 1631 * @uses wp_ insert_post() To insert the updated post1631 * @uses wp_update_post() To insert the updated post 1632 1632 * @uses do_action() Calls 'bbp_spammed_reply' with the reply ID 1633 1633 * @return mixed False or {@link WP_Error} on failure, reply id on success … … 1636 1636 1637 1637 // Get reply 1638 $reply = get_post( $reply_id, ARRAY_A);1638 $reply = bbp_get_reply( $reply_id ); 1639 1639 if ( empty( $reply ) ) 1640 1640 return $reply; 1641 1641 1642 1642 // Bail if already spam 1643 if ( bbp_get_spam_status_id() === $reply ['post_status'])1643 if ( bbp_get_spam_status_id() === $reply->post_status ) 1644 1644 return false; 1645 1645 … … 1648 1648 1649 1649 // Add the original post status as post meta for future restoration 1650 add_post_meta( $reply_id, '_bbp_spam_meta_status', $reply ['post_status']);1650 add_post_meta( $reply_id, '_bbp_spam_meta_status', $reply->post_status ); 1651 1651 1652 1652 // Set post status to spam 1653 $reply ['post_status']= bbp_get_spam_status_id();1653 $reply->post_status = bbp_get_spam_status_id(); 1654 1654 1655 1655 // No revisions … … 1657 1657 1658 1658 // Update the reply 1659 $reply_id = wp_ insert_post( $reply );1659 $reply_id = wp_update_post( $reply ); 1660 1660 1661 1661 // Execute post spam code … … 1672 1672 * 1673 1673 * @param int $reply_id Reply id 1674 * @uses get_post() To get the reply1674 * @uses bbp_get_reply() To get the reply 1675 1675 * @uses do_action() Calls 'bbp_unspam_reply' with the reply ID 1676 1676 * @uses get_post_meta() To get the previous status meta 1677 1677 * @uses delete_post_meta() To delete the previous status meta 1678 * @uses wp_ insert_post() To insert the updated post1678 * @uses wp_update_post() To insert the updated post 1679 1679 * @uses do_action() Calls 'bbp_unspammed_reply' with the reply ID 1680 1680 * @return mixed False or {@link WP_Error} on failure, reply id on success … … 1683 1683 1684 1684 // Get reply 1685 $reply = get_post( $reply_id, ARRAY_A);1685 $reply = bbp_get_reply( $reply_id ); 1686 1686 if ( empty( $reply ) ) 1687 1687 return $reply; 1688 1688 1689 1689 // Bail if already not spam 1690 if ( bbp_get_spam_status_id() !== $reply ['post_status'])1690 if ( bbp_get_spam_status_id() !== $reply->post_status ) 1691 1691 return false; 1692 1692 … … 1695 1695 1696 1696 // Get pre spam status 1697 $reply ['post_status']= get_post_meta( $reply_id, '_bbp_spam_meta_status', true );1697 $reply->post_status = get_post_meta( $reply_id, '_bbp_spam_meta_status', true ); 1698 1698 1699 1699 // If no previous status, default to publish 1700 if ( empty( $reply ['post_status']) ) {1701 $reply ['post_status']= bbp_get_public_status_id();1700 if ( empty( $reply->post_status ) ) { 1701 $reply->post_status = bbp_get_public_status_id(); 1702 1702 } 1703 1703 … … 1709 1709 1710 1710 // Update the reply 1711 $reply_id = wp_ insert_post( $reply );1711 $reply_id = wp_update_post( $reply ); 1712 1712 1713 1713 // Execute post unspam code
Note: See TracChangeset
for help on using the changeset viewer.