I recently installed the domain access module on my wife's blog. She wants two blogs, with some content shared. So this seemed like the solution. However, I am having some trouble. I think it's either a permissions issue, or its got something to do with the author settings on her existing content. Anyway, this is what is happening:
We have three domains: example.com sub1.example.com sub2.example.com
None of these domains shows any content (I get the default Drupal 'welcome' on all of them). If I visit her blog at blog/user/3 then I have a message that the user has not posted anything. But if I log in and visit the same blog/user/3 then I see all her content.
When I'm admin on sub1.example.com I am sometimes told I do not have permission to do things. For example, I can configure all domain access settings until I attempt to enter the "Batch Updating" tab. I am then denied access.
When I'm admin on example.com I cannot view content assigned to an affiliate.
Clearly, I am missing something. BTW, one of the first things I did when I installed this module is change the publish status of all her content. I sent it to sub1.example.com, where it was set to 'all' before.
(Issue in Drupal 6) I need a php snippet that allows me to display (or hide) a block based on whether the user logged in is a member of a certain role, and that they are browsing the site at a certain path. I am able to display a block based on one of these things, but not both.
IE: I can display a block if the user is a member of a role. I can display a block at a certain path (<site>/node/path/x)
However, if i combine the two pieces of php code, then if one of them returns true, the block shows. What i need is for it to check if the path is TRUE, and then also check for the role membership. I have tested the code externally to Drupal, to make sure the nested IF statements are working properly, and they are. It's almost as if Drupal sees the first TRUE, and then stops looking to see if there are multiple conditions to check for as well.
Any ideas? Thanks in advance.
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................
May this is clue,
If you know member id, ,
Go to block configure
select " Show if the following PHP code returns TRUE (PHP-mode, experts only). "
and write the code
global $user
$userid=$user->uid; if($userid ==10 || $userid ==10 ){
return TRUE;
} else{
return FALSE; }
On Mon, Oct 6, 2008 at 6:19 PM, Nick Young nick_young@ncsu.edu wrote:
(Issue in Drupal 6) I need a php snippet that allows me to display (or hide) a block based on whether the user logged in is a member of a certain role, and that they are browsing the site at a certain path. I am able to display a block based on one of these things, but not both.
IE: I can display a block if the user is a member of a role. I can display a block at a certain path (<site>/node/path/x)
However, if i combine the two pieces of php code, then if one of them returns true, the block shows. What i need is for it to check if the path is TRUE, and then also check for the role membership. I have tested the code externally to Drupal, to make sure the nested IF statements are working properly, and they are. It's almost as if Drupal sees the first TRUE, and then stops looking to see if there are multiple conditions to check for as well.
Any ideas? Thanks in advance.
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu <mailto:nick_young@ncsu.edu
........................................................................
-- [ Drupal support list | http://lists.drupal.org/ ]
Why does PHP need to be used. In the blocks settings you can determine visibility for a specific roles as well as specific paths.
For example you could say that only editors see an editing tool bar on all pages content/*
I may be missing what is going on here but this sounds similar than needing to do PHP.
Thanks,
Steve
Steve Kessler
Denver DataMan
303-587-4428
Sign http://www.denverdataman.com/content/enewsletter-signup up for the Denver DataMan Free eNewsletter
From: bharani kumar [mailto:bharanikumariyerphp@gmail.com] Sent: Monday, October 06, 2008 7:34 AM To: support@drupal.org; nick_young@ncsu.edu Subject: Re: [support] block visibility based on role AND path
May this is clue,
If you know member id, ,
Go to block configure
select " Show if the following PHP code returns TRUE (PHP-mode, experts only). "
and write the code
global $user
$userid=$user->uid; if($userid ==10 || $userid ==10 ){
return TRUE;
} else{
return FALSE; }
On Mon, Oct 6, 2008 at 6:19 PM, Nick Young nick_young@ncsu.edu wrote:
(Issue in Drupal 6) I need a php snippet that allows me to display (or hide) a block based on whether the user logged in is a member of a certain role, and that they are browsing the site at a certain path. I am able to display a block based on one of these things, but not both.
IE: I can display a block if the user is a member of a role. I can display a block at a certain path (<site>/node/path/x)
However, if i combine the two pieces of php code, then if one of them returns true, the block shows. What i need is for it to check if the path is TRUE, and then also check for the role membership. I have tested the code externally to Drupal, to make sure the nested IF statements are working properly, and they are. It's almost as if Drupal sees the first TRUE, and then stops looking to see if there are multiple conditions to check for as well.
Any ideas? Thanks in advance.
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................
-- [ Drupal support list | http://lists.drupal.org/ ]
The issue is that i need to check on the combination of conditions, rather than just one.
IE: I need the block to display only if BOTH conditions are met. I need the block to NOT display if none or only one condition is met.
The built-in options only allow you to check for one type of condition (path OR role).
I need it to check for path AND role.
--Nick
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................
Steve Kessler wrote:
Why does PHP need to be used. In the blocks settings you can determine visibility for a specific roles as well as specific paths.
For example you could say that only editors see an editing tool bar on all pages content/*
I may be missing what is going on here but this sounds similar than needing to do PHP.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewsletter http://www.denverdataman.com/content/enewsletter-signup
*From:* bharani kumar [mailto:bharanikumariyerphp@gmail.com] *Sent:* Monday, October 06, 2008 7:34 AM *To:* support@drupal.org; nick_young@ncsu.edu *Subject:* Re: [support] block visibility based on role AND path
May this is clue,
If you know member id, ,
Go to block configure
select " Show if the following PHP code returns |TRUE| (PHP-mode, experts only). "
and write the code
global $user
$userid=$user->uid; if($userid ==10 || $userid ==10 ){
return TRUE;
} else{
return FALSE; }
On Mon, Oct 6, 2008 at 6:19 PM, Nick Young <nick_young@ncsu.edu mailto:nick_young@ncsu.edu> wrote:
(Issue in Drupal 6) I need a php snippet that allows me to display (or hide) a block based on whether the user logged in is a member of a certain role, and that they are browsing the site at a certain path. I am able to display a block based on one of these things, but not both.
IE: I can display a block if the user is a member of a role. I can display a block at a certain path (<site>/node/path/x)
However, if i combine the two pieces of php code, then if one of them returns true, the block shows. What i need is for it to check if the path is TRUE, and then also check for the role membership. I have tested the code externally to Drupal, to make sure the nested IF statements are working properly, and they are. It's almost as if Drupal sees the first TRUE, and then stops looking to see if there are multiple conditions to check for as well.
Any ideas? Thanks in advance.
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu <mailto:nick_young@ncsu.edu mailto:nick_young@ncsu.edu> ........................................................................
-- [ Drupal support list | http://lists.drupal.org/ ]
I will need to take this down latter today bit the block on this page http://www.coredinatedmovement.com/content/contact-coredinated-movement (conditions test) only appears if you are anonymous and you are on the specific page. Conditions built into Drupal are AND not OR.
Steve Kessler Denver DataMan 303-587-4428 Sign up for the Denver DataMan Free eNewsletter
-----Original Message----- From: Nick Young [mailto:nick_young@ncsu.edu] Sent: Monday, October 06, 2008 8:10 AM To: support@drupal.org Subject: Re: [support] block visibility based on role AND path
The issue is that i need to check on the combination of conditions, rather than just one.
IE: I need the block to display only if BOTH conditions are met. I need the block to NOT display if none or only one condition is met.
The built-in options only allow you to check for one type of condition (path OR role).
I need it to check for path AND role.
--Nick
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................
Steve Kessler wrote:
Why does PHP need to be used. In the blocks settings you can determine visibility for a specific roles as well as specific paths.
For example you could say that only editors see an editing tool bar on all pages content/*
I may be missing what is going on here but this sounds similar than needing to do PHP.
Thanks,
Steve
Steve Kessler
*Denver DataMan *
303-587-4428
Sign up for the Denver DataMan Free eNewsletter http://www.denverdataman.com/content/enewsletter-signup
*From:* bharani kumar [mailto:bharanikumariyerphp@gmail.com] *Sent:* Monday, October 06, 2008 7:34 AM *To:* support@drupal.org; nick_young@ncsu.edu *Subject:* Re: [support] block visibility based on role AND path
May this is clue,
If you know member id, ,
Go to block configure
select " Show if the following PHP code returns |TRUE| (PHP-mode, experts only). "
and write the code
global $user
$userid=$user->uid; if($userid ==10 || $userid ==10 ){
return TRUE;
} else{
return FALSE; }
On Mon, Oct 6, 2008 at 6:19 PM, Nick Young <nick_young@ncsu.edu mailto:nick_young@ncsu.edu> wrote:
(Issue in Drupal 6) I need a php snippet that allows me to display (or hide) a block based on whether the user logged in is a member of a certain role, and that they are browsing the site at a certain path. I am able to display a block based on one of these things, but not both.
IE: I can display a block if the user is a member of a role. I can display a block at a certain path (<site>/node/path/x)
However, if i combine the two pieces of php code, then if one of them returns true, the block shows. What i need is for it to check if the path is TRUE, and then also check for the role membership. I have tested the code externally to Drupal, to make sure the nested IF statements are working properly, and they are. It's almost as if Drupal sees the first TRUE, and then stops looking to see if there are multiple conditions to check for as well.
Any ideas? Thanks in advance.
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu <mailto:nick_young@ncsu.edu mailto:nick_young@ncsu.edu> ........................................................................
-- [ Drupal support list | http://lists.drupal.org/ ]
Quoting Nick Young nick_young@ncsu.edu:
If you know member id, ,
Go to block configure
select " Show if the following PHP code returns |TRUE| (PHP-mode, experts only). "
and write the code
global $user
$userid=$user->uid; if($userid ==10 || $userid ==10 ){
return TRUE;
} else{
return FALSE; }
--8<--
I need the block to display only if BOTH conditions are met. I need the block to NOT display if none or only one condition is met.
The built-in options only allow you to check for one type of condition (path OR role).
I need it to check for path AND role.
So just change the condition.
return ($user->uid == 10 && $_GET['q'] = 'my/uri/path')
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
This would work if there were only one path or one user to match to.
What if there are multiple paths, and multiple users to match?
IE: return TRUE if user = Mark or Tom or Paul or Peter AND path = /path1 or /path2 or /path3
--Nick
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................
Earnie Boyd wrote:
So just change the condition.
return ($user->uid == 10 && $_GET['q'] = 'my/uri/path')
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
FYI: Here is the solution:
<?php // look for particular paths in the URL $termslist = array("path-element-1","path-element-2"); $elements = explode("/", $_SERVER['REQUEST_URI'], 10); global $user; $userlist = array('user-account-name'); foreach ($termslist as $term) { if (in_array($term, $elements) && in_array($user->name, $userlist)) { return true; } } return false; ?>
........................................................................ Nick Young Outreach, Communications & Consulting Office of Information Technology North Carolina State University Box 7109, Raleigh 27695 Ph. 919.513.2716 | E-Mail: nick_young@ncsu.edu mailto:nick_young@ncsu.edu ........................................................................