|
|
Re:restriction of access for tabs
|
|
Date: 2007/01/31 02:55
|
By: nzimas
|
Status:
|
|
|
Karma: 3  
|
|
Senior Joomlapolitan  | Posts: 99 |   | |
|
I have set a new user group in JACL with gid 31. Following your instructions, i have *tried* to create a working function that looks like
| Code: | function _loadTabsList($user, $position=null) {
global $database;
if( ($my->gid!=31) || ($user->gid!=31) ) {
$temp=" AND t.title<>'Catalog' ";
}
if ($this->tabsToDisplay === null) {
$qry .="SELECT * FROM #__comprofiler_tabs t WHERE t.enabled=1 ".($position==null ? "" : "\n AND t.position='".$position);
$qry .= $temp;
$qry .= " ORDER BY t.position, t.ordering";
$database->setQuery($qry);
$this->tabsToDisplay = $database->loadObjectList();
}
}
|
Tht tab titled Catalog is not displaying to anyone, though it should be displaying for all users in gid 31.
I bet there is something wrong in my implementation of your patch
Help and guidance are more than welcome.
Nuno. Professional Website: http://www.efiplus.com
|
|
The administrator has disabled public write access. |
|
|
|
Re:restriction of access for tabs
|
|
Date: 2007/01/31 09:34
|
By: king.lui
|
Status:
|
|
|
Karma: 10  
|
|
Expert Joomlapolitan  | Posts: 101 |   | |
|
Yes, with | Code: | if( ($my->gid!=31) || ($user->gid!=31) ) {
$temp=" AND t.title<>'Catalog' ";
}
| you're saying, that tab Catalog will display for gid=31. What do you want to make? If all user will be able to see the tab and gid=31 not, then you must change the code like this: | Code: | if( ($my->gid==31) || ($user->gid==31) ) {
$temp=" AND t.title<>'Catalog' ";
}
| I know, my english seems a little .. unusual .. but really, it's not bad, it's only a bavarian version
|
|
The administrator has disabled public write access. |
|
|
|
Re:restriction of access for tabs
|
|
Date: 2007/01/31 15:18
|
By: nzimas
|
Status:
|
|
|
Karma: 3  
|
|
Senior Joomlapolitan  | Posts: 99 |   | |
|
king.lui wrote: Yes, with | Code: | if( ($my->gid!=31) || ($user->gid!=31) ) {
$temp=" AND t.title<>'Catalog' ";
}
| you're saying, that tab Catalog will display for gid=31. What do you want to make?
That is exactly what i want to achieve. I want only the users with gid 31 to see the tab Catalog. It happens that when i insert your code, the tab does not display to anyone. This is what i find strange.
I have posted the full function to check if it has any syntax error.
Nuno. Professional Website: http://www.efiplus.com
|
|
The administrator has disabled public write access. |
|
|
|
Re:restriction of access for tabs
|
|
Date: 2007/01/31 15:30
|
By: king.lui
|
Status:
|
|
|
Karma: 10  
|
|
Expert Joomlapolitan  | Posts: 101 |   | |
|
try this | Code: | if($my->gid!=31) {
$temp=" AND t.title<>'Catalog' ";
}
| so only gid31 will see the tab. i hope so I know, my english seems a little .. unusual .. but really, it's not bad, it's only a bavarian version
|
|
The administrator has disabled public write access. |
|
|
|
Re:restriction of access for tabs
|
|
Date: 2007/01/31 23:27
|
By: nzimas
|
Status:
|
|
|
Karma: 3  
|
|
Senior Joomlapolitan  | Posts: 99 |   | |
|
Thanks for your kind help, but it is still not working. Here's how the function looks like now function _loadTabsList($user, $position=null) { global $database; if($my->gid!=31) { $temp=" AND t.title<>'Catalog' "; } if ($this->tabsToDisplay === null) { $qry .="SELECT * FROM #__comprofiler_tabs t WHERE t.enabled=1 ".($position==null ? "" : "n AND t.position='".$position); $qry .= $temp; $qry .= " ORDER BY t.position, t.ordering"; $database->setQuery($qry); $this->tabsToDisplay = $database->loadObjectList(); } } Users belonging to gid=41 still cannot see the tab with the title Catalog.
Pity
Nuno. Professional Website: http://www.efiplus.com
|
|
The administrator has disabled public write access. |
|
|
|
Re:restriction of access for tabs
|
|
Date: 2007/02/01 10:10
|
By: king.lui
|
Status:
|
|
|
Karma: 10  
|
|
Expert Joomlapolitan  | Posts: 101 |   | |
|
gid=41? i think, you meen gid=31. the problem is, that $my isn't available in that function. so this code must be run: | Code: | function _loadTabsList($user, $position=null) {
global $database, $my;
$temp="";
if($my->gid!=31) {
$temp=" AND t.title<>'Catalog' ";
}
if ($this->tabsToDisplay === null) {
$qry .="SELECT * FROM #__comprofiler_tabs t WHERE t.enabled=1 ".($position==null ? "" : "n AND t.position='".$position);
$qry .= $temp;
$qry .= " ORDER BY t.position, t.ordering";
$database->setQuery($qry);
$this->tabsToDisplay = $database->loadObjectList();
}
}
|
Here are some examples to do related things.
1. tabs only for me:
| Code: | if( $user->id!=$my->id ) $temp .= " AND t.title<>'Clicked me' ";
|
2. tabs only for connected people: | Code: |
$qry_myCont ="SELECT cms.id
FROM #__users as cms, #__comprofiler_members AS m
LEFT JOIN #__comprofiler AS cb ON m.memberid=cb.id
WHERE m.referenceid = $user->user_id
AND block='0'
AND cb.user_id=cms.id
AND cb.approved=1
AND cb.confirmed=1";
$database->setQuery( $qry_myCont );
$arr_onlyContIds = $database->loadResultArray();
array_push($arr_onlyContIds,'62');
if(count($arr_onlyContIds) && !in_array($my->id,$arr_onlyContIds) && $my->id!=$user->id) $temp .= " AND t.title<>'Fotos'";
|
Post edited by: king.lui, at: 2007/02/01 10:17 I know, my english seems a little .. unusual .. but really, it's not bad, it's only a bavarian version
|
|
The administrator has disabled public write access. |
|
|