News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Message Id from createpost()

Started by Tauzero, May 23, 2008, 11:47:55 AM

Previous topic - Next topic

Tauzero

Hey guys,
I first want to say that I've posted before, and was very happy with the speed and helpfulness(is that a real word... likely not) of the replies I've received.  I am doing another minor tweak to my SMF board (v1.1.5).  I have created a script to automatically generate topics based on a minimal user input, the posts say if a contract has been received, and if so, which office has it, and when they received it.  The topic that is created is meant for the discussion of these contracts.  What I want to do is set up a link within the post to a php script that will modify the post, marking it as sent to another office or received by an office.  I know how I'd like to do this, it's not too difficult.  The basic plan is to have the php file created when the post is created, then have it delete itself when it's done executing.  The part that I need help on is to get the message Id.  I would figure that the createpost() function would return the message id like createboard() but it's listed as only returning true or false.  I'd rather not modify the function, as it might cause problems elsewhere.  Is there an easy way of doing this that i don't see?

Thanks,
~Tau

Dannii

The $message argument is passed by reference, so when the ID is set, you can use it later. (I think)
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Tauzero

So would I access it through $message or $message[id] or something else?  Also, thanks for the quick reply.

~Tau

Dannii

It would be $message['id']. Try it. You'll have to use proper variable arrays though, and not pass make the arrays in the function call itself.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Tauzero

That got it.  Thanks Dannii.  Now that I know what to look at it I see in the Function Database where it shows that the arrays are passed as references...  Guess I should just read the instructions.  Anyway, thanks for pointing me in the right direction.

Thanks again,
~Tau

Advertisement: