Developing Plugins - Half way there...

7 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 6, 2013   (RSS)

Hello,

I have created a simple plugin (my first!) that remembers the username and password of the user if they tick a checkbox on the cmsBuilder login screen.

The problem is that when I install this on a fresh installation of cmsBuilder the "Remember me" checkbox does not display.

The reason is that my filter is not being called from /cmsAdmin/lib/menus/login.php

For example I need to add the following code to login.php to call the filter:

<?php
if(isSet($_COOKIE['username']))
{
parse_str($_COOKIE['username']);
// Register the session
$_SESSION['username'] = $_COOKIE['username'];
$_REQUEST['username'] =$_SESSION['username'];

$_SESSION['password'] = $_COOKIE['password'];
$_REQUEST['password'] =$_SESSION['password'];

$checked='checked="checked"';
}
if(isset($_REQUEST['remember']))
{
$checked='checked="checked"';
}
?>

<?php
echo applyFilters('remember',$checked,translateString('Remember me'));
?>



Can someone please explain how I go about modifying the plugin so that login.php calls the filter automatically?

When I look at the Plugin Hook list I can see my new filter listed:
Hook Name: remember
Where it is called: {{empty}} // this is just blank
Where it is used: plugins/loginRemember/loginRemember.php


I obviously don't want to have to manually modify login.php each time I install the plugin as that kind of defeats the point of having an easy to install plugin.

Any help would be really appreciated.

Regards,
Greg

Re: [gversion] Developing Plugins - Half way there...

Hello,

Thanks for your help with this. I have updated the plugin and was wondering if you could try it out?

If it works then I will be pleased to add it as a free plugin for people to use.

Regards,
Greg
Attachments:

loginremember.zip 1K

Re: [gversion] Developing Plugins - Half way there...

Dear all,

I was wondering if anyone had tried out this plugin I am working on. I'd be grateful to hear back from anyone that can help make this work well.

Regards,

Greg

Re: [gversion] Developing Plugins - Half way there...

By gkornbluth - March 3, 2013

Hi Greg,

Sorry for the delay in replying,

Did you ever get this working?

When I tried to implement your plugin I got a Notice: Undefined variable: checked in /hsphere/local/home/gkornblu/thecmsbcookbook.com/cmsAdmin/plugins/loginRemember.php on line 30, and never had time to really work it through.

Not sure what I have to do to set up the plugin besides activating it.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gversion] Developing Plugins - Half way there...

By gversion - March 5, 2013

Hi Jerry,

I was trying to create the plugin so that you only need to "activate" it and then it adds the "Remember me" checkbox to the login page. However, I can't seem to get this working without editing some other files. It would be good to hear from the Interactive Tools guys to know if this is actually possible...

Regards,

Greg

Re: [gversion] Developing Plugins - Half way there...

By gkornbluth - March 6, 2013

Hi Greg,

I think the plugin is a great idea.

What other files do you have to edit to make the plugin work?

What fields do you have to add to which editors/viewers with what default values?

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php