#12446 closed defect (bug) (invalid)
"get_comments" transforms post id
| Reported by: | jmabe | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
$post_id is being set to
$post_id = absint($post_id)
which would make a negative post id pull comments for the positive post id. This is problematic if by chance the post_id is set to -1, and you happen to have that first hello world post in there, it will always pull that first hello world comment.
Patch attached.
Attachments (1)
Change History (8)
#2
in reply to: ↑ 1
@
17 years ago
Replying to Denis-de-Bernardy:
the database stores IDs as bigint(20) unsigned.
but what if your plugin is emulating a post object, and is passing a negative number for the ID :)
#4
@
17 years ago
For what it's worth, post_id 0 won't work without some changes to the get_permalink function as it uses 0 as the default. If you emulate a post object so that you can return 100% custom content, get_permalink needs to be overridden and needs to have a non-zero post ID passed to it.
#5
@
17 years ago
can you expand a bit on what you'd like to do? it clear you want to create a fake post of sorts, but it would help understand why in order to make better sense of the ticket...
#6
@
17 years ago
jmabe and I made a product / plugin called dsIDXpress for the company we work for. It makes an API call to our servers for the data and returns the markup in the context of a fake post. We went back and forth between post ID 0 and -1 and ultimately choose -1 because of the get_permalink issue.
Here's the relevant source for the plugin: <http://plugins.svn.wordpress.org/dsidxpress/trunk/client.php>. The Activate function is where the fake post is created.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
the database stores IDs as bigint(20) unsigned.