1. REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Add showcase item thumbnails in Message User Block

Discussion in 'Showcase Support' started by Ludachris, Feb 11, 2014.

  1. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    For almost a decade now in vB, I've been displaying custom profile field data - vehicle profile data that will soon be replaced with showcase field data. Now that my users will be able to create multiple showcase items (vehicle profiles), I'd like to make it so those showcase items are on display next to all of their posts - I'm thinking the small thumbnail sized version of the cover photo just below the user title.

    A nice hover over popup with the larger cover photo thumbnail and some admin-specified showcase item profile data would be really cool (think member card), but even just making the thumbnails link to the showcase would be really cool to start with.
     
    tgrt likes this.
  2. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Let me add on to this request - the ability to have Item thumbnails also display on the Member Card would be great as well. It's something I'm going to have to get done somehow. If it doesn't get considered maybe I can work out some private development time with you Bob?
     
  3. Bob

    Bob Developer Staff Member

    This is something that I'll have to look into during R&D time. In the mean time, feel free to add things to this. I'll let you know when I start any R&D on it as I'll probably have a ton of questions.
     
  4. DeviateDefiant

    DeviateDefiant Member SC Premium

    Just wanted to respond and say I too am interested in this feature. We also use the showcase add-on as Garage software. What I'd find useful is being able to pull custom fields too, and be able to display the item above the signature block or by the member card. Example:

    Code:
    ----- Defiant's Daily Driver
    -PIC- '03 Accord 2.4 Type-S
    ----- ***** 983 Views
    
    Code:
    ----- [Title]
    -PIC- [Custom Fields - Regex'ed Year / Model / Litre / Trim]
    ----- [Rating] [Views]
    
    Also perhaps the ability to customise what information is displayed, thumbnail/ratings/views/tagline are boolean options.

    I understand this is quite complex, but I'd like to hear your thoughts @Bob B :)
     
  5. DeviateDefiant

    DeviateDefiant Member SC Premium

    Will this be easier to achieve with v2 @Bob B? I've been planning out on our site how we want to implement it, almost entirely from custom fields coupled with the new prefix system and the standard ratings/cover:

    hk_garage-signature_mockup.png

    I understand fields will now be exposed to some degree outside of the Showcase pages? Basically I just need understanding of how to loop through the showcase items created by user ID and return the field values.
     
  6. Bob

    Bob Developer Staff Member

    It will still be quite complex as the data (showcase item data) is not stored in a USER record, so data will have to be queried to be used where you want it. That can be pretty costly (as far as performance goes). Also, its not a 1 to 1 system.. ie, users can have more than ONE item, so there would have to be some sort of logic built in to handle users with multiple items.

    This is something that will require extensive programming (specially if you want to make it semi efficient). Only way I can see it being even remotely efficient is writing a system that will convert a specific showcase item for a specific user into a pre prepared serialized blob stored in the user table, then that data can be extracted, unserialized and used basically everywhere (you'd have to unserialize it via php to use it tho)... Just THINKING outloud here..
     
  7. DeviateDefiant

    DeviateDefiant Member SC Premium

    I had been thinking along the lines of the data not being prepared for the Frontend, and not having to call/interpret the data live. I'm not a Backend guy so forgive my ignorance.

    It's not the most elegant solution but my thought was that a function to prepare and store the data (any string operations needed then literally stored as an array of variables), dumped into the DB, then that function gets called to reparse on posting/editing a showcase item. Perhaps with a maintenance option to call the function for all users/items ("rebuild", doesn't have to be plugged into XF admin, I'm talking basics to get by).

    I'd want to literally to list/loop each item owned by a user to pull into the thread_view, being a car forum most members have 1-2 vehicles so I have no immediate concerns. Frontend handling is no issue.

    So I guess what I'm talking about is:
    1. For each "Showcase ID" by "User ID".
    2. "Custom Fields" + "Thumbnail URL" to an array.
    3. Store in "xf_users" column with multiple "Showcase ID" data just appended one after the other.
    4. Frontend loop while there's still more "Showcase IDs" by "User ID" in the column.
    5. Return prepared template filled with data for each.
    6. Frontend stuff to polish.
    7. Gets called each item update, or manually for all if needed.
    But, I'm not a Backend guy. I just have a rudimentary understanding enough to work within a PHP/SQL environment.

    Concerns are only really page load from having to interpret data on call, storing the data again in the users table really doesn't matter to me. Seems the best way to handle it.
     
    Last edited: Apr 10, 2014
  8. DeviateDefiant

    DeviateDefiant Member SC Premium

    Worth noting that I don't understand the BLOB/serialized concept though I think we're kind of along the same lines of how to do it?
     
  9. Bob

    Bob Developer Staff Member

    Preparing data can and does COST queries, so yes, its VITAL to pre prepare it or you just are adding MORE queries to what you want to do. When I say preparing, I am talking about programming code that checks for permissions, adds attachments, adds custom fields etc. Its the same preparing that goes on within showcase itself for items.

    A BLOB is just a field type in a table which allows you to store a LARGE amount of data binary data (serialized). Serializing an array allows you to store it in a BLOB. It needs to be unserialized before it can be used again. By storing that data in the USER table, its available where ever user information is exposed (for example, postbit). If you followed what I posted above, you'd simply need to extend the post model (preparePost method) (something like this... ). This would cost ZERO queries as the Showcase Data would be cached for each users in the user table.

    PHP:
    <?php

    class MyAddon_Model_Post extends XFCP_MyAddon_Model_Post
    {
        public function 
    preparePost(array $post, array $thread, array $forum, array $nodePermissions null, array $viewingUser null)
        {
            
    $preparedPost parent::preparePost($post$thread$forum$nodePermissions$viewingUser);
           
            if (!empty(
    $preparedPost['myaddon_showcase_data']))
            {   
                
    $data unserialize($preparedPost['myaddon_showcase_data']);
                
    $preparedPost['showcase_data'] = $data;
            }
            else
            {
                
    $preparedPost['showcase_data'] = false;
            }
           
            return 
    $preparedPost;
        }
       
    }
     
  10. DeviateDefiant

    DeviateDefiant Member SC Premium

    Bob, would this be something you'd be willing to work with me on? While I understand the underlying principles and you've given me some valuable insight into it, I'm still not at a level where I can tackle this myself.
     
  11. Bob

    Bob Developer Staff Member

    I am always willing to help out when I can. Time to dedicate to it could be an issue tho as my job is pretty demanding on time, so it doesn't leave me with a whole heck of a lot of time to do everything else (Addon support, social life etc).
     
  12. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    I was actually picturing something like this displayed under the signature instead of in the membercard or in the postbit area. If you guys come up with something let me know. I'd be willing to share in some development costs. This is going to be a major piece of the puzzle for me in making the showcase a key component in my forum.
     
  13. DeviateDefiant

    DeviateDefiant Member SC Premium

    I feel the same way with it being an integral part of our plans for the forum too. Maybe @MattW is interested in getting in on this as well.
     
  14. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Let me say something about why I feel this is such an important piece of the puzzle... as I said in the original post here, for several years I've been using the vB profile system as the main solution for vehicle profile data, with lots of fields for members to fill in about their cars. They're used heavily on our site because our members post tech questions about their car, and other members check their vehicle profile data before they answer those questions. This gets the members to encourage each other to fill in their profiles with all of their vehicle details so people can give accurate advice, which means the system gets used a lot more. I think something like 90% of our members had vehicle data in their profiles when I checked recently.

    The year/make/model is displayed in the postbit area and is linked to the detailed profile, one click away when reading a thread. I think that's what has helped make it a key component of the site and has really set our site apart from other car sites. Without having the users' showcase items displayed next to each post (whether it be in the postbit area or the signature) with a link to see the item detail I feel like there would be a disconnect that wasn't there before.

    I would like to keep our vehicle profiles one click away when reading threads to ensure the new showcase profiles are not only 'cool' but remain as useful, if not more useful than what we had set up before. In my opinion, this is one way to tightly integrate the showcases with the forums - something a number of admins struggle with. For our site, we need at least a thumbnail and 2-3 fields (year/make/model) to be displayed. Rating and comment count would be nice too, but those aren't critical.
     
  15. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    I'm going to take a shot at using the code you posted above Bob and getting the showcase data to show either in postbit or under signatures. Where I'm getting stuck is learning where to implement the code. Tinkering with Ruby on Rails I learned a little bit about MVC structure and which files I needed to work on and where they were, but I'm still learning how the file structure is set up in XF and where everything goes. There are a LOT of directories and files. I'm ready to try and break things though. :)
     
  16. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Hey Bob, using this example as a starting point, would I just add the code above to a file and upload it to the Library dir (maybe here: /library/NFLJ/Showcase/Model/ or here: /libarary/Xenforo/Model/)? Then that will allow me to start displaying showcase fields in templates outside of showcase?
     
  17. Bob

    Bob Developer Staff Member

    NO. There is MUCH more to it. That is just a little snippet example of one part (out of dozens of things) that needs to be done.

    btw, that code above would reside in its own file /library/MyAddon/Model/Post.php (The Class name tells you the location and name of the file)

    Things you will need to do is put your site into Debug Mode, Create an Addon (MyAddon), create a listener proxy file with a loadPostModel method, then create a code event listener (specifically for load_class_model) that executes the callback you created in the listener proxy, then you create the above (you can not just use the fictitious code I posted, you actually have to use specific code for what you are doing), and even before all of this, you need to do several things like extending the custom fields save method in the Item Data writer that will store the information in the User Table (which brings up a point that you also need to write code for that part as well) etc etc.. I won't waste time going on because doing this is fairly complex and isn't a "first time project" for someone just learning. Its not something that I can "teach" in a couple paragraphs (nor am I a good teacher lol), its also not something I can just post you a "How To" on as its a larger project than a couple of my other Addons themselves.
     
    Last edited: May 23, 2014
  18. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Whoa... bummer. My old site had customer user profile field data displayed in postbit (year make model of their car). It greatly helped members who were answering tech questions quickly identify the type of car they were answering questions for. I've been able to add a link to the member's items and an item count to postbit, but losing the ability to post the year/make/model of the user's car is going to hurt the site. Oh well. I knew it wasn't going to be something I could add in right away, but I was hoping the members wouldn't be asking about it so much. Hopefully they get used to a few extra clicks to see that data.
     
  19. tgrt

    tgrt New Member Showcase

    We just purchased and installed, and this is something that has already been asked for.
     
  20. Ludachris

    Ludachris Active Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Please Like the original post in this thread so Bob can get a better sense of how many people need this.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.