Skip to main content

Timeline for Creating a custom Admin panel

Current License: CC BY-SA 2.5

22 events
when toggle format what by license comment
Oct 26, 2011 at 21:53 vote accept Omar Abid
Dec 29, 2010 at 18:36 comment added MikeSchinkel @Omad Abid - Not really. There are functions you can use but you'll still write lots of code. Can you update your question and actually describe your use case? It's very hard to visual how to help you when we are discussing things in the abstract.
Dec 29, 2010 at 10:14 comment added Omar Abid @Mike. What I meant is: I have a SQL Table in the Wordpress DataBase, I want to display the data to the user in a HTML table (just like Wordpress does with posts, comments, users). Can this be done automatically by Wordpress by some API inside it? (instead of me having to design the whole thing myself and also do the queries).
Dec 28, 2010 at 16:52 comment added MikeSchinkel @t31os - Fair points all.
Dec 28, 2010 at 16:36 comment added t31os @Mike - Yes i saw Otto's response, he pretty much nailed all of my concerns, and that's all they are really.. concerns. I'd not be so worried i guess if there were some clear examples available for us(users)/anyone to refer to, i'm just worried you've diving into in a relatively unexplored realm.
Dec 28, 2010 at 16:16 comment added MikeSchinkel @t31os - Lastly, if you add custom tables they are yours and yours alone. If they are for your site then okay. But if they are for a plugin or theme then you have added tables to my database that only your plugin or theme supports and I really don't want those kind of tables in my database. If I add a plugin and it installs it's own tables I think very long and hard about if I really want to depend on it because having tons of tables just create too much clutter to manage IMO. I'm far prefer to have a few very well know tables than a ton of obscure tables. But then that could just be me.
Dec 28, 2010 at 16:13 comment added MikeSchinkel @t31os - You said "is it easier to update/deletes/inserts on one custom table" and you have a point there, but only some. Usually you don't have to update all three, just one, i.e. the wp_term_relationships table. With taxonomy you get admin functionality for maintaining terms for free and for your own tables you have to write the admin yourself. I'd much rather write 3 SQL INSERT statements then build an admin add/edit/delete module. But I do agree that in selected use-cases it's better to have custom tables. But I think there are fewer cases justified than custom tables I've seen.
Dec 28, 2010 at 16:08 comment added MikeSchinkel @t31os - Points taken but I don't think I previously misunderstood; at least I didn't see your points differently with your clarification other than your elaboration. Point taken about making sure queries are right, but is it really that hard? You only need to make sure INSERT/UPDATE/DELETE are correct, but those are less common. Incorrect SELECTs can always be fixed. There are examples in core for how to do it right, and once you've added taxonomy to users, for example, it's done for all future use. RE:Email to list, did you see Otto's response?
Dec 28, 2010 at 15:46 comment added t31os .. further, if you're performing queries to the taxonomy tables, you best make damn sure the queries are right, else you'll run the risk of messing up your WP terms and taxonomies. The risk factor is higher when you're writing to and updating existing tables with custom writen queries, which is a problem that would to be totally illeviated if your custom data was in the form of a custom post type(because you'd then be able to leverage the existing taxonomy/term functions).
Dec 28, 2010 at 15:40 comment added t31os @Mike - RE: Email to list: I think you misunderstood what i was trying to get at so i'll try to clarify.... Even if you use the taxonomy tables in WP, i don't think you'll be able to leverage alot of the taxonomy functionality from WordPress(ie. term update/fetching functions) because they're written with expectations on the data coming in or being fetched(ie. posts). If you're going to be writing your own SQL queries via WPDB then at that point you have to ask yourself what's easier, update/deletes/inserts on 1 custom table or update/delete/insert joins across the 3 taxonomy tables?
Dec 28, 2010 at 14:49 comment added MikeSchinkel @t31os: Fair point about the functions, but I personally think new tables should be avoided unless absolutely necessary. I also think the taxonomy system provides the raw materials to store that data so why not reuse it rather than build yet more tables? I've found many cases where WordPress simply doesn't (yet) have the API to support existing MySQL structures, not just with taxonomy. But I do agree that it's always a question of "is it appropriate" for this or any other architecture question. BTW I started a thread on wp-hackers to get their feedback on this question; maybe I'm offbase?
Dec 28, 2010 at 7:19 comment added t31os @Mike - Certainly does.. :) However i'm still not convinced it would work well, i simply can't see how you could leverage enough of the existing API to make it worth it. The term functions aren't necessarily going to work for something of a non-post type nature, and if you're going to be writing your own functions for insertion/updates/deletions you might aswell at that point be using your own table(or none). I think the bigger question here though is, what is the data? Would it really be appropriate/worth the usage of taxonomies in this instance..
Dec 27, 2010 at 17:45 comment added MikeSchinkel @t31os - That's what I assumed initially. Then it hit me: taxonomy is what defines the source of the data. For example, if you have a taxonomy 'employee-role' then your usages for object_id would be limited to user_id, if you have a taxonomy 'comment-type' then object_id would relate to comment_ID, and so on. So term relationships don't exist independently, they must mate with a taxonomy to have meaning. Of course your code would need to guarantee those business rules, but the structure does work conceptually. Does that clear it up?
Dec 27, 2010 at 17:38 comment added MikeSchinkel @Omar Adid - Your questions are unclear. When you ask about a table, do you mean SQL table or HTML table? And where do you want to produce it, in your database or in your browser when you are in the admin console?
Dec 27, 2010 at 15:56 comment added t31os @Mike - What happens when a post holds the same object ID as a record in the custom table(since they're seperate tables assigning they're own IDs), surely that's going to cause some confusion with the internal taxonomies, no?
Dec 27, 2010 at 15:17 comment added Omar Abid @Mike, I think we are getting close. I just wanted to know if I give Wordpress the structure of my data (through taxonomy or anything else) can it produce the table automagically?
Dec 27, 2010 at 14:21 comment added MikeSchinkel @t31os - You know taxonomy can be used for anything including non-posts. That's why wp_term_relationships has an object_id field instead of a post_id field. Think users, comments, meta, even taxonomy terms themselves. So yes I think someone could use a taxonomy for their own custom tables. OTOH, I'm suspicious whenever someone creates a new table. From what I've seen 9 times out of 10 time they could have used a built-in table with less hassle.
Dec 27, 2010 at 14:18 comment added MikeSchinkel @Omar Abid - Can you explain your use-case. It's very hard for us to help you in abstract. Also, I think the title of your question does not accurately reflect your actual question. Can you consider re-titling your question?
Dec 27, 2010 at 12:34 comment added t31os .. if you're displaying custom data it makes sense you'd need to handle the result filtering yourself using functions that imitate the WP filters.
Dec 27, 2010 at 12:27 comment added t31os If the data has nothing to do with posts then why would you want to use taxonomies? Taxonomies are used to create relationships between posts(or custom types), ie. groupings of posts that fall under specific terms. Personally i don't think WP Taxonomies will be much use to you here.
Dec 27, 2010 at 8:51 answer added tkit timeline score: 5
Dec 27, 2010 at 8:38 history asked Omar Abid CC BY-SA 2.5