Okay
  Public Ticket #2300653
ID in shortcode on different servers
Closed

Comments

  • Mark Williams started the conversation

    I am developing my plugin on my local machine and then deploying through Github when tested/done.

    The table ID on my dev server is different to that, for the same table, on my production server.  This means my shortcode, for example, [wpdatatable id=6] breaks when it is deployed, since the table ID on the production server is 1.

    How can I resolve this?

    Thank you.

  •  2,498
    Aleksandar replied

    Hello Mark

    I suppose you're referring to the table ID on front-end, like table_1, correct?

    If that is true, the plugin is adding the table IDs on front end with odd numbers assigned to them. So, if you have 3 tables on the front, they will be:

    table_1

    table_3

    table_5

    and so on. Perhaps this is what you should be looking for.

    Please note that something like this is considered a custom request, and is not included in the provided support for the plugin.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Mark Williams replied

    Thank you, Aleksandar. I don't think I explained the situation very well since I believe you may be referring to something else.

    In my code I have a shortcode like [wpdatatable id=6]. That works fine on my development server, since the table I am using has that code (as copied from the table definition in the admin UX).

    However, when I deploy to my production server, the same shortcode is used (the source code is unchanged) but is broken, since the table I have created there has a different ID on the production server.

    In short, it doesn't seem there's a way I can deploy to production without breaking my code.

    Is there no way to refer to the NAME of the table in the shortcode, rather than the ID?

    I don't know how to resolve this at this point and it seems to be a blocker for using the shortcode with any form of dev workflow. I hope there is a workaround or solution to this.

    Thank you.

  • Mark Williams replied

    A quick follow up to this.

    I created a post in the Advanced WordPress facebook group, so see how others have worked around this. Two folks separately suggest I write code to drill into the relevant (WordPress) tables to lookup the ID. But that seems very cumbersome and I sense some frustration that this is necessary.

    My hope is that could consider the following (in addition to the existing ID property).

    [wpDataTable name="Orders"]

    This would allow the same shortcode to work on two different servers, rather than hard code an ID that is unique to each server.

    We (the users of your plugin) have complete control over the name, but we have no control over the ID. So this would be a very simple way to resolve this issue. I would, of course, understand that the names of the tables I create would have to be unique, but that's very easy to do.

    I welcome your thoughts.

  •  2,498
    Aleksandar replied

    Hello Mark.

    At the moment we don't have this planned, because using the ID is something our plugin generates, while the name would be something your users would use/enter, which means we would have to cover variants like - what if a user names several tables the same? It would create issues for the users.

    Maybe it'd be best to do as the Facebook group suggested.

    Thank you for your suggestion, though. Can I ask you to enter it in our Suggest a Feature section?

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Mark Williams replied

    Thank you for the response. Yes I understand there is a small issue with the possibility of duplicate names but that seems a minor issue to me (easily documented) and one that should't create too much of a problem. 

    It's unfortunate that there is no way to use this shortcode in a way that is server-independent and that the ID approach references a field over which we (as users of the plugin) have no control.

    Thank you again.

  • Mark Williams replied

    By the way, do you have documentation on where table definitions are stored in the WordPress database? In my case I just need to search for a table with the name "Orders", for example, and I can make my code server-independent.

  • Mark Williams replied

    One more option...

    There could perhaps be some optional field for each table ("Ref"?) for which a check is made for uniqueness on each save. If the user (me) chooses to use that then it is a valid property to be used in a shortcode, as in...

    [wpDataTable ref="orders"]

    The admin UX would enforce this field being unique across all tables created, so a duplicate cannot be created. That would resolve this issue, without the need to go through hoops, etc.

    Just a thought.

  •  2,498
    Aleksandar replied

    Hello Mark.

    All data related to the table is saved in database table "wpdatatables", and all data related to the columns is located in the database table "wpdatatables_columns".

    Thank you for your suggestion. May I ask you to add it on our Suggest a Feature page? Those suggestions all go to our development team. Depending on the number of times a feature has been suggested, we create priorities. More users request this option, more likely it is to be implemented, so we will look into some possible solutions on plugin side in the future.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables