Can someone tell me where this 'test_modification.php' script can be found please?

In the only attachment in the first post of this thread?

Umm, thanks. I've only been a member of a couple of SMF forums before and neither of those had attachments activated so it never crossed my mind that such a thing was available. Of course, now I know what to look for I see the OP does, indeed, have an attachment which I have now downloaded.

Can someone tell me where this 'test_modification.php' script can be found please?

In the only attachment in the first post of this thread?

Note that the attachment is only visible if you are logged in to the forum. IMHO, though, the package-sdk file is important enough to make it available in the downloads area as well, where it would be a lot easier to find to begin with.

1) In an <operation><add></add></operation> CDATA section are you able to add variables in there?

I'm modifying an ini file that comes with a 3rd party library and I want to write out the SMF connection details into it so the application uses the SMF database, rather than having to set up another DB by hand. I'm assuming you can't just put $db_name or {db_name} in the middle of a CDATA section though. (It tried using $db_name and it does weird things!

2) The above ini file I'm wanting to modify is being added by a <require-dir> earlier on. The tests performed on the package however fail because they are executed before the directory is unfolded into the target directory. Is there any way around this?

I hope I'm not doing something really dumb here, but help would be appreciated

Ok, correct me if I'm wrong here, but you are requiring a directory within your package and than you want to edit a file that is in the directory after the directory is added to their server?? If yes to both of these, than you don't want to use any <operation> tags for this.

Within the package-info.xml file, create a <code>your php filepath that gets executed</code> tag. Within this file...

Than use file_put_contents to write whatever you want to the file. You can get the prefix by using the $db_prefix from Settings.php. Or you can use {db_prefix} to be written to that file as well.

Atleast, this is the method that I would try first, and not sure if the order matters, but you can place the <code> tag at the bottom within the <install> tag. You can do a test to see if the file exists before you try to read from it, using file_exists(path to the ini file), within your php file that gets executed within the <code></code> tag of package-info.xml.

Well, that would be my first approach to trying to do this atleast. Haven't tested it, but seems likely to work if the ini file is included with your package...

Good Luck.

P.S. - Ofcourse, you can create an entirely separate package altogether and than do it your way. But the user would need to install 2 packages to get it functioning properly.

See the Modifications Page to upload your mods for SMF and browse the others' mods. After your modification is inspected against Customization Approval Guidelines and is accepted to be approved, then it will be available for anyone to download from simplemachines.org. So you'd better check the guideliness before you submit your work.