-
Posts
284 -
Joined
-
Last visited
Posts posted by gutterboy
-
-
When I clicked the log out button OR was redirected to the log out page via logging out on our main system is when that error showed.
Full error:
Files does not exist: D:\Website_Needs\CodeBase\Gimko_V2\billing\app\views\client\bootstrap\client_logout.pdt on line 120 in D:\Website_Needs\CodeBase\Gimko_V2\billing\lib\view.php Printing Stack Trace: #0 D:\Website_Needs\CodeBase\Gimko_V2\billing\lib\controller.php(277): View->fetch('client_logout', NULL) #1 D:\Website_Needs\CodeBase\Gimko_V2\billing\lib\dispatcher.php(128): Controller->render() #2 D:\Website_Needs\CodeBase\Gimko_V2\billing\index.php(21): Dispatcher::dispatch('/gimko_v2/billi...') #3 {main}
-
Any idea why when I change my method name to something else such as "redirect" I get a file doesn't exist error?
ie;
Change this:
public function getEvents() { return array( array( 'event' => "Users.logout", 'callback' => array("this", "run") ) // Add multiple events here ); } public function run($event) { // code here }
To this..
public function getEvents() { return array( array( 'event' => "Users.logout", 'callback' => array("this", "redirect") ) // Add multiple events here ); } public function redirect($event) { // code here }
Basically an error stating a file doesn't exist which comes from line: 120 of lib/view.php
-
Only a plugin can react to events (this is dictated by the components/events/default/* files) but if you're wanting to call the redirect function from any file I think it should be in a component while the plugin handles the event, loads the component and performs the redirect. I don't think there are any docs on components, just look at a simple one like components/json. It's pretty much just a standard class.
Hmmm ok. Well I guess that leaves me with my initial problem then haha......... guess I'll have to include a config file or something.
-
Is there any docs on creating components? Can I run similar code in there that will trigger on the user logout event?
-
I haven't looked at the plugin architecture in Blesta but I don't think they are designed to be called manually. I think it would be better suited for a component, which would be called like this:
Loader::loadComponents($this, array("MyComponent")); $this->MyComponent->redirect($url);
You may want to look at the built in redirect function Controller::redirect() in lib/controller.php
Alright - thanks for your help!
-
Yeah, don't want to edit the core files or anything - just trying to figure out how this stuff is usually done.
For example this is my plugin handler code:
class LogoutRedirectPlugin extends Plugin { public $url; public function __construct() { $this->loadConfig(dirname(__FILE__) . DS . "config.json"); } public function getEvents() { return array( array( 'event' => "Users.logout", 'callback' => array("this", "run") ) // Add multiple events here ); } public function run($event) { header('Location: http://localhost/gimko_v2/'); } }
If I was doing it normally I would just do something like this:
$logout = new LogoutRedirectPlugin(); $logout->url = 'http://www.mydomain.com/';
OR...
$logout = new LogoutRedirectPlugin('http://www.mydomain.com/');
...and then set it in the constructor.
-
I just made my very first plugin (very very simple at that haha) and it's basically a plugin that redirects the user after they logout. However I would like to be able to set a member variable for this action so I can pass in the URL I want to redirect to; I can do it via including a config file but I thought updating the member variable would be a better way.
How can I pass in a URL I want it to redirect to such as by setting the value of a member variable or even via a parameter that is passed to a constructor?
Thanks!
-
I think it's some kind of problem with the naming convention with this as I changed the plugin name and had no install issues like this.
-
I ended up commenting out the redirect in that file and then making a very simple plugin that triggers the redirect after the logout event.
-
wich name has the folder plugin ?
can you lis the structure files name's ?
Inside the plugins folder it goes like this..
my_plugin/ controllers/ models/ views/ default/ config.json my_plugin_controller.php my_plugin_model.php my_plugin_plugin.php
-
you should run setSessionCookie with api command .....
Ok thanks!
-
I am having a similar problem to this thread: http://www.blesta.com/forums/index.php?/topic/3077-failing-to-make-a-simple-plugin-a-existing-pluginhandler-not-found/
I followed the documentation but I get the same errors as in that thread.
My file is called "my_plugin_plugin.php" and the class is called "MyPluginPlugin".
Why is it then looking for "MyPlugin"?
-
you need to use setSessionCookie function
setSessionCookie( string $path = "", string $domain = "", boolean $secure = false )
then you can get a shared $_SESSION .
you need to set
$_SESSION['blesta_id'] = $user->id;
$_SESSION['blesta_client_id'] = $client->id;
after the logout destory the session .
Hmmmm..... I'd prefer to do it another way, but if I chose to do it that way where would I put that code? You mean in our main system?
-
I was referring to an ajax get request. If you want to do a redirect then modify this line in app/controllers/client_logout.php
$this->redirect($this->base_uri . "login");
Hmmm ok, had a look at this. Pretty new to working with the blesta code myself, is there a way I can extend this or something so I can change it so I can pass in a redirect url or something? Because it will vary depending on the environment (dev/test/prod).
-
I was referring to an ajax get request. If you want to do a redirect then modify this line in app/controllers/client_logout.php
$this->redirect($this->base_uri . "login");
Oh ok - thanks!
-
If you can't get the user to make a get request and you need it to be seamless then you could get Blesta to redirect users to your main page after logging out. So there will be two redirects upon logging out of your main site.
Well I'm sure I can redirect the user via a GET request to the blesta log out, but not sure how to get blesta to do a redirect after logging them out?
-
I think that just as you redirect the client to a login url (or make a get request), you would do the same but use the logout url.
If I just redirected them to the logout URL then that's where they would end; I need the process to be seamless so they end up back on the main page of the site - which is where they are sent now when they log out.
-
It doesn't look like this method is designed to be called via the API. You would need to instantiate a Session object and select the users session using their session ID, which will be stored in a cookie on the users computer. You could search through the session data on the DB for the client id but it would be messy.
Thanks for the reply.
Basically what I am doing is I am using the shared login plugin cody made to log the user into Blesta at the same time as they log into our main site, so when they log out of our main site I want to log them out of Blesta as well.
-
I noticed there is a user::logout method and according to the docs it requires the users "session" to be passed in; my question is how do I get this information for the user to pass to the user::logout method?
Thanks!
-
Ok, seems that was because I was sending it to plugins and not plugin; however I fixed that but now I get a blank page when I am redirected to the blesta URL.
Nvm...... seems it was because the user was using their email as the login and not the username. All fixed now.
-
I just tried this out with the redirect option and when I got redirected to the blesta url login page all it showed me was the directory contents of the folder for that plugin. I followed the docs as per: http://docs.blesta.com/display/user/Shared+Login
Ok, seems that was because I was sending it to plugins and not plugin; however I fixed that but now I get a blank page when I am redirected to the blesta URL.
-
I just tried this out with the redirect option and when I got redirected to the blesta url login page all it showed me was the directory contents of the folder for that plugin. I followed the docs as per: http://docs.blesta.com/display/user/Shared+Login
-
You can edit a client via Clients::edit, but most information related to a client (e.g. first name, email, address, etc.) belongs to the primary contact. Each client has a contact (i.e. contact type is 'primary'), but it's also possible to add additional contacts under each client.
Ahh ok, makes sense. Thanks!
-
I'm not sure why you receive an SQL error, but I see the values you're setting for Clients::edit aren't supported by that API call. Sounds like you want Contacts::edit.
Hmmm ok. So a client I created with clients::create I need to use contacts::edit and NOT clients::edit to edit their details?
Are Transactions Created On All Payments Made?
in Support
Posted
I'm just wondering are transactions created for ANY payments the user makes or payments recorded or made via admin as well? ...even if the payment is partial? What if it isn't attached to an invoice?
Thanks!