- Posts: 29
- Thank you received: 4
Select existing Team Name and assign Team Number
- Cory S
- Topic Author
- Offline
- Junior Member
-
Less
More
22 hours 55 minutes ago - 14 hours 25 minutes ago #175902
by Cory S
Select existing Team Name and assign Team Number was created by Cory S
This plugin, TeamNumberAssignment, and new field type allows event registrants to either join an existing team or create a new team, and auto-assign a team #. Team members who register with the same team name are automatically assigned the same team number. This is event-specific. It should work for fields on both Billing and Registration Group records.
It's comprised of a plugin that you install normally, which takes care of the Team# assignment. It also adds a new SQLCustom field type, which uses SQL to lookup existing values in the database for Team Name. This field is an improvement over the existing SQL custom field because it allows you to add a new value, instead of only selecting from existing values.
Normal disclaimer, use at your own risk, not responsible for any damage caused by using this plugin.
=================
OverviewThis plugin and new field type allows event registrants to either join an existing team or create a new team, and auto-assign a team #. Team members who register with the same team name are automatically assigned the same team number. This is event-specific.
Tested Against: Events Booking 5.3.1, Joomla 5.4.0
Components
1. Custom Field Type: SQLCustom
File:
Location:
Type: Events Booking field type extension (NOT a plugin)PurposeProvides a dual-input field that:
- Shows a dropdown of existing values for a field (e.g. Team Names) from the SQL query so registrants can choose an existing value
- Provides a text input for entering a new value
- Automatically hides the text input when an existing value is selectedFeatures
AUTOMATIC INSTALLATION - The SQLCustom field type is automatically installed when you install the Team Number Assignment plugin.The plugin's installation script will automatically copy
to:
If the automatic installation fails, you can manually upload
to the location above and clear Joomla cache.
⚠️ IMPORTANT - UpdatesThis file will be DELETED when Events Booking is updated!
When creating/editing a custom field:- Field Type: Choose SQLCustom
- Default Values: Enter a SQL query to get the existing values from the database for this field. (sample sql provided below)
2. Plugin: Team Number Assignment
Plugin Name: Events Booking - Team Number Assignment
Folder:
Location:
Type: Joomla Plugin (eventbooking group)
PurposeAutomatically assigns team numbers to registrants based on their team name:
- Same team name → Same team number
- New team name → Next available team number (no upper limit)
- Works for both individual and group registrations
- Configurable field IDs for flexibility Files
Installation
After Events Booking Updates: Simply reinstall or update this plugin to restore the SQLCustom field type.
Setting up Custom Fields
Field 1: Team Name
It's comprised of a plugin that you install normally, which takes care of the Team# assignment. It also adds a new SQLCustom field type, which uses SQL to lookup existing values in the database for Team Name. This field is an improvement over the existing SQL custom field because it allows you to add a new value, instead of only selecting from existing values.
Normal disclaimer, use at your own risk, not responsible for any damage caused by using this plugin.
=================
OverviewThis plugin and new field type allows event registrants to either join an existing team or create a new team, and auto-assign a team #. Team members who register with the same team name are automatically assigned the same team number. This is event-specific.
Tested Against: Events Booking 5.3.1, Joomla 5.4.0
Components
1. Custom Field Type: SQLCustom
File:
Code:
sqlcustom.php
Code:
/administrator/components/com_eventsbooking/libraries/rad/form/field/sqlcustom.php
- Shows a dropdown of existing values for a field (e.g. Team Names) from the SQL query so registrants can choose an existing value
- Provides a text input for entering a new value
- Automatically hides the text input when an existing value is selectedFeatures
- Executes SQL queries to populate dropdown options
- Supports placeholders like
in SQL queriesCode:[EVENT_ID]
- Syncs dropdown and text input with JavaScript
- Inherits validation and styling from parent RADFormFieldSQL class
AUTOMATIC INSTALLATION - The SQLCustom field type is automatically installed when you install the Team Number Assignment plugin.The plugin's installation script will automatically copy
Code:
sqlcustom.php
Code:
/administrator/components/com_eventsbooking/libraries/rad/form/field/
If the automatic installation fails, you can manually upload
Code:
sqlcustom.php
⚠️ IMPORTANT - UpdatesThis file will be DELETED when Events Booking is updated!
When creating/editing a custom field:- Field Type: Choose SQLCustom
- Default Values: Enter a SQL query to get the existing values from the database for this field. (sample sql provided below)
2. Plugin: Team Number Assignment
Plugin Name: Events Booking - Team Number Assignment
Folder:
Code:
teamnumberassignment
Code:
/plugins/eventbooking/teamnumberassignment/
PurposeAutomatically assigns team numbers to registrants based on their team name:
- Same team name → Same team number
- New team name → Next available team number (no upper limit)
- Works for both individual and group registrations
- Configurable field IDs for flexibility Files
Code:
/plugins/eventbooking/teamnumberassignment/
├── teamnumberassignment.php (Main plugin code)
├── teamnumberassignment.xml (Plugin manifest)
├── script.php (Installation script)
└── sqlcustom.php (SQLCustom field type - auto-installed)
- Go to: Extensions > Manage > Install
- Upload the ZIP file
- The installation script will automatically copy sqlcustom.php to Events Booking folder
- Go to: Extensions > Plugins
- Find "Events Booking - Team Number Assignment"
- Click to open the plugin
- REQUIRED: Configure the plugin settings:
- Team Name Field ID: Enter the field ID for your Team Name field (e.g., 22)
- Team Number Field ID: Enter the field ID for your Team Number field (e.g., 36)
- Enable the plugin
- Save & Close
- Hooks into
eventCode:onAfterStoreRegistrant
- Checks that field IDs are configured (shows error if not)
- Retrieves the Team Name from the configured Team Name field
- Checks if team name already exists for this event
- If exists: Assigns the same team number
- If new: Finds the highest existing team number and assigns next number (max + 1)
- Saves team number to the configured Team Number field
- For group registrations: Processes each group member individually
- Assigns team numbers based on each member's team name
- Handles cases where group members have different team names
- Also processes billing record if it has a team name
After Events Booking Updates: Simply reinstall or update this plugin to restore the SQLCustom field type.
Setting up Custom Fields
Field 1: Team Name
- Field ID: (set by the system, e.g. 22)
- Field Type: SQLCustom
- Title: Team Name
- Name: team_name
- Required: Yes (recommended)
- Show on Registration Form: Yes
- Default Values (SQL):
Note: ChangeCode:sql SELECT DISTINCT fv.field_value AS value, fv.field_value AS text FROM jml_eb_registrants r INNER JOIN jml_eb_field_values fv ON r.id = fv.registrant_id WHERE r.event_id = [EVENT_ID] AND fv.field_id = 22 AND fv.field_value IS NOT NULL AND fv.field_value != '' ORDER BY fv.field_valuein the SQL to match your actual Team Name field ID.Code:fv.field_id = 22
- Field ID: (set by the system, e.g. 36)
- Field Type: Text or Integer
- Title: Team Number
- Name: team_number
- Required: No
- Show on Registration Form: No (Hidden)
- Default Values: (leave empty)
- User clicks "Register" for an event
- Sees "Team Name" field with:
- Dropdown showing existing teams: "-- Select from existing or enter new below --"
- Text input field below it
- User can either:
- Option A: Select existing team from dropdown (text input hides)
- Option B: Type new team name in text input
- User completes registration
- Team Number is automatically assigned (user never sees it)
- User registers group with Team Name "Krank"
- Plugin assigns Team# 3 to:
- Member 1 (if they have Team Name filled in)
- Member 2 (if they have Team Name filled in)
- Billing record (if it has Team Name filled in)
- All records with the same team name get the same Team#
- New user registers individually
- Selects "Krank" from dropdown
- Plugin sees this team already exists
- Assigns same Team# 3 to new member
Last edit: 14 hours 25 minutes ago by Cory S.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Away
- Administrator
-
22 hours 14 minutes ago #175903
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Select existing Team Name and assign Team Number
Thanks Cory for sharing your work back to community
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.