I have a block which I show on a user's main page, user/1, user/2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
On Wed, May 28, 2008 at 12:57 PM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a block which I show on a user's main page, user/1, user/2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Maybe a php condition like:
if(arg(0)==user && ctype_digit(arg(1))) { return true; } else { return false; }
Thanks Neil -- [ Drupal support list | http://lists.drupal.org/ ]
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a block which I show on a user's main page, user/1, user/2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
I am almost there. Right now I have:
<?php if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { return TRUE; } else { return FALSE; } ?>
which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.
thanks
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Wednesday, May 28, 2008 1:32 PM Subject: Re: [support] Block visibility quandry
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
I have a block which I show on a user's main page, user/1, user/2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
------------------------------------------------------------------------------
-- [ Drupal support list | http://lists.drupal.org/ ]
How about:
<?php (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return TRUE : return FALSE; ?>
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote:
I am almost there. Right now I have:
<?php if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { return TRUE; } else { return FALSE; } ?>
which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/ contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.
thanks
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Wednesday, May 28, 2008 1:32 PM Subject: Re: [support] Block visibility quandry
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com <neil@esl-lounge.com
wrote:
I have a block which I show on a user's main page, user/1, user/ 2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]-- [ Drupal support list | http://lists.drupal.org/ ]
Or maybe:
<?php ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) ? return TRUE : return FALSE; ?>
Which is equivalent to:
<?php if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) { return TRUE; } else { return FALSE; } ?>
The above condition was pilfered directly from profile.module in Drupal 6.
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:59, Richard Burford wrote:
How about:
<?php (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return TRUE : return FALSE; ?>
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote:
I am almost there. Right now I have:
<?php if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { return TRUE; } else { return FALSE; } ?>
which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/ contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.
thanks
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Wednesday, May 28, 2008 1:32 PM Subject: Re: [support] Block visibility quandry
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com <neil@esl-lounge.com
wrote:
I have a block which I show on a user's main page, user/1, user/ 2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
great. That seems to have done the trick. Thanks
Neil
----- Original Message ----- From: "Richard Burford" rich@freestylesystems.co.uk To: support@drupal.org Sent: Thursday, May 29, 2008 1:08 PM Subject: Re: [support] Block visibility quandry
Or maybe:
<?php ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) ? return TRUE : return FALSE; ?>
Which is equivalent to:
<?php if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) { return TRUE; } else { return FALSE; } ?>
The above condition was pilfered directly from profile.module in Drupal 6.
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:59, Richard Burford wrote:
How about:
<?php (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return TRUE : return FALSE; ?>
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote:
I am almost there. Right now I have:
<?php if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { return TRUE; } else { return FALSE; } ?>
which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/ contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.
thanks
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Wednesday, May 28, 2008 1:32 PM Subject: Re: [support] Block visibility quandry
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com <neil@esl-lounge.com
wrote:
I have a block which I show on a user's main page, user/1, user/ 2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
Neil,
I'm glad you got a solution that meets your requirements.
Would you mind adding a comment with this code and brief explanation of it purpose to the "Overview on block visibility" -- or adding it to the handbook page itself if you are on the docs team.
http://drupal.org/node/64135 http://drupal.org/node/64135#page-visibility
This is an elegant solution and I don't think something like it is on that page right now.
Though this support listserve is spidered by search-engine bots, I think it would still be much harder for someone to find this email exchange than if it were posted to the handbook page.
Thanks,
Shai
On Thu, May 29, 2008 at 7:34 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
great. That seems to have done the trick. Thanks
Neil
----- Original Message ----- From: "Richard Burford" rich@freestylesystems.co.uk To: support@drupal.org Sent: Thursday, May 29, 2008 1:08 PM Subject: Re: [support] Block visibility quandry
Or maybe:
<?php ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) ? return TRUE : return FALSE; ?>
Which is equivalent to:
<?php if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) { return TRUE; } else { return FALSE; } ?>
The above condition was pilfered directly from profile.module in Drupal 6.
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:59, Richard Burford wrote:
How about:
<?php (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return TRUE : return FALSE; ?>
psynaptic http://freestylesystems.co.uk http://api.freestylesystems.co.uk
On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote:
I am almost there. Right now I have:
<?php if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { return TRUE; } else { return FALSE; } ?>
which prevents the block from showing on user/2/edit, etc. Is there a way I can check for the existence of arg(2) and not show the block if it exists? That would eliminate user/2/edit, user/2/track, user/2/ contact and some other possibilities. I could manually alter my current code to block out contact/track but I'd prefer a kill-all solution.
thanks
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Wednesday, May 28, 2008 1:32 PM Subject: Re: [support] Block visibility quandry
Hi Neil,
I don't know if the UI for the block module settings will allow regular expressions. I doubt it, but give it a try and report back.
However, what will surely work is putting in your own php. Have you noticed that radio for adding PHP to return "TRUE" to make block visible? That's your answer.
Here's a code snippet that should get you started: http://drupal.org/node/64135#page-visibility
Here is one that is a little more sophisticated which was designed for the Google Analytics module... when to include the tracking code on a page -- totally analogous to block visibility: http://drupal.org/node/261997
Good luck. And please add your snippet to the handbook page.
Shai
On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com <neil@esl-lounge.com
wrote:
I have a block which I show on a user's main page, user/1, user/ 2, etc.
I have set block visibility to "only show on pages" with user/* entered below.
Unfortunately, it's also showing on user/register, user/password.
I don't suppose I can use regular expressions to make the wildcard ONLY numeric, can I? How would I get the block to show on user/7 but not user/register?
Thanks
Neil
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
OK, I'll put it on later this evening. It will have to be as a comment to an existing page.
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Thursday, May 29, 2008 3:01 PM Subject: Re: [support] Block visibility quandry
Neil,
I'm glad you got a solution that meets your requirements.
Would you mind adding a comment with this code and brief explanation of it purpose to the "Overview on block visibility" -- or adding it to the handbook page itself if you are on the docs team.
This is an elegant solution and I don't think something like it is on that page right now.
Though this support listserve is spidered by search-engine bots, I think it would still be much harder for someone to find this email exchange than if it were posted to the handbook page.
Thanks,
Shai
On Thu, May 29, 2008 at 7:34 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
great. That seems to have done the trick. Thanks
Neil
----- Original Message ----- From: "Richard Burford" rich@freestylesystems.co.uk To: support@drupal.org
Sent: Thursday, May 29, 2008 1:08 PM Subject: Re: [support] Block visibility quandry
> Or maybe: > > <?php > ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) ? > return TRUE : return FALSE; > ?> > > Which is equivalent to: > > <?php > if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) { > return TRUE; > } > else { > return FALSE; > } > ?> > > The above condition was pilfered directly from profile.module in > Drupal 6. > > psynaptic > http://freestylesystems.co.uk > http://api.freestylesystems.co.uk > > On 29 May 2008, at 11:59, Richard Burford wrote: > >> How about: >> >> <?php >> (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return >> TRUE : return FALSE; >> ?> >> >> psynaptic >> http://freestylesystems.co.uk >> http://api.freestylesystems.co.uk >> >> On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote: >> >>> I am almost there. Right now I have: >>> >>> <?php >>> if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { >>> return TRUE; >>> } else { >>> return FALSE; >>> } >>> ?> >>> >>> which prevents the block from showing on user/2/edit, etc. Is there >>> a way I can check for the existence of arg(2) and not show the block >>> if it exists? That would eliminate user/2/edit, user/2/track, user/2/ >>> contact and some other possibilities. I could manually alter my >>> current code to block out contact/track but I'd prefer a kill-all >>> solution. >>> >>> thanks >>> >>> Neil >>> ----- Original Message ----- >>> From: Shai Gluskin >>> To: support@drupal.org >>> Sent: Wednesday, May 28, 2008 1:32 PM >>> Subject: Re: [support] Block visibility quandry >>> >>> >>> Hi Neil, >>> >>> I don't know if the UI for the block module settings will allow >>> regular expressions. I doubt it, but give it a try and report back. >>> >>> However, what will surely work is putting in your own php. Have you >>> noticed that radio for adding PHP to return "TRUE" to make block >>> visible? That's your answer. >>> >>> Here's a code snippet that should get you started: >>> http://drupal.org/node/64135#page-visibility >>> >>> Here is one that is a little more sophisticated which was designed >>> for the Google Analytics module... when to include the tracking code >>> on a page -- totally analogous to block visibility: >>> http://drupal.org/node/261997 >>> >>> Good luck. And please add your snippet to the handbook page. >>> >>> Shai >>> >>> >>> On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com >>> <neil@esl-lounge.com >>>> wrote: >>> >>> I have a block which I show on a user's main page, user/1, user/ >>> 2, etc. >>> >>> I have set block visibility to "only show on pages" with user/* >>> entered below. >>> >>> Unfortunately, it's also showing on user/register, user/password. >>> >>> I don't suppose I can use regular expressions to make the >>> wildcard ONLY numeric, can I? How would I get the block to show on >>> user/7 but not user/register? >>> >>> Thanks >>> >>> Neil >>> >>> -- >>> [ Drupal support list | http://lists.drupal.org/ ] >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> -- >>> [ Drupal support list | http://lists.drupal.org/ ]-- >>> [ Drupal support list | http://lists.drupal.org/ ] >> >> -- >> [ Drupal support list | http://lists.drupal.org/ ] > > -- > [ Drupal support list | http://lists.drupal.org/ ] >
--
[ Drupal support list | http://lists.drupal.org/ ]
------------------------------------------------------------------------------
-- [ Drupal support list | http://lists.drupal.org/ ]
ok, just posted comment on the link you sent me.
Neil ----- Original Message ----- From: Shai Gluskin To: support@drupal.org Sent: Thursday, May 29, 2008 3:01 PM Subject: Re: [support] Block visibility quandry
Neil,
I'm glad you got a solution that meets your requirements.
Would you mind adding a comment with this code and brief explanation of it purpose to the "Overview on block visibility" -- or adding it to the handbook page itself if you are on the docs team.
This is an elegant solution and I don't think something like it is on that page right now.
Though this support listserve is spidered by search-engine bots, I think it would still be much harder for someone to find this email exchange than if it were posted to the handbook page.
Thanks,
Shai
On Thu, May 29, 2008 at 7:34 AM, Neil: esl-lounge.com neil@esl-lounge.com wrote:
great. That seems to have done the trick. Thanks
Neil
----- Original Message ----- From: "Richard Burford" rich@freestylesystems.co.uk To: support@drupal.org
Sent: Thursday, May 29, 2008 1:08 PM Subject: Re: [support] Block visibility quandry
> Or maybe: > > <?php > ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) ? > return TRUE : return FALSE; > ?> > > Which is equivalent to: > > <?php > if ((arg(0) == 'user') && is_numeric(arg(1)) && (arg(2) == NULL)) { > return TRUE; > } > else { > return FALSE; > } > ?> > > The above condition was pilfered directly from profile.module in > Drupal 6. > > psynaptic > http://freestylesystems.co.uk > http://api.freestylesystems.co.uk > > On 29 May 2008, at 11:59, Richard Burford wrote: > >> How about: >> >> <?php >> (arg(0) == 'user' && is_numeric(arg(1)) && is_null(arg(2))) ? return >> TRUE : return FALSE; >> ?> >> >> psynaptic >> http://freestylesystems.co.uk >> http://api.freestylesystems.co.uk >> >> On 29 May 2008, at 11:46, Neil: esl-lounge.com wrote: >> >>> I am almost there. Right now I have: >>> >>> <?php >>> if(arg(0)==user && ctype_digit(arg(1)) && arg(2)!=edit) { >>> return TRUE; >>> } else { >>> return FALSE; >>> } >>> ?> >>> >>> which prevents the block from showing on user/2/edit, etc. Is there >>> a way I can check for the existence of arg(2) and not show the block >>> if it exists? That would eliminate user/2/edit, user/2/track, user/2/ >>> contact and some other possibilities. I could manually alter my >>> current code to block out contact/track but I'd prefer a kill-all >>> solution. >>> >>> thanks >>> >>> Neil >>> ----- Original Message ----- >>> From: Shai Gluskin >>> To: support@drupal.org >>> Sent: Wednesday, May 28, 2008 1:32 PM >>> Subject: Re: [support] Block visibility quandry >>> >>> >>> Hi Neil, >>> >>> I don't know if the UI for the block module settings will allow >>> regular expressions. I doubt it, but give it a try and report back. >>> >>> However, what will surely work is putting in your own php. Have you >>> noticed that radio for adding PHP to return "TRUE" to make block >>> visible? That's your answer. >>> >>> Here's a code snippet that should get you started: >>> http://drupal.org/node/64135#page-visibility >>> >>> Here is one that is a little more sophisticated which was designed >>> for the Google Analytics module... when to include the tracking code >>> on a page -- totally analogous to block visibility: >>> http://drupal.org/node/261997 >>> >>> Good luck. And please add your snippet to the handbook page. >>> >>> Shai >>> >>> >>> On Wed, May 28, 2008 at 5:57 AM, Neil: esl-lounge.com >>> <neil@esl-lounge.com >>>> wrote: >>> >>> I have a block which I show on a user's main page, user/1, user/ >>> 2, etc. >>> >>> I have set block visibility to "only show on pages" with user/* >>> entered below. >>> >>> Unfortunately, it's also showing on user/register, user/password. >>> >>> I don't suppose I can use regular expressions to make the >>> wildcard ONLY numeric, can I? How would I get the block to show on >>> user/7 but not user/register? >>> >>> Thanks >>> >>> Neil >>> >>> -- >>> [ Drupal support list | http://lists.drupal.org/ ] >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> -- >>> [ Drupal support list | http://lists.drupal.org/ ]-- >>> [ Drupal support list | http://lists.drupal.org/ ] >> >> -- >> [ Drupal support list | http://lists.drupal.org/ ] > > -- > [ Drupal support list | http://lists.drupal.org/ ] >
--
[ Drupal support list | http://lists.drupal.org/ ]
------------------------------------------------------------------------------
-- [ Drupal support list | http://lists.drupal.org/ ]