Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Show About Me if No Stream Activity

10 years 5 months ago
  • Adam's Avatar
    Topic Author
  • Adam
  • Offline
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 2
Licenses:
JomSocial Active

ISSUE SUMMARY:

I know this is a customization issue and for the most part, I have been pretty good at figuring out what I want to accomplish and coming up with a solution but I feel in this case, since I am 99% to where I need to be, hopefully you can look over what I have done thus far and help me with the finishing item :)

As the title states, I want to have the About Me tab on the user profile page to be the default view ONLY if there has been no activity in the wall stream. This could be a good future feature but for now I will show you what I have done: I feel I am not calling the right variable so hopefully that is all I need to do:

In the templates/mytemplate/layouts/stream/base.php file I did the following test successfully:

if (count($activities) == 0) {
<div class="tester">equals zero</div>
}

and ...

if (count($activities) > 0) {
<div class="tester">more than zero</div>
}

so i was able to establish if there are no activities then 'do this'.


I then went to the tabs.php file in applications/tabs.php

foreach ($apps as $app) {
//special case for active tab (about me and fix will follow the backend settings)
$active = true;
if (count($activities) == 0) {
if($app->id == 'feeds-special'){
$config = CFactory::getConfig();
$active = ($config->get('default_profile_tab') == 1) ? true : false;
}elseif($app->id == 'aboutme-special'){
$config = CFactory::getConfig();
$active = ($config->get('default_profile_tab') == 0) ? true : false;
}
if (trim($app->data) != '') {
?>
<a<?php echo (!$active || $i++) ? '' : ' class="active"' ?>
href="#joms-app--<?php echo $app->id; ?>"><?php echo JText::_($app->title); ?></a>
<?php
}
}else {

if($app->id == 'aboutme-special'){
$config = CFactory::getConfig();
$active = ($config->get('default_profile_tab') == 1) ? true : false;
}elseif($app->id == 'feeds-special'){
$config = CFactory::getConfig();
$active = ($config->get('default_profile_tab') == 0) ? true : false;
}
if (trim($app->data) != '') {
?>
<a<?php echo (!$active || $i++) ? '' : ' class="active"' ?>
href="#joms-app--<?php echo $app->id; ?>"><?php echo JText::_($app->title); ?></a>
<?php
}

}


}


I feel like the $activities variable is not being called in the tabs page and was hoping you could tell what I need to place at the top of the page to call that variable?

Hopefully this makes sense.

If there is actually an easier way to accomplish this, I would also be open that any suggestions :)

Thanks for all your hard work!

Adam


PS. I just noticed that with what I did, it actually does make the About Me tab active, however it doesn't switch the display:none inline style so hopefully that helps in narrowing it down some

STEPS TO REPLICATE:
1
2
3
4
5
RESULT
EXPECTED RESULT
BROWSER

10 years 5 months ago
Licenses:

Hi,

here the code to get countActivities number at users profile

include_once (JPATH_ROOT.'/components/com_community/libraries/core.php');
include_once (JPATH_ROOT . '/components/com_community/models/models.php');

$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;

$my = CFactory::getUser();
$userid = $jinput->get('userid', $my->id, 'INT');

$activitiesModel = CFactory::getModel('activities');
echo $countActivities = $activitiesModel->countActivities($userid);

I hope that code can help you

Regards

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW