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
1=== modified file 'qp_inc/users/model/_user.funcs.php'
2--- qp_inc/users/model/_user.funcs.php 2010-12-31 12:12:03 +0000
3+++ qp_inc/users/model/_user.funcs.php 2011-01-08 03:34:54 +0000
4@@ -122,6 +122,22 @@
5 return $srvc_url_sensitive.'login.php'.$redirect;
6 }
7
8+
9+/**
10+ * Get url to login
11+ *
12+ * @return string
13+ */
14+function get_register_url()
15+{
16+ global $srvc_url_sensitive;
17+
18+ $redirect = '?redirect_to='.rawurlencode( url_rel_to_same_host(
19+ regenerate_url( '', '', '', '&' ), $srvc_url_sensitive ) );
20+ return $srvc_url_sensitive.'register.php'.$redirect;
21+}
22+
23+
24 /**
25 * Template tag: Output a link to new user registration
26 * @param string
27
28=== modified file 'qp_plugins/menu_link_widget/_menu_link.widget.php'
29--- qp_plugins/menu_link_widget/_menu_link.widget.php 2010-12-31 12:12:03 +0000
30+++ qp_plugins/menu_link_widget/_menu_link.widget.php 2011-01-08 03:34:54 +0000
31@@ -51,7 +51,8 @@
32 'catdir' => $this->T_('Category directory'),
33 'latestcomments' => $this->T_('Latest comments'),
34 'ownercontact' => $this->T_('Blog owner contact form'),
35- 'login' => $this->T_('Log in form')
36+ 'login' => $this->T_('Log in form'),
37+ 'register' => $this->T_('Registration form')
38 );
39 }
40
41@@ -158,6 +159,15 @@
42 $title = $this->T_('login (if you have an account)');
43 break;
44
45+ case 'register':
46+ if( is_logged_in() ) return false;
47+ global $Settings;
48+ if( ! $Settings->get( 'newusers_canregister' ) ) return false;
49+ $url = get_register_url();
50+ $text = $this->T_('Register');
51+ $title = $this->T_('register on this website');
52+ break;
53+
54 case 'home':
55 default:
56 $url = $Blog->get('url');

Subscribers

People subscribed via source and target branches