Merge lp:~edb/quam-plures/register_link_in_menu into lp:quam-plures

Proposed by EdB
Status: Merged
Merged at revision: 7580
Proposed branch: lp:~edb/quam-plures/register_link_in_menu
Merge into: lp:quam-plures
Diff against target: 56 lines (+27/-1)
2 files modified
qp_inc/users/model/_user.funcs.php (+16/-0)
qp_plugins/menu_link_widget/_menu_link.widget.php (+11/-1)
To merge this branch: bzr merge lp:~edb/quam-plures/register_link_in_menu
Reviewer Review Type Date Requested Status
Yabs (community) Approve
Review via email: mp+45593@code.launchpad.net

Description of the change

Adds a "register" option to the menu widget. Getting the link on the public blog requires registration to be open (of course).

To post a comment you must log in.
Revision history for this message
Yabs (yabs) wrote :

Easy review

¥

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qp_inc/users/model/_user.funcs.php'
--- qp_inc/users/model/_user.funcs.php 2010-12-31 12:12:03 +0000
+++ qp_inc/users/model/_user.funcs.php 2011-01-08 03:34:54 +0000
@@ -122,6 +122,22 @@
122 return $srvc_url_sensitive.'login.php'.$redirect;122 return $srvc_url_sensitive.'login.php'.$redirect;
123}123}
124124
125
126/**
127 * Get url to login
128 *
129 * @return string
130 */
131function get_register_url()
132{
133 global $srvc_url_sensitive;
134
135 $redirect = '?redirect_to='.rawurlencode( url_rel_to_same_host(
136 regenerate_url( '', '', '', '&' ), $srvc_url_sensitive ) );
137 return $srvc_url_sensitive.'register.php'.$redirect;
138}
139
140
125/**141/**
126 * Template tag: Output a link to new user registration142 * Template tag: Output a link to new user registration
127 * @param string143 * @param string
128144
=== modified file 'qp_plugins/menu_link_widget/_menu_link.widget.php'
--- qp_plugins/menu_link_widget/_menu_link.widget.php 2010-12-31 12:12:03 +0000
+++ qp_plugins/menu_link_widget/_menu_link.widget.php 2011-01-08 03:34:54 +0000
@@ -51,7 +51,8 @@
51 'catdir' => $this->T_('Category directory'),51 'catdir' => $this->T_('Category directory'),
52 'latestcomments' => $this->T_('Latest comments'),52 'latestcomments' => $this->T_('Latest comments'),
53 'ownercontact' => $this->T_('Blog owner contact form'),53 'ownercontact' => $this->T_('Blog owner contact form'),
54 'login' => $this->T_('Log in form')54 'login' => $this->T_('Log in form'),
55 'register' => $this->T_('Registration form')
55 );56 );
56 }57 }
5758
@@ -158,6 +159,15 @@
158 $title = $this->T_('login (if you have an account)');159 $title = $this->T_('login (if you have an account)');
159 break;160 break;
160161
162 case 'register':
163 if( is_logged_in() ) return false;
164 global $Settings;
165 if( ! $Settings->get( 'newusers_canregister' ) ) return false;
166 $url = get_register_url();
167 $text = $this->T_('Register');
168 $title = $this->T_('register on this website');
169 break;
170
161 case 'home':171 case 'home':
162 default:172 default:
163 $url = $Blog->get('url');173 $url = $Blog->get('url');

Subscribers

People subscribed via source and target branches