[support] module for user contact form control
Jonathan Hedstrom
jhedstrom at opensourcery.com
Tue Oct 21 00:47:40 UTC 2008
Tony Crockford wrote:
> Hi
>
> I'm new, please go easy on me.
>
> I've been looking through the modules for Drupal 6.x and I can't quite
> match what I'm looking for, what i want to be able to do is have a
> user role that can access personal contact forms (if the user has
> allowed them)
>
> e.g. anonymous can't see the personal contact form
>
> authenticated user can't see the personal contact form
>
> gold_authenticated user *can* see the personal contact form *if* the
> user has allowed it
>
> any ideas?
>
Not sure if there's an existing module, but one idea for writing a
simple one:
By using hook_menu_alter [1] you could re-define the access function:
function mymodule_menu_alter(&$callbacks) {
$callbacks['user/%user/contact']['access callback'] =
'mymodule_contact_access_function_name';
}
then you could define:
function mymodule_contact_access_function($account) {
...implement whatever logic you want...
}
You can see how contact defines access by default here [2].
1. http://api.drupal.org/api/function/hook_menu_alter/6
2. http://api.drupal.org/api/function/_contact_user_tab_access/6
Cheers,
Jonathan
--
Jonathan Hedstrom OpenSourcery
http://opensourcery.com Technology for Good
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.drupal.org/pipermail/support/attachments/20081020/7ceef2be/attachment.pgp
More information about the support
mailing list