Topic-icon k2 Avatar not showing in SClogin

Active Subscriptions:

None
8 years 4 months ago #56433 by robertobaggio
Dear Alex,

I'm sorry, I didn't want mean it'is only that I'd love help people when provide good and efficient support to me.

USER wrote: - link the user k2 avatar (appearing now on SClogin) to the same user/author k2 page

We'll have to look into the exact code to do this. If you can provide an example URL of what it should look like, that will help as it's really just passing that URL into the 2nd parameter of the getAvatarHTML function that we're already using.

- For example, Marco logs in using SCLogin, he clicks on his K2 Avatar (that now is showed on SCLogin) that is linked to his own K2 user page ( example link of K2 user page of Marco mancinimarco.com/en/articoli/psicologia/itemlist/user/935-marco )

USER wrote: - add a text-link in user/author k2 page (wherever you want on the page) linked to the jomsocial profile of the same author

You should create a User Menu and have SCLogin display that menu to your users to add additional links to the login module.

- I explain better. I need that when a user land on a whatever K2 user page (where usually are displayed the articles written from the author --> example mancinimarco.com/en/articoli/psicologia/itemlist/user/935-marco ) he will find a link, wherever, that point to the joomsocial profile of that user (not to his own jomsocial profile). To achieve it I did:

In user.php ( \html\com_k2\templates\default ) I added the following:
<div class="custom">
<a href="<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$itemAuthor->userID); ?>" ><?php echo $this->user->name; ?> <?php echo JText::_('CONTACT_AUTHOR'); ?></a>
</div>

My problem is that this text link above is pointing to the jomsocial profile of the user that is logged and not to the jomsocial profile of the user displayed on the k2 user/author page.
I would only need your help to get the right URL,

Best

Baggio
The topic has been locked.
Support Specialist
8 years 4 months ago #56442 by alzander
For linking the user's K2 image to their profile, try updating the SCLogin code from:
return $this->getAvatarHtml( K2HelperUtilities::getAvatar($user->id) , '', '');
to:
return $this->getAvatarHtml( K2HelperUtilities::getAvatar($user->id) , K2HelperRoute::getUserRoute($user->id), '_self');

For the other questions, I think you'd be best asking in the K2 forums. We don't control the K2 output and don't know JomSocial that well. What you're looking for there really isn't related to SCLogin or JFBConnect at all.

I hope that helps get you going,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 4 months ago #56444 by robertobaggio
Dear Alex,
I got the following error:
Fatal error: Class 'K2HelperRoute' not found in C:\xampp\htdocs\mysite\modules\mod_sclogin\helper.php on line 387

ok I will ask on other forum for the other questions. Can I ask only if you have an idea on how I might change the following URL in order that will points to the joomsocial profile of the user displayed on the page?

<a href="<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$itemAuthor->userID); ?>" ><?php echo $this->user->name; ?> <?php echo JText::_('CONTACT_AUTHOR'); ?></a>

Best,

Baggio
The topic has been locked.
Support Specialist
8 years 4 months ago #56449 by alzander
Arrgghh. Needed to include another file. Please update:
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php');
to be:
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'utilities.php'); 
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
That should fix that issue for you.

Can I ask only if you have an idea on how I might change the following URL in order that will points to the joomsocial profile of the user displayed on the page?

Do you mean the logged in user? The code already uses $itemAuthor->userID, which I would assume would point to the author of the article already. If you want the current user viewing the article, you could probably change that to:
<a href="<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.JFactory::getUser()->id); ?>"  ><?php echo JFactory::getUser()->name; ?> <?php echo JText::_('CONTACT_AUTHOR'); ?></a>
That's just a guess though. Again, neither of those are our extensions, so I'm not the best to ask on that.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 4 months ago #56451 by robertobaggio
Dear Alex,
your code is finally working for k2 avatar in sclogin. Many Thanks.
Unfortunately this url:

<a href="<?php echo CRoute::_('index.php?option=com_community&view=profile&userid='.$itemAuthor->userID); ?>" ><?php echo $this->user->name; ?> <?php echo JText::_('CONTACT_AUTHOR'); ?></a>

never gives me back the $itemAuthor->userID, but always the ID of the logged user.....
I don't really understand why...
Thank you anyway for your help,
Best,
Baggio
The topic has been locked.
Support Specialist
8 years 4 months ago #56455 by alzander
I'm glad to hear that code snippet worked for you. Regarding the URL link, I really don't have any idea why that's happening. That's code that K2 implemented and the variable name sure looks like it would be for the author, not the logged in user. I couldn't tell you why it might be otherwise.

Sorry I can't help further with the other issues unrelated to JFBConnect or SCLogin. I hope we've answered all the questions and issues regarding our products though. If you need anything else, just let me know.

Thanks,
Alex
The topic has been locked.