Jump to content

Awesome Member Hovercards


All Astronauts
 Share

Recommended Posts

What fields would you want? Understand this can get messy really really fast. With customs I can craft things as needed to the site needed. To allow all of this, and I can (with some exceptions) I'd probably have to just "make it available" in the template and then:

1) Site admins would need to edit the template for their theme(s) to display it how they wanted to - that's without help from me - you'd need to know what you are doing - similar to the Pages Categories Images mod I have where the information is available in the templates but you have to choose (and work) how to display them.

2) If I ever structurally change the template for this in a future release, everyone would need to, like updating themes between Invision Community releases, update their custom AMH template.

The profile stuff is wide open - just about any field type is allowed there. It's basically Pages-lite. Right now on the default IC hovercard there is *zero* profile information brought through.

 

Link to comment
Share on other sites

53 minutes ago, All Astronauts said:

What fields would you want? Understand this can get messy really really fast. With customs I can craft things as needed to the site needed. To allow all of this, and I can (with some exceptions) I'd probably have to just "make it available" in the template and then:

1) Site admins would need to edit the template for their theme(s) to display it how they wanted to - that's without help from me - you'd need to know what you are doing - similar to the Pages Categories Images mod I have where the information is available in the templates but you have to choose (and work) how to display them.

2) If I ever structurally change the template for this in a future release, everyone would need to, like updating themes between Invision Community releases, update their custom AMH template.

The profile stuff is wide open - just about any field type is allowed there. It's basically Pages-lite. Right now on the default IC hovercard there is *zero* profile information brought through.

 

Example, mine is a gamong site, we require everyone to either put their Xbox or psn id in their profile (like the location profile field) and those are displayed on the hover card. It is admin selectable which fields are shown on the card

Link to comment
Share on other sites

Gave this some thought overnight.  I can pull those and make them available (within reason) and then have a blank template be toggled on/off for you to use to do what you want with those vars available there.

Will be bumping this to $15 / $6 when I'm done ?

Don't forget! If your users have animated coverphotos... well... ?

animated.gif.0bbd40985a15924f4494a7a698eec415.gif

Link to comment
Share on other sites

95% done, just need to sleep on it and poke it in the morning with a clear head.

As stated, there are limits to what I can do for people here - you'll have to manage the looks yourselves. The template I'll give you to play with with have a foreach loop on the profile fields you have selected in settings to push through here, and it displays them as field name: value, taking any formatting you've done on the fields when you set them up. That means if you ahve this stuff formatted one way for viewing on your profile pages you may need to mess with this a little on this end of things.

Like I said, gonna sleep on this and see if I need to do anything else to maybe make it easier for you guys.

You will be able to toggle the yearbook quote and the rep badge stuff on/off now though yearbook quote will always have that principal placement underneath the username group name bit when enabled, and also, the rep badge will have the last position - any other profile fields you enable will be placed between the two.

Link to comment
Share on other sites

Those two (three?) who have this now - is the quote adoption already high? I ask as since I'm pulling the profile data I went ahead and set up the quote stuff in it's own db table and not on the members table. Wondering if I can get you guys to just uninstall the old version and install the new one - just means people have to enter their quotes again. It's that or I have to spend time writing a converter to move the data between tables.

Link to comment
Share on other sites

I'm thinking some time tonight. Bread about to be baked, shopping to be done, and Stanley Cup tonight... So, after that?

I have added a setting to toggle on/off click card functionality. This will be up to you guys whether you want this on or off or not - depends on how mobile/tablet heavy you guys are - but the option ended up being trivial to include.

EDIT: Caps won! So, tomorrow ?

Edited by All Astronauts
Link to comment
Share on other sites

AMH Profile Template 101

1) You can break the template if you don't know what you are doing!
2) I can help on occasion but I'm not here to hold your hand! 

amhProfileFields.phtml is the template that contains any profile fields variables you select in settings to push on through to the AMH card. By default it looks like this.

<div id="amh-profile-data">

	{{foreach $profiledata as $fieldname=>$fieldvalue}}
		<span class="amh-profilefield-name">{lang="$fieldname"}</span>: <span class="amh-profilefield-value">{$fieldvalue}</span><br>
	{{endforeach}}

</div>

The template has passed to it an array of the profile field data ($profiledata) you selected to push through. It than says "for each of the things in the array, lets do something with them AND let's go through them as the array key being $fieldname and the value of that bit $fieldvalue".

Conveniently, the array keys are set up to be the actual profile name language bits. That means in this foreach loop all I have to do is {lang="$fieldname"} and the name of the field is outputted (for the user's language as well as this language template helper just ends up calling the member's chosen language)! To output the actual value of the profile field IN THIS FOREACH LOOP you just insert the variable as you would with standard template syntax i.e. {$fieldvalue}. 

The fieldvalue is either going to be whatever it is (and it will be escaped by default) OR whatever formatting and structure you have already applied when setting up the profile field.

profielsetup.thumb.PNG.3ff2db48a9cd86a94ededbf0cf052a2f.PNG

Whatever you have done there is what gets pushed through. If you have done nothing, it just comes out as is (but escaped by default as far as I can tell).

Since this is a foreach loop you don't have to worry about missing bits and pieces - it is a "safe" template construct in that it just works with whatever happens to be in there. There are some spans there with classes for you to target and format as you like. As you muck about, you can always get back to normal by overwriting your broken template with the above to get back to stock and start mucking all over again.

Now, some of you want to do wondrous things. Great! But you best know what you are doing. Naturally that means wiping out the foreach structure and doing whatever you want. Note with the foreach removed we no longer are talking about $fieldname and $fieldvalue - those aren't going to be what we are working with anymore - now it is the $profiledata array directly.

The two things you need to be aware of are how to get the specific array bits by themselves and to protect yourself against non-existent array keys.

The actual array structure of $profiledata is this:

$profiledata['core_pfield_4'] => "Whatever the value of the profile field is here",
$profiledata['core_pfield_2'] => "Whatever the value of this profile field is here",
etc...

So, you can remove the foreach loop and just do these two things:

{lang="core_pfield_4"} - this outputs the name of the field (if you want or need it). Naturally the number on the end of core_pfield_ will change based on the profile field. I list these out for you in settings to help but you can also look them up in the database directly if you like.

{$profiledata['core_pfield_4']} - This outputs the value of the profile field.

That's it! If this is too confusing for you study up on IPS template syntax or find someone (not me...) to help you out.

However, you MUST PROTECT YOURSELF when you call these directly. What do you think happens if you customize the template to output {$profiledata['core_pfield_4']} and you (or someone else) decides to remove that profile field from being output to the AMH hovercard? The template will look for a variable that is not there and will just hang, probably with a spinner, and no errors thrown. This is stuff YOU need to account for!

Do this!

	{{if array_key_exists('core_pfield_2', $profiledata)}}
		{$profiledata['core_pfield_2']}
	{{endif}}

And be careful when you start copy/pasting things or changing the field number up on the fly in the template that you don't do something like this:

	{{if array_key_exists('core_pfield_2', $profiledata)}}
		{$profiledata['core_pfield_4']}
	{{endif}}

Make sure those numbers match - checking for the existence of one thing but then trying to display another leads to madness and broken templates.

Once you are protected as above that's it! Go crazy! Add your classes and divs and what have you and do whatcha like!

Edited by All Astronauts
Link to comment
Share on other sites

@All AstronautsJust found a bug with the latest update, if you go to update your yearbook quote; it'll show the error that it couldn't locate what you are trying to view and the url looks something like this: 

https://domain.tld/profile/0-%7B%3F%7D/
(which would be 0-{?})
Sorry, there is a problem

We could not locate the item you are trying to view.
Error code: 2C138/1

It still saves it, though. But this is reproducible. 

Edited by Tripp★
Link to comment
Share on other sites

19 hours ago, All Astronauts said:

It's just the redirect I put in - before, when you saved, the page didn't reload so the displayed quote stayed the same until you refreshed. Prob just passing the wrong thing to the redirect method - two shakes, have this patched.

EDIT: Done - dl again, etc...

I just redownloaded this, and uninstalled and then reinstalled. Getting the same issue, but only for folks who haven't set the quote before it seems.

Edited by AlexWright
Link to comment
Share on other sites

Just now, All Astronauts said:

Sorry bout that, grab it again now. If it still happens for new quote makers I'll need to investigate further but it appears I just derped this momentarily (should have just used the request id in the first place)

Alright. Can this "new" version be uploaded as an update, or should I uninstall and reinstall again? Thanks!

Link to comment
Share on other sites

  • 2 months later...

Yearbook quote block is on the members profile page,  left side bar,  near the bottom of the column.  

tres.PNG.78cd481824c714618fb301f884760a13.PNG   uno.PNG.cfbaed7fd0e7ba2e5fcedab843cc609e.PNG

That fields to be outputted block should be pulling in any profile fields you have available. I just did a 3.4.6 to 4.3.whatever upgrade and installed this right afterward and all the old and new profiles fields were there for use. 

dos.thumb.PNG.dba7958a33bcf9541e1859eda532fb9e.PNG

So,  guessing you don't have any which would be odd but would explain the empty block,  or there is something else is going on. 

You can pm me acp access and I'll take a look if you like. 

Edited by All Astronauts
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...