Good evening,
First of all, I would like to say to the author of this plugin : you are really a genius. Chapeau ! I tried to start a plugin, but really to difficult for me now.
Now I would like only to implement the possibility to reply at a post (to create a correspondence between to user). To do that, I post the ID of a post (name : ‘AutosID’) from a page to the ‘reply’ page (make with TDO form plugin).
In my ‘reply’ page, I use the “Append to Content” widget and add some code as you said Mark in a other topic.
Sorry for this third same post but it s strange because a part of my post is always cut.
Little modification of the code :
if(isset($_POST['AutosID'])){
$autosID=$_POST['AutosID'];
$post_id_destis=get_post($autosID);
$destis = $post_id_destis->post_author;
add_meta_value($post_ID,’Destis’,$destis);
}
Good morning,
I also try :
if(isset($_POST['AutosID'])){
$autosID=$_POST['AutosID'];
$post_id_destis=get_post($autosID);
$destis = $post_id_destis->post_author;
function metaauteur($post_ID){
add_meta_value($post_ID,’Destis’,$destis);
}
return $post_ID;
add_action(‘publish_post’,'metaauteur’);
}
but it still doesn’t work.
As I mentioned in the other topic, trying adding some debug. You could do something like this (this would export the contents of get_post so you could see if it’s really getting a post):
$post_data = @get_post($autosID);
echo var_export($post_data,true);
(don’t forget the <php and ?> around any code!)
Actually ‘0′ is an invalid value for post id. It’ll be rejected everywhere. If a post is in draft it will have a valid post_id.
Please be aware that the ID of the post being processed can be accessed via $post_id (and not $post_ID). Perhaps this is why $post_ID is zero for you. Try it with $post_id (all lowercase)
Hi Mark. In fact there is two issue and you solve one of them, thank you.
The second issue is :
if i do :
if(isset($_POST['AutosID'])){
$autosID=$_POST['AutosID']; }
in a “text widget”, there is no problem, $autosID is set to AutosID (for example ‘6′) what I want.
But if I paste the same piece of code in a “Append to post content widget”, $autosID isn’ t set to AutosID.
It seems that i can’t get value from my previous page in “Append to post content widget”.
What can I do to retrieve my value ?
br
Romain
Try “$_REQUEST” instead of “$_POST” or if that fails, try “$post_args”. Normally all the data in $_POST or $_REQUEST gets copied into $post_args for widgets so they can be agnostic to how the form is submitted (i.e. ajax or normal POST operation). $post_args should be available in Append to post content widget.
Arg! Silly me. Of course it won’t work.
Yes, it’ll appear in the “text widget” because the text widget processes when the form displays. However when you submit the form “AutosID” is lost, it’s not submitted to the backend so “Append to post content” widget never sees it.
What you need to do is something like this. Create a text widget and give it this code:
<div><input type='hidden' name='AutosID' id='AutosID' value='<?php echo $_REQUEST['AutosID']; ?>' /></div>
This’ll add an extra “input” to your form. Then with the Append to post content widget, $autosID=$post_args['AutosID'] should work as AutosID is now a genuine input.
Mark,
I am trying to create my own captcha widget, and i’ve already got the code for the main captcha. I would just like to know how to create a widget for it that would display the image and textbox, and how to validate the input. Something that would just tell me how to create a widget that is pluggable into tdo-mini-forms.
Thanks for your time.
romain_becket
Subscriber
March 12th, 2009 at 11:16 pm
Good evening,
First of all, I would like to say to the author of this plugin : you are really a genius. Chapeau ! I tried to start a plugin, but really to difficult for me now.
Now I would like only to implement the possibility to reply at a post (to create a correspondence between to user). To do that, I post the ID of a post (name : ‘AutosID’) from a page to the ‘reply’ page (make with TDO form plugin).
In my ‘reply’ page, I use the “Append to Content” widget and add some code as you said Mark in a other topic.
to retrieve and store the name of the author of the first post.
But it doesn’t work. The meta-value isn’t created.
Could you help me ?
Best regards,
Romain
Permalink | Quote