-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I needed to hide registering from navbar, but still be able to use the link
(app/default/user/register) if I call it explicitly.

I tried first:
auth.settings.actions_disabled=['register']

but then, I got a 404 error on that link, so I've added an extra parameter to
Auth.navbar() that accepts an array of actions to hide.

I attach the patch from [Version 2.3.2 (2012-12-17 08:59:58) stable] with the
changes.

- -- 
Com os melhores cumprimentos,

Carlos Correia
=========================
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlGUiAgACgkQ90uzwjA1SJVHGQCdGebSos1BbEWTHYmNyu3zkmkl
ltIAn3FEqjSHU0owCAfRqWLptZ6LGShR
=g7B7
-----END PGP SIGNATURE-----

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


diff -r 46a2868083ce gluon/tools.py
--- a/gluon/tools.py	Wed Feb 13 14:01:52 2013 +0000
+++ b/gluon/tools.py	Thu May 16 08:03:18 2013 +0100
@@ -1254,7 +1254,8 @@
 
     def navbar(self, prefix='Welcome', action=None,
                separators=(' [ ', ' | ', ' ] '), user_identifier=DEFAULT,
-               referrer_actions=DEFAULT, mode='default'):
+               referrer_actions=DEFAULT, mode='default',
+               hide_actions=None):
         referrer_actions = [] if not referrer_actions else referrer_actions
         request = current.request
         asdropdown = (mode == 'dropdown')
@@ -1302,11 +1303,13 @@
                 bar = UL(logout, _class='dropdown-menu')
                          # logout will be the last item in list
 
-            if not 'profile' in self.settings.actions_disabled:
+            if not 'profile' in hide_actions and \
+               not 'profile' in self.settings.actions_disabled:
                 if not asdropdown:
                     bar.insert(-1, s2)
                 bar.insert(-1, profile)
-            if not 'change_password' in self.settings.actions_disabled:
+            if not 'change_password' in hide_actions and \
+               not 'change_password' in self.settings.actions_disabled:
                 if not asdropdown:
                     bar.insert(-1, s2)
                 bar.insert(-1, password)
@@ -1330,16 +1333,19 @@
                 bar = UL(login, _class='dropdown-menu')
                          # login will be the last item in list
 
-            if not 'register' in self.settings.actions_disabled:
+            if not 'register' in hide_actions and \
+               not 'register' in self.settings.actions_disabled:
                 if not asdropdown:
                     bar.insert(-1, s2)
                 bar.insert(-1, register)
-            if self.settings.use_username and not 'retrieve_username' \
+            if not 'retrieve_username' in hide_actions and \
+               self.settings.use_username and not 'retrieve_username' \
                     in self.settings.actions_disabled:
                 if not asdropdown:
                     bar.insert(-1, s2)
                 bar.insert(-1, retrieve_username)
-            if not 'request_reset_password' \
+            if not 'request_reset_password' in hide_actions and \
+               not 'request_reset_password' \
                     in self.settings.actions_disabled:
                 if not asdropdown:
                     bar.insert(-1, s2)

Reply via email to