By Jordan Weinstein on Friday, 04 September 2015
Replies 25
Likes 0
Views 1.2K
Votes 0
Hello,

It seems that the default view for a user profile is view=profile, defaulting to the timeline view. I have custom profiles set up with 2 pages of user data (about user, other). In order to access this, we use the links in the Apps sidebar to show a particular profile page. Would there be a way to modify the system to default to a particular profile page. In my case it would be /about/2 appended to view=profile in order to see that. I have included in site info, an example.

I would imagine it would hacking the code for view=profile to append &layout=about&step=2 to it whenever links for the profile of a user is requested rather than just view=profile. It would be nice if there way to specify the default landing view for a profile in the backend.

If there are code changes, can you notify me so I can update my livesite.
Hey Jordan,

I am really sorry that delay of this reply,

Do you mean that you would like the user view their profile the first page will be show `about` section?

If yes, I have help you set from backend > Easysocial > settings > user > Profile Default Display - About

If no, perhaps you can take a look of this file -> JoomlaFolder\administrator\components\com_easysocial\includes\router\adapters\profile.php

Hope this help.
·
Friday, 04 September 2015 11:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex,

Unfortunately, despite setting the default profile view to 'About' form 'Timeline' in settings, the profile still defaults to timeline.

I have included the sample profile URL in the site details of original post above in order to show you this.

Jordan
·
Sunday, 06 September 2015 21:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Jordan,

There's actually a bug on this when there are no fields are configured to be displayed on your first step. I have applied the fix for you on the site, can you give this a try again?
·
Sunday, 06 September 2015 22:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark.

Could you kindly provide the file that was changed so that I can apply to my life site?

Jordan
·
Sunday, 06 September 2015 23:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Jordan,

I have applied the fixes on the file /administrator/components/com_easysocial/models/users.php
·
Monday, 07 September 2015 00:50
·
0 Likes
·
0 Votes
·
0 Comments
·
This issue has recurred in 1.4.

Mark, I include the file you changed in 1.3 to prevent this issue. Can I ask yo to update 1.4 with this change for the same file in order to resolve it for the latest version of EasySocial?

(My test site is no longer online)

Jordan
·
Wednesday, 28 October 2015 02:30
·
0 Likes
·
0 Votes
·
0 Comments
·
It seems the needed changes are in this file change:

$step->title = $step->get('title');
$step->active = !$step->hide && $index == 1;

if ($step->active) {
$theme = FD::themes();

$theme->set('fields', $step->fields);

$step->html = $theme->output('site/profile/default.info');
}



to:

$step->title = $step->get('title');
$step->active = !$step->hide && $index == 1;

if (!$step->hide && !$hasActive && $index > 1) {
$step->active = true;
$hasActive = true;
}


if ($step->active) {
$theme = FD::themes();

$theme->set('fields', $step->fields);

$step->html = $theme->output('site/profile/default.info');
}


But it would be good to confirm and make this bug fix permanent for future versions.
·
Wednesday, 28 October 2015 03:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Jordan,

I am sorry for the delay of this reply,

It seems like the fix is not included in the Easysocial latest version, can you try download my attachment file and replace into 1.4 administrator/components/com_easysocial/models/users.php and see is it everything work fine?
·
Wednesday, 28 October 2015 13:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, that did it. Will this make it in to the public version of the component?
·
Wednesday, 28 October 2015 18:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for getting back to us everything is work fine, I will include this fix in next release version of Easysocial.
·
Wednesday, 28 October 2015 19:30
·
0 Likes
·
0 Votes
·
0 Comments
·
A similar issue has returned since upgrading to 1.4.6

Now, the default Profile view showing on profile view is 'Timeline' despite selecting 'About' in the 'Profile Default Display'

I can resolve the issue by changing the following code block in users.php:

From:

/**
* Retrieves the "about" information of a user.
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function getAbout($user, $activeStep = 0)
{
// Load admin language files
FD::language()->loadAdmin();

// Get a list of steps
$model = FD::model('Steps');
$steps = $model->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);

// Load up the fields library
$fieldsLib = FD::fields();
$fieldsModel = FD::model('Fields');

// Initial step
$index = 1;
$hasActive = false;

foreach ($steps as $step) {

// Get a list of fields from the current tab
$options = array('step_id' => $step->id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY);
$step->fields = $fieldsModel->getCustomFields($options);

// Trigger each fields available on the step
if (!empty($step->fields)) {
$args = array($user);

$fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_USER, $step->fields, $args);
}

// By default hide the step
$step->hide = true;

// As long as one of the field in the step has an output, then this step shouldn't be hidden
// If step has been marked false, then no point marking it as false again
// We don't break from the loop here because there is other checking going on
foreach ($step->fields as $field) {

// We do not want to consider "header" field as a valid output
if ($field->element == 'header') {
continue;
}

// Ensure that the field has an output
if (!empty($field->output) && $step->hide === true) {
$step->hide = false;
}
}

// Default step url
$step->url = FRoute::profile(array('id' => $user->getAlias(), 'layout' => 'about'), false);

if ($index !== 1) {
$step->url = FRoute::profile(array('id' => $user->getAlias(), 'layout' => 'about', 'step' => $index), false);
}

$step->title = $step->get('title');
$step->active = !$step->hide && $index == 1 && !$activeStep;

// If there is an activeStep set, we should respect that
if ($activeStep && $activeStep == $step->sequence) {
$step->active = true;
$hasActive = true;
}

// If the step is not hidden and there isn't any active set previously
// Also, it should be the first item on the list.
if (!$activeStep && !$step->hide && !$hasActive && $index == 1) {
$step->active = true;
$hasActive = true;
}

if ($step->active) {
$theme = FD::themes();
$theme->set('fields', $step->fields);

$step->html = $theme->output('site/profile/default.info');
}

$step->index = $index;

$index++;
}

return $steps;
}



To:

/**
* Retrieves the "about" information of a user.
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function getAbout($user)
{
// Load admin language files
FD::language()->loadAdmin();

// Get a list of steps
$model = FD::model('Steps');
$steps = $model->getSteps($user->profile_id, SOCIAL_TYPE_PROFILES, SOCIAL_PROFILES_VIEW_DISPLAY);

// Load up the fields library
$fieldsLib = FD::fields();
$fieldsModel = FD::model('Fields');

// Initial step
$index = 1;
$hasActive = false;

foreach ($steps as $step) {

// Get a list of fields from the current tab
$options = array('step_id' => $step->id, 'data' => true, 'dataId' => $user->id, 'dataType' => SOCIAL_TYPE_USER, 'visible' => SOCIAL_PROFILES_VIEW_DISPLAY);
$step->fields = $fieldsModel->getCustomFields($options);

// Trigger each fields available on the step
if (!empty($step->fields)) {
$args = array($user);

$fieldsLib->trigger('onDisplay', SOCIAL_FIELDS_GROUP_USER, $step->fields, $args);
}

// By default hide the step
$step->hide = true;

// As long as one of the field in the step has an output, then this step shouldn't be hidden
// If step has been marked false, then no point marking it as false again
// We don't break from the loop here because there is other checking going on
foreach ($step->fields as $field) {

// We do not want to consider "header" field as a valid output
if ($field->element == 'header') {
continue;
}

// Ensure that the field has an output
if (!empty($field->output) && $step->hide === true) {
$step->hide = false;
}
}

// Default step url
$step->url = FRoute::profile(array('id' => $user->getAlias(), 'layout' => 'about'), false);

if ($index !== 1) {
$step->url = FRoute::profile(array('id' => $user->getAlias(), 'layout' => 'about', 'step' => $index), false);
}

$step->title = $step->get('title');
$step->active = !$step->hide && $index == 1;

if (!$step->hide && !$hasActive && $index > 1) {
$step->active = true;
$hasActive = true;
}

if ($step->active) {
$theme = FD::themes();
$theme->set('fields', $step->fields);

$step->html = $theme->output('site/profile/default.info');
}

$step->index = $index;

$index++;
}

return $steps;
}



It would really help to update this in the stable version of the component, assuming it is correct to do so.

Jordan
·
Wednesday, 27 January 2016 02:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jordan,


We've fixed this internally in the latest version 1.4.6 as I can see this issue is fixed when trying to replicate this on my local (1.4.6). Can you re-provide the access to your site so that I can check on this?


Regards,
Zue
Zue
·
Wednesday, 27 January 2016 13:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi there,

I have downloaded the latest version 1.4.6 from my dashboard and the issue persists. Is the issue fixed only internally at this point or should it be fixed on the version available on the dashboard?

Jordan
·
Wednesday, 27 January 2016 18:02
·
0 Likes
·
0 Votes
·
0 Comments
·
I have just reinstalled and the same issue persists. Site details in original post. This is present on all my installations so please let me know any code changes. I have made the changes (above) on another site and fixed the issue there. But am looking for your input.

Jordan
·
Wednesday, 27 January 2016 22:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jordan,

We can replicate the issue in local and will add the fix internally for version 1.4.7 later on.


Regards,
Zue
Zue
·
Thursday, 28 January 2016 17:03
·
0 Likes
·
0 Votes
·
0 Comments
·
I have just updated to 1.4.7 and this issue still persists. Requests for the user profile page takes you to the timeline view even though 'about' is selected in settings > users > default profile view

Jordan
·
Monday, 01 February 2016 17:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Jordan,

Hm, I can't seem to access your site with the provided login credentials and htaccess. Can you please advise?
·
Monday, 01 February 2016 22:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

I removed the htaccess file. Please give it a try.

Jordan
·
Monday, 01 February 2016 22:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Jordan! I think this could be due to the way your custom fields are being configured as I was applying a fix with a different set of data.

Is it possible for you to help me here by fixing the FTP access? http://screencast.com/t/gYtPzMUM1D
·
Tuesday, 02 February 2016 15:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry Mark, should be fixed.
·
Tuesday, 02 February 2016 19:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Okay my bad! The bug was actually fixed internally but I did not commit the new theme file /components/com_easysocial/themes/wireframe/profile/default.about.fields.php

It was probably because I was rushing to push out 1.4.7 for the security updates, sorry about that. In case anyone needs this file, download the attached file and upload it into /components/com_easysocial/themes/wireframe/profile/
·
Tuesday, 02 February 2016 20:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark,

Seems to do the trick.

Jordan
·
Tuesday, 02 February 2016 22:17
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome
·
Tuesday, 02 February 2016 22:20
·
0 Likes
·
0 Votes
·
0 Comments
·
I have the same bug! So I can use the same file? Because I choose "about" and it shows "timeline"
·
Friday, 05 February 2016 11:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, correct! Please download the file above
·
Friday, 05 February 2016 14:16
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post