[wp-hackers] Plugin Problem - Working sometimes...
Gaarai
gaarai at gaarai.com
Fri Jul 25 04:50:49 GMT 2008
The filter wouldn't actually save the data in the post. Essentially, the
post will remain just as it was input, but it will display with the
author data added onto it. The function that you would hook to would use
the data given to it to find the author information, use that to get the
author data to be added, and then return the post data with the author
data added to the end.
If you really want to stick with the original concept, your problem is
that the action hook that you are using isn't a good one. It looks like
the publish_post action hook hasn't been used (no corresponding
do_action call anywhere) since 2.2.3. You say that your code works some
of the time. I really don't know how that's possible since that hook
doesn't get called. I am assuming that you are using at least a fairly
recent of WordPress however.
The hook you most likely want to look into is the save_post action hook.
You'll have to do some checks to see if you've modified the post or not,
but that's a readily-solved problem.
Travis Quinnelly [MUO] wrote:
> I think we decided for this route since prior to this plugin, the authors
> were adding this to every post. Therefore, these "footers" are already
> inputted into hundreds of posts already as part of "the_content".
>
> Wouldn't this route duplicate those?
>
> On Thu, Jul 24, 2008 at 11:17 PM, Viper007Bond <viper at viper007bond.com>
> wrote:
>
>
>> Yeah, filters are the way to go here. You're doing it the really, really
>> hard (and I guess technically "wrong") way.
>>
>> On Thu, Jul 24, 2008 at 9:08 PM, Gaarai <gaarai at gaarai.com> wrote:
>>
>>
>>> Why are you directly modifying the post at all? If you think about it,
>>>
>> this
>>
>>> would work much better if you are just appending the data to each post
>>>
>> when
>>
>>> it is shown (I.E. hook to the the_content filter). The reason is simple:
>>>
>> if
>>
>>> the author ever changes their info, your current system doesn't have a
>>> method for updating the data that is already added to the posts.
>>>
>>>
>>> Travis Quinnelly [MUO] wrote:
>>>
>>>
>>>> I have an issue with a plugin apparently not "hooking" all the time.
>>>>
>>>> This particular plugin appends each article with a custom "author
>>>>
>> footer"
>>
>>>> which is saved in each author's profile page to the db. It grabs the
>>>> author
>>>> footer, and places it at the end of the_content on publish.
>>>>
>>>> The problem is, that it doesnt always do it. It works about 1/3 of the
>>>> time,
>>>> and I cant figure out why.
>>>>
>>>> Here's the code over at wordpress.pastebin.com:
>>>> http://wordpress.pastebin.com/m71910a05
>>>>
>>>> Any ideas why this is only partially working? Shouldnt it work every
>>>>
>> time
>>
>>>> a
>>>> post is published?
>>>> Would the "scheduled" posts to be published get the same action that a
>>>> click
>>>> to the "Publish" button would?
>>>>
>>>> Any help is appreciated.
>>>> Thanks,
>>>>
>>>> --------------------
>>>> Travis Quinnelly
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>>
>>
>> --
>> Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
More information about the wp-hackers
mailing list