Me: how can i change the author of a post ?
Claude: [October 31, 2026, 11:35:15 PM]
SMF has no built-in way to change the author of a post. The only related feature is Admin > Maintenance > Members > Reattribute Guest Posts, and that only works on posts made by guests. For member-to-member changes it has to be done in the database, so take a backup first.
1. The post itself (smf_messages, or your table prefix):
UPDATE smf_messages
SET id_member = NEW_ID, poster_name = 'NewName', poster_email = 'new@email'
WHERE id_msg = MSG_ID;
2. The topic row. If the post is the first or last message in its topic, the topic stores the member too:
UPDATE smf_topics SET id_member_started = NEW_ID WHERE id_first_msg = MSG_ID;
UPDATE smf_topics SET id_member_updated = NEW_ID WHERE id_last_msg = MSG_ID;
3. Post counts. SMF doesn't adjust these for you. If the board counts posts, add 1 to the new author's smf_members.posts and subtract 1 from the old author's.
Run SELECT id_msg, id_topic, id_member FROM smf_messages WHERE id_msg = MSG_ID; before and after to confirm the change.
Me: Give me a single batch php job to run please and let's call it new reassign_author.php
Claude: [October 31, 2026, 11:38:23 PM]
reassign_author_v1.0.0.zip is delivered. It holds reassign_author.php and a short manual, reassign_author.md.
Run it from the forum root, next to Settings.php:
php reassign_author.php --msgs=101,105-110 --to=Chipper (dry run)
php reassign_author.php --msgs=101,105-110 --to=Chipper --apply (updates
php reassign_author.php --undo=BATCHID --apply (restores)
It prints its version as it starts. The syntax check passed and --help runs, but I have no database here, so the write path has not been run against SMF. Do the dry run first.
Additions you didn't ask for:
- Dry run is the default. Nothing is written without
--apply. - Backup and undo. Original values go into a
reassign_author_backup table, so a batch can be undone. - Cross-check. A read-only check at the end prints
VERIFY: PASS or FAIL. - Manual.
reassign_author.md, per your standing rule.
One assumption to check: to decide which posts adjust a member's post count, I used SMF's board flag count_posts = 0 to mean "counts posts" (SMF stores it inverted). The dry run prints the post-count changes it would make, so a wrong guess would show up before anything is written.
The script is written for PHP 5.3, in case Live is on CentOS 6 defaults.
| Rule | Status |
|---|
| @version / @date in doc block | done (1.0.0, 2026-10-31) |
| Manual version history entry | done |
| Version shown at run start | done |
| Zip with dotted version | done (reassign_author_v1.0.0.zip) |
xmllint on XML | not needed (no XML) |
| Unrequested changes listed beforehand | done (above) |
| Legacy zipper | not needed (standalone script, not an SMF package) |
Me: WTF is the BATCHID ?
Claude: [November 01, 2026, 12:13:10 AM]
The batch ID is just the date and time the --apply run started, as 14 digits (YYYYMMDDHHMMSS), for example 20261101001310. The script makes it up itself, and you never choose it.
It prints it when an apply finishes, in the line Done: N post(s) reassigned. Batch id: .... The last line of that run is the full undo command with the ID already filled in, so you can copy that line.
If you've lost it, run this against the database and it lists every batch with its post count:
SELECT batch_id, COUNT(*) FROM smf_reassign_author_backup GROUP BY batch_id;
Dry runs don't create a batch, so they never print one.