Hello,
I need a way to add a new post to a discussion forum by php code ... I tried forum_add_new_post function
but I couldn't use it well .. is there anyone that used this function before? or have another way to do the target?
Thanks a lot Mr. Dan I solved the problem (it was with the $post object that I created in the code)
However.. do you know how I can get the url of profile picture for a particular user from moodle?
I need to display the user picture in my application
I found "user_picture" function which display the user image only .. I need the url !!! or even the picture file name
Hello,, I'm sorry
I used the following function from moodle :
forum_add_new_post($post, null, $message);
to add new post for a new discussion forum
I generated the following object called $post in order to get the information that are needed
$post = new stdClass();
$post->course = "5";
$post->forum = "2";
$post->discussion = "19";
$post->parent = "19";
$post->d_subject = "a new test";
$post->subject = 'Re: '.$post->d_subject;
$post->message = 'Test .. Add new post';
$post->messageformat = 1;
$post->messagetrust = 0;
$post->groupid = -1;
$post->itemid = 0;
in the beginning I didn't have any problem with this .. but today when I tried to rewrite it I found the error in the attached image.
all my old file has been deleted by mistake from one week only ... I collected my codes again but I have problem with this ... I didn't remember how I solved its problem
there's something missing here, maybe the post object is not correct, right?
waiting you ... the time will finish soon