WordPress.org

Ready to get started?Download WordPress

Forums

Team Rosters
[resolved] Almost There With Adding New Fields (9 posts)

  1. FuryFC
    Member
    Posted 10 months ago #

    This is a great plug-in, and I've been looking for something that will do this for years.

    My website is a soccer team site, and I want an extremely customized player page, in that I want to have a statistics table included that has regular season, cup competition, tournament, and total season statistic lines, plus the year that the player joined the club, and some other things. That's too may columns to use your existing structure, so I set about trying to make a new field. If it works, I figured I could make several new fields with the same methodology, so I can make my page.

    To try what I'm wanting to do, I've re-coded the content-single-player.php and mtsw_team-rosters.php, so I have my new column name in the code. To do that, I edited "position" so that it's now called "dposition" throughout the code in both .php files and in my excel file).

    When I import the csv, all of the standard fields import as expected, e.g.:

    retval = 1 ID: 1258 K: _mstw_tr_number V: 0

    retval = 1 ID: 1258 K: _mstw_tr_last_name V: Lastname

    retval = 1 ID: 1258 K: _mstw_tr_first_name V: Stephen

    retval = 1 ID: 1258 K: _mstw_tr_position V: GK

    BUT the "dposition" import (i.e., my customized column), imports as:

    retval = 20517 ID: 1258 K: dposition V: 0

    The 20517 ID is a uniqure number, and when I import again, I get a higher ID (e.g., 20518 ID). Also, the _mstw_tr_ is missing from in front of dposition.

    Any pointers on where I need to focus to make the non-standard category come in with the same type of format as the standard ones? Even if it takes some more coding, telling me where to focus would help a ton. I am self-taught, and struggling with this. I think I'll eventually figure it out, but I'm losing sleep on this one!

    My website, which is under construction, is http://www.furyfc.com/blog/, but I don't know that that helps you to see anything.

    If I get this to work, I have the template nicely skinned and would love to show off my work. Thanks!!!

    http://wordpress.org/plugins/team-rosters/

  2. Mark O'Donnell
    Member
    Plugin Author

    Posted 10 months ago #

    Hi FuryFC,
    I'd really have to look at your code mods to take a guess. You certainly don't have to preface the new data field _mstw_tr_, but you do have to be consistent with the name. You have a bug with the ID assignment, clearly it should be 1258 for the first import. I believe that's the team ID if memory serves me.

    My question would be "Why are you fighting this?" It seems like you are making so many mods to the plugin that you may as well use TablePress like you have done for your other tables. I mean you didn't use Game Schedules or League Standings, why bother with Team Rosters?

    Regards,
    -Mark

  3. FuryFC
    Member
    Posted 10 months ago #

    What I have so far is at http://furyfc.com/blog/statistics/furyblack-statistics/

    I think I might need to also edit mstw-team-rosters-admin.php so the new fields import correctly. WI will report back after I get this re-coded (and get some sleep).

  4. FuryFC
    Member
    Posted 10 months ago #

    Nope. That wasn't it.

  5. FuryFC
    Member
    Posted 10 months ago #

    Here's how the template will look if I can just get the data to be imported properly (i.e. imported with 1ID and _mstw_tr_ prefix).

    http://furyfc.com/blog/wp-content/uploads/2013/09/template_layout.jpg

    I did this all with a table layout and css. Its a total of something like 32 fields, including fields for the image names.

  6. Mark O'Donnell
    Member
    Plugin Author

    Posted 10 months ago #

    Hi FuryFC,
    Wow, VERY nice! It still looks to me that you are building a very custom page, pulling data from several sources. I'm not sure Team Rosters is the best fit for your needs. Maybe you should look at CSV Importer or another more general purpose application for sucking in the various CSV data sources. I 'dumbed down' what's in Team Rosters to make it easier for my target audience, but you'd probably prefer the more capable general purpose plugins.

    Best,
    -Mark

  7. FuryFC
    Member
    Posted 10 months ago #

    Oh. Okay. I thought your plug-in was close to what I've been wanting to do. All of the data comes from one excel spreadsheet, imported through csv importer. I just take the data that's imported and "echo" it to the cells in my template. I could definitely do this with your plug-in if I only wanted to post regular season stats, and that might be what I decide to do. My main thing is just trying to create additional fields.

    I am just learning php, js and css, but will look at using CSV importer more directly. I thought that adding a few extra fields to your program wouldn't be that tough. Even learning how to add one would do it. The rest of the wow factor of what I've done is simply through setting up a different template and using css to format it.

    I really like the admin controls and the framework of your plug-in. Is there no basic way to add a custom field through some copycat coding from your basic structure? My problem is my lack of knowledge of php, but I am leaning by studying your code. I still just haven't figured out what part of what php file(s) needs to be edited to add new field. That's all I really need.

    I understand if that's beyond what you are willing to do, but this is one last request to give me some guidance as to how and where to add the code to create a new field. It seems like there might be quite a market for your plug-in if it were possible to add a few more custom fields, but I've seen your posts about drawing a line somewhere to make this easier for your audience, and I understand.

    Regardless, great plug-in and I wish you all of the best with it. I looked and looked, but there is really nothing else right on point that's out there. I don't know why it was so hard for me to find on the WP plug-ins site, but I'm glad I found it. I hope you are making some good money from this!! Thanks for your kind words and help. I really admire the way you handle your documentation, coding, and support forum, and I appreciate the time and consideration you've given to my question.

  8. FuryFC
    Member
    Posted 10 months ago #

    oi! I just read your post from yesterday. You know, your plug-in was so close in concept to what I was doing, that I never really thought about using Table Press. I suppose I could just re-skin what's coming from Table Press and have as many fields as I want. That never even occurred to me. LOL!

    That's the problem with me having no knowledge of wp, php, and js until a few weeks ago. I know just enough to be dangerous!

    If you can tell me where to add a new field in your code, that's great and would save me a ton of time . . . since I'm so close already and have spent about 5 days on this. If not, I'll re-focus on using Table Press and re-skinning the data it's pulling in. I suppose I just need to study how Table Press goes about gathering and displaying the data.

    I'm really sorry if I wasted your time, but I just had my epiphany (I think), so thank you for that. Thanks again, too, for giving a newbie the time of day. Studying your code has been my first real lesson on php.

  9. Mark O'Donnell
    Member
    Plugin Author

    Posted 10 months ago #

    Hi FuryFC,
    Trying to learn php, css, WP, js, the whole thing by making pretty tricky modifications to a plugin is a daunting task. You are really doing quite well. You are not just trying to add a field, you are trying to import a new field from a CSV file, no small task.

    Thanks for your comments on my plugins, I appreciate it. Your comments about finding plugins are pretty accurate in my experience. Many plugins are written for specific purposes (like mine). They rarely do EXACTLY what YOU want. Or you might find a general-purpose plugin that requires significant learning and work to get it doing exactly what you want. That may work for me, but it doesn't work for the people who maintain and manage high school sports team site. That's why I started writing my own, and probably why many people do. BTW, it sounds like that could be a good path for you; there are several good books available and tutorials all over the web.

    I have recently created a great deal of flexibility by allowing admins to 're-purpose' fields and columns, but I don't envision building an admin capability to add new data fields ... maybe someday. You are not really using my plugins, other than as a jumping off point to create what you want by cobbling together features from several plugins. If that's what I wanted, I would pull (open source) code out of various plugins into my own new plugin. (See above.)

    Good luck. I'm going to mark this tread resolved, but feel free to write anytime. mark@shoalsummitsolutions.com

    -Mark

Reply

You must log in to post.

About this Plugin

About this Topic