When to Use the CodeSort Bridge
The CodeSort Bridge is for fanlisting owners who have already imported their CodeSort data into Luster but have not yet updated their fanlisting page code. It lets your old CodeSort show-codes.php and show-donate.php includes keep working by routing them through Luster instead.
Use the bridge when:
- You have imported your CodeSort data into Luster and want your existing code pages to keep working immediately.
- You plan to migrate your pages to Luster’s embed system gradually, one fanlisting at a time, rather than all at once.
- You want a zero-downtime transition — visitors see working code displays and donation forms the entire time.
It is meant to keep things running while you update your pages to use Luster’s native embed/ files. Once all your pages use embeds directly, you can remove the bridge files.
Setup
The CodeSort Bridge relies on the ID mapping table (lstr_listing_external_refs) that is created during the import process. If you have not imported your CodeSort data into Luster yet, the bridge will not be able to resolve your listings. Run the CodeSort import before setting up the bridge.
-
Download the Bridge
In the Luster admin panel, go to Admin → Collective → Migration & Bridges and click CodeSort Bridge. This downloads a ZIP file.
-
Unzip into Your CodeSort Folder
The ZIP contains three files:
luster-bridge.php,show-codes.php, andshow-donate.php. Extract them into your CodeSort installation folder, replacing the original files. -
Set the Luster Path
Open
luster-bridge.phpand set theLUSTER_PATHconstant to the absolute server path of your Luster installation. The download pre-fills this for you, but verify it is correct.PHPdefine('LUSTER_PATH', '/home/username/public_html/luster'); -
Done
Your existing fanlisting pages will now render code displays and donation forms through Luster instead of CodeSort. No other changes are needed.
How It Works
When a visitor loads one of your fanlisting pages, the following happens:
-
Your page sets $listing
Your existing fanlisting page sets a
$listingvariable, which is the numeric listing ID used by CodeSort. -
The page includes a show-*.php file
Your page includes
show-codes.phporshow-donate.php. Because you replaced the originals with bridge wrappers, it now loads the Luster bridge version instead of the old CodeSort code. -
The bridge resolves the listing
The bridge reads
$listingand looks it up in thelstr_listing_external_refstable (with sourcecodesort) to find the corresponding Luster listing ID. This mapping table is created automatically during the CodeSort import. -
Luster renders the output
The bridge passes the resolved listing ID to the corresponding Luster embed file, which renders the codes display or donation form and outputs the HTML.
Supported Wrappers
The bridge includes replacement wrappers for both CodeSort include files.
| CodeSort File | Luster Embed | What It Renders |
|---|---|---|
show-codes.php | embed/codes.php | Fan codes display (code images grouped by size/category) |
show-donate.php | embed/codes-submit.php | Code donation/submission form |
Manual Override
If the bridge cannot auto-detect your listing from the $listing variable, or if you want to skip the ID mapping lookup entirely, you can set the Luster listing ID manually before the include.
$luster_listing_id = 5;
include '/path/to/codesort/show-codes.php';
When $luster_listing_id (or $luster_fanlisting_id) is set before the include, the bridge uses it directly and skips the $listing lookup.
Styling
The bridge renders code displays using Luster’s HTML output, which means the output uses Luster’s CSS classes (fl-codes, fl-code-list, fl-code-item, etc.) instead of CodeSort’s old classes.
To style the output, you have two options:
- Add Luster’s public stylesheet to your fanlisting pages. The stylesheet is at
public/assets/css/default/style.cssin your Luster installation. This gives you sensible defaults immediately. - Write your own CSS targeting the
fl-*classes. See the CSS Class Migration Reference for more information about Luster’s public CSS classes.
If you had custom styles targeting CodeSort class names like .codesBlock, those styles will have no effect on the bridge output. You need to update them to target the equivalent fl-* classes.
Troubleshooting
“Listing not found” message appears
This means the bridge could not match the $listing variable to a Luster listing. The most common cause is that the CodeSort data has not been imported into Luster yet. The bridge relies on the lstr_listing_external_refs table, which is populated during the import. Run the CodeSort import first.
Blank output (nothing renders)
Check that the LUSTER_PATH constant in luster-bridge.php points to the correct absolute server path of your Luster installation. The path should point to the Luster root directory (the folder containing bootstrap.php), not the public/ subdirectory.
PHP errors or white screen
Make sure your server meets Luster’s requirements (PHP 8.1+). Also verify that the Luster installation itself is working by visiting the admin panel directly.
Codes display is empty
Check that the listing has codes assigned to it in Luster. Go to the Luster admin panel, open the listing, and check the Codes tab. If codes were not imported, re-run the CodeSort import.
Donation form submits but nothing happens
The bridge forms submit to Luster’s public endpoint. Make sure Luster’s app_url and embed_base_url config values are set correctly, and that the Luster public/ directory is accessible from the web.
Styles look wrong
The bridge outputs Luster HTML, not CodeSort HTML. Your old CodeSort CSS classes will not apply. Add Luster’s public stylesheet to your pages, or update your CSS to target fl-* classes. See the CSS Class Migration Reference.