By LAC Webadmin on Friday, 15 August 2014
Replies 3
Likes 0
Views 1K
Votes 0
Hi Mark,

I think have mentioned a search config ability for Site Admins in one of my post to have ACL on selected fields that should be available to end users.

I remember you said it is not available for now.

Question about it, is there a way to override Advanced Search view so I can validate for user's group or profile? Or if I cannot manipulate the Fields that are returned, at least maybe I can disable the Advanced Search link for Regular Users and make it available for certain Profile Type like in my case Staff.

Thanks Mark, looking forward to v1.3

Jackson
Hello Jackson,

You can't really override the core codes unless you re-construct the entire custom search again from within the template file itself but really, I think that is a suicidal attempt

If you want to remove the "Advanced Search" link from the search result, you could actually edit the theme file /components/com_easysocial/themes/wireframe/search/default.list.mini.php
·
Friday, 15 August 2014 02:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

Ok, I'll take the Theme override route.

Thanks for confirming Mark.

For whoever wants to do the same, what I did is I created my own Theme by copying Frosty, edit template.json and change the template info to whatever you want and copy 2 files in components/com_easysocial/themes/wireframes/search/


  • default.content.php
  • default.list.mini.php


Take note that Frosty is just an override of Wireframe, any files that is not in Frosty folder means it is not overwritten and still using whatever Wireframe layout is. You can find more info in the Documentation.

Open default.content.php and go to line #31

<div class="row">
<div class="col-md-12">
<div class="pull-right mr-10 fd-small">
<a href="<?php echo FRoute::search( array( 'layout' => 'advanced' ) ); ?>"><?php echo JText::_( 'COM_EASYSOCIAL_ADVANCED_SEARCH_LINK' ); ?></a>
</div>
</div>
</div>



Modify it to something like this:


<?php
// get user's profile
$profile = $this->my->getProfile();
// check for user's profile to show Advanced Search
if( $profile->title == 'Site Admin' || $profile->title == 'Staff' )
{
?>
<div class="row">
<div class="col-md-12">
<div class="pull-right mr-10 fd-small">
<a href="<?php echo FRoute::search( array( 'layout' => 'advanced' ) ); ?>"><?php echo JText::_( 'COM_EASYSOCIAL_ADVANCED_SEARCH_LINK' ); ?></a>
</div>
</div>

</div>
<?php } ?>


In my case, I have 2 Profiles named Site Admin and Staff that I want to have access to Advanced Search. You have to change 'Site Admin' to whatever Profile name you want. If you only have one profile, the if statement should look like :


if( $profile->title == 'Site Admin' )
{


For the Toolbar search, you have to edit default.list.mini.php. Look for line #49 and #58. See Attachment.


// line #49
<div class="text-center fd-small">
<?php echo JText::sprintf( 'COM_EASYSOCIAL_ADVANCED_SEARCH_TRY_ADVANCED_SEARCH', FRoute::search( array( 'layout' => 'advanced' ) ) ); ?>
</div>


Change to:
// line #49

<?php if( $profile->title == 'Site Admin' ) { ?>
<div class="text-center fd-small">
<?php echo JText::sprintf( 'COM_EASYSOCIAL_ADVANCED_SEARCH_TRY_ADVANCED_SEARCH', FRoute::search( array( 'layout' => 'advanced' ) ) ); ?>
</div>
<?php } ?>

// line #58
<?php if( $profile->title == 'Site Admin' ) { ?>
<div class="fd-small">
<?php echo JText::sprintf( 'COM_EASYSOCIAL_ADVANCED_SEARCH_TRY_ADVANCED_SEARCH', FRoute::search( array( 'layout' => 'advanced' ) ) ); ?>
</div>
<?php } ?>


Hope that helps if you need more ask Mark hahaha

- something is wrong with the editor not rendering code properly
·
Friday, 15 August 2014 06:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing this Jackson
·
Saturday, 16 August 2014 23:34
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post