Jump to content
servetas

Pilot's Custom Id Module v1

Recommended Posts

I decided to release a new freeware module which allows you to set a custom pilot id for your phpVMS pilots. Since 2010, I have seen a lot of members requesting to be able to set custom IDs to their pilots. This module allows you to do that but it is not that easy. Before being able to change a pilot's ID and in order to ensure that your pilots will not loose any of their data, you will have to set up the module correctly.

The module has a settings page from which you will have to set your database tables which store a pilot's id. The module already includes the default phpVMS database tables which cannot be edited or delete from the settings page. What you have to do is include any more templates as soon as you have installed any modules into your system.

Screenshot 1 (Admin Center Main)

Screenshot 2 (Admin Center Settings Page)

Screenshot 3 (Admin Center Update Pilot Id 1)

Screenshot 4 (Admin Center Update Pilot Id 2)

You can view and download the module via here.

How to Set Up the Database Tables (Example of Screenshot Center Module)

I am going to introduce an example based on the phpVMS Screenshots Center module developed by simpilot. If you get into your phpVMS database, you will see that the screenshot center module uses 3 database tables. These are screenshots, screenshots_comments and screenshots_rating. Of course, each table has a database prefix. In the screenshot below, you will see that the database prefix is phpvms_.

screenshots_database.png

As you can understand, screenshots table includes the screenshots which have been added by your pilots, screenshots_comment includes the comments which have been added under the screenshots and screenshots_ratings includes the ratings which have been set by your pilots for each screenshot.

In our system, there are two pilots. The first one is DEV0002 Captain Jim and the second one is DEV0015 Captain John.

screenshots_example.png

As you can see in the example, there is a screenshot which has been added by DEV0015 Captain John and there is also a comment under the screenshot which has been added by DEV0002 Captain Jim.

This means that the screenshots database table has an entry with pilot ID = 15 and the screenshots_comments database table has an entry with pilot ID = 2.

Let's say that you have not included the screenshots module database tables in the module settings and you decide to change the DEV0015 Captain John pilot ID from DEV0015 to DEV0016. This in reality means that you change the pilot's ID from 15 to 16.

If the screenshots module's database tables does not get updated accordingly, the module will keep that this screenshot has been added by the pilot with ID 15 which is something false because his/her ID has been changed to 16. In that case, the "Screenshot by:" will be empty because it will not be able to find the pilot with ID 15.

Let's say that after that, you decide to change the DEV0002 Captain Jim ID from 2 to 15. As you can understand that screenshot will be shown that was posted by Captain Jim (because his ID will be 15) and the comment posted by entry will be empty just like it happened before.

So, what is this module doing? As soon as you set up the module settings correctly, it searches over the selected table and changes the pilot ID from the old value to the new one. As we descriped above, the Screenshot Module has three database tables. All of these tables keep data which have to do with your pilots. Let's check the tables one by one.

Let's start with the screnshots database table. As I have written above, this table stores the screenshots which have been uploaded by your pilots. This table has several columns and we should find out in which column does the pilot ID gets stored. Below you can view a screenshot of the table's columns.

screenshots_screenshots_table.png

If you have some basic knowledge, you will understand that the pilot id who posted the screenshot is being stored to the "pilot_id" column. This means that the "screenshots" table keeps the pilot id in the "pilot_id" column.

The same should be done for the rest of the module database tables. Below you can see the screenshots_comments database table.

screenshots_comments_table.png

As you can understand the pilot ID is stored in the "pilot_id" column. This means that the "screenshots_comments" table keeps the pilot id in the "pilot_id" column.

Finally below you can see the screenshots_ratings database table.

screenshots_ratings_table.png

As you can understand the pilot ID is stored in the "pilot_id" column. This means that the "screenshots_ratings" table keeps the pilot id in the "pilot_id" column.

As soon as we have analyzed the module's database tables, we are ready to proceed and update the Custom Id Module Settings accordingly. We will have to add three settings, one for each database table which stores the pilot's id.

settings.png

We will have to submit the form with the following data. 1st Database Name: screenshots Column Name: pilot_id 2nd Database Name: screenshots_comments Column Name: pilot_id 3rd Database Name: screenshots_ratings Column Name:

pilot_id

In our example, all of the database tables store a pilot id. There are modules whose database tables does not all store a pilot's ID. Also, there are table where the column name can be different from pilot_id or pilotid.

Further Help

PHP-Mods can assist you and set up the module for you at an extra cost in case you are not able to do this on your own. You can open a new support ticket under PHP-Mods Billing System via here. We do not offer support for this module via support tickets. If you have problems installing the module, post your question in the forum.

If you have any question, you can post it here. If you are not able to understand which database tables store the pilots ID, you can get in touch with the module's developer and he/she should be able to assist you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×