Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

How to get correct path to full avatar placeholders - nophoto

11 years 1 month ago #233696 by pepperstreet
Hello, i would need the path of the full profile picture placeholder. How to get the correct path info for any possible folder location? CB template may vary: 1.) template in global config 2.) template changer plugin for each user

Purpose:
A 3rd-party extension needs to get the bigger image for own resize function and cache folder. This extension can have multiple sections and templates. Each template can have their own Avatar size.

Uploaded images are no problem. They can be found in /images/comprofiler.
Path is known and filename is available by query i.e.:
SELECT avatar FROM #__comprofiler WHERE user_id = 42 AND avatarapproved = 1

But it does not help in regards of placeholder NOPHOTO. Example locations and paths:

NOPHOTO
/components/com_comprofiler/plugin/templates/MYCBTEMPALTE/images/avatar/nophoto_n.png

PENDING
/components/com_comprofiler/plugin/templates/MYCBTEMPALTE/images/avatar/pending_n.png


Question(s):
How does one get the selected MYCBTEMPLATE from global config? Where is this information stored and accessible? How to deal with CB Template Changer plugin info?

Thanks in advance.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago - 11 years 1 month ago #233715 by krileon

How does one get the selected MYCBTEMPLATE from global config? Where is this information stored and accessible?

You'll need to use the getFields API to retrieve the proper avatar path. Example as follows.

$avatar = $cbUser->getField( 'avatar', null, 'csv' );

Please see the below tutorial for further getFields usage information.

www.joomlapolis.com/support/tutorials/120-api-usage/18361-obtaining-field-values-through-getfields-api

If you're at a location you can use substitutions then you can use [avatar] and it should give you just the URL.

How to deal with CB Template Changer plugin info?

You can't. The change occurs on profile display only. You'd have to implement your own solution to generate the image URL.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 11 years 1 month ago by krileon.
The following user(s) said Thank You: pepperstreet

Please Log in or Create an account to join the conversation.

11 years 1 month ago - 11 years 1 month ago #233734 by pepperstreet
CB Template selection in Global Config:
There is no alternative way to get this info? I mean, without API?


CB Template Changer plugin:

You can't. The change occurs on profile display only. You'd have to implement your own solution to generate the image URL.

o.k. its not sooo important to deal with it. Very rarely used.
What does the respective profile field include? The name or ID# of the template?
Last edit: 11 years 1 month ago by pepperstreet.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago #233746 by krileon

There is no alternative way to get this info? I mean, without API?

You can get the CB template, but it's not going to reflect the template change from CB Template Changer outside of CB profiles and it won't have any affect on getFields outside of profile view.

What does the respective profile field include? The name or ID# of the template?

CB Template Changer stores the name of the template.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

11 years 1 month ago - 11 years 1 month ago #233755 by pepperstreet

krileon wrote: You can get the CB template, ... it won't have any affect on getFields outside of profile view.


Sorry, did not understand "outside of profile view"?

As I mentioned, it is for a function from a 3rd-party extension: Cobalt CCK by MintJoomla. I am not sure when this tool runs... sorry. If the list or article template has an avatar parameter, i can set an individual size for each template. Thus it needs to fetch the full image/avatar, resize it according to my settings and store it in a cache folder. I was told, this happens only once.

So, we are on a list or article view of the CCK. And there might be author-links and avatars.

CB Template Changer stores the name of the template.


I wonder why CB global template from global configuration is not available in a DB table? That would make it pretty simple and easy via query.
Last edit: 11 years 1 month ago by pepperstreet.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
11 years 1 month ago - 11 years 1 month ago #233774 by krileon

Sorry, did not understand "outside of profile view"?

When you're not looking at a profile on frontend it won't reflect the template change from CB Template Changer. The API to get the current template name is as follows.

From API Call:
Code:
$template = selectTemplate( 'dir' );

From Config:
Code:
global $ueConfig; $template = $ueConfig['templatedir'];

I wonder why CB global template from global configuration is not available in a DB table? That would make it pretty simple and easy via query.

It's a config parameter. We don't store CB config to database. You can get it with the above API calls.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 11 years 1 month ago by krileon.
The following user(s) said Thank You: pepperstreet

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum