Kirby Membership

Hello,
I present my first real plugin for Kirby.

Function:

  • Creating an account,
  • Sending an email (activation / reset - with HTML template),
  • Editing an account,
  • Deleting an account,
  • And connection with email address + password

No username, just the email address without the punctuation.

6 Likes

For those who are afraid of French, I translated :slight_smile: Can’t wait to test it very soon !


Allows users registration for your website

Installation

Use one of the alternatives below.

1. Clone or download

Clone or download this deposit.
Unzip the archives if necessary and rename the folder to “membership ».

Make sure the folder structure of the plugin looks like this:

site / plugins / membership /

2. Submodule Git

If you know your way around Git, you can download this plugin as submodule:

$ cd path / to / kirby
$ git submodule add https://github.com/starckio/kirby-membership site / plugins / membership

Installation

  1. Pages

Go to the Kirby panel and create a “Login” page. Once done, create a second “Account” page. Subpages will be automatically added.
use

Use
To enjoy the links, just add this code in your menu:
(
)

Config
Set the language to be used.

c :: set (‘membership.language’, ‘en’);

Changelog
0.1

Requirements
Kirby 2.3+

Warning
This plugin is provided “as is” without warranty. Use it at your own risk and always test it before use in a production environment. If you encounter problems, please create a new issue.

Licence
CC-BY-NC-SA - Creative Commons

Credits
Mailgun for the emails template.
This post on the forum that allowed the quick development of this plugin.

6 Likes

Great Plugin, very useful. Thank you.

1 Like

Hello starckio

This plugin could really help me, but I get an error when I install it.
I have followed every steps : renaming the folder to “membership”, put the folder into site/plugins/, and create the two pages with their respective names.

This is what the error says : Undefined variable: kirby in /Applications/MAMP/htdocs/membership/site/plugins/membership/membership.php on line 26

The line 26 is :

$kirby->set('role', 'admin', [
	'name'    => 'Admin',
	'panel'   => true
]);

I already have an admin account into the folder accounts so I don’t understand
Could someone reproduce this error with a basic starterkit and installing this plugin ?

@olivierjon When exactly does this error occur and what Kirby version are you using? Single-language site or multi-language site?

I can not reproduce this error


The error appears when you return to your homepage after creating the “login / account” page?

I installed it in a fresh K2.5.8 starterkit and langkit and can’t reproduce the error either.

Ok, so if anyone can reproduce it, it comes from me.
I started from a new kirby 2.5.8, and have a new error :expressionless:

Call to a member function isOpen() on boolean from this line :
<li><a<?php e($pages->find('account')->isOpen(), ' class="active"') ?> href="<?= url('account') ?>">Account</a></li>

What do you mean exactly by "Create a login template with a template login" and same this account ?

I have created two folders : 5-Login and 6-Account, inside them a .txt file with login.txt and account.txt, and in the templates folder, I did a double copy-paste of default template and renamed them account.php and login.php


You must create the pages with the panel.
Then Kirby will create the other pages.

Your final content folder structure should look like this:

The account folder has 4 subpages. If you don’t use the Panel, you can manually create these pages with there corresponding text file names.

You should not, however, create your own account/login templates , because the templates are provided and registered with the snippet.

Yes tank you both, for you screenshots and your explanations. It’s working very well now !

Just two things :

  1. In local, when I want to register, the email can’t be send (I think it’s normal
). So I tested on server, the mail is sended, but is there a way to avoid this on local ?

  2. On server, when I want to login, firefox said Firefox has detected that the server is redirecting the request for this address in a way that will not succeed. The cause of this problem may be the disabling or refusal of cookies.
    This is maybe due to my Firefox settings, I don’t allow to save history. Is there a way to avoid it too ?

Take your time, it’s just a parenthesis

The cookie is set by the Kirby user login method which is needed to store the session data.

Do you mean prevent trying to send an email when on localhost? Guess you can check if you are on localhost and either send the email or not in register.php

About the first point, forget it. I didn’t remember that we can’t send email via localhost.

About the cookies, it’s quite embarassing to not be able to enter into the login page because, this is the goal of this plugin !
I tested with Safari/Firefox/Chrome, and all browsers get an error when entering the “login” page, on server and on local.
I suspect that’s because the site is in a sub-folder, maybe due to some htaccess settings or something else


Do you see the same thing as me when you click to “login” here
https://olivierjonvaux.com/member/

I get ane error on your site as well, saying that there are too many redirects. I only tested the plugin on my localhost and there I can access the login page without any problems. Nevertheless, there seem to be some errors with snippets not getting the right variables
 but that is on another page.

Do you think the “too many redirect” problem comes from a local/server settings or from this snippets code you pointed ?

Is there similar for v3 or is someone working on a port?

I am not a developer, I just studied the documentation :slight_smile:.
I think everything is explained in the new documentation.

there is no port, but most functions required are already there.

So, should this work the same with V3?