i want to listen for 'SIGNUP_USER_ADDED" from amember available events.. i wrote custom plugin..shown in API/Hooks Manager.. like this.. class MyPlugin extends Am_Plugin { function onSIGNUP_USER_ADDED(Am_Event $event) { $event->addReturn($event->getX() + 1); } } Two part question: 1. How do i get User object from Am_Event.. i am interested in getting username.. 2. once i have Username.. how can i call other website on same domain like xxx.com?username=?????
Hi, First of all this will not work because function name is not correct. You should use: onSignupUserAdded(Am_Event $event) 1. $user = $event->getUser(); 2. You should use Am_HttpRequest to make http requestrs from aMember: PHP: $r = Am_HttpRequest('http://www.url.com/');$r->send();
I am still having issue with this. I created the plugin below: PHP: <?phpclass Am_Plugin_ivpmake extends Am_Plugin{ function onSignupUserAdded(Am_Event $event) { $user = $event->getUser(); $r = Am_HttpRequest('http://dev.ivestplus.com/investage/userSignup.form'); $r->send(); }}?> When I sign up, I am getting this error message: Fatal error: Call to undefined function Am_HttpRequest() in /var/www/amember/application/default/plugins/misc/ivpmake.php on line 7 Any help would be greatly appreciated.
Made some headway. using "new" prior to "Am_HttpRequest" worked to hitting the outside server. However, I am not getting the user name. Any ideas how to get user name to show at end of url?
Something like this PHP: $user = $event->getUser();$params = array( 'username' => $user->login, 'name_f' => $user->name_f, 'email' => $user->email,);$url .= 'http://dev.ivestplus.com/investage/userSignup.form?' . http_build_query($params);$r = new Am_HttpRequest($url);$response = $r->send();// $response->getStatus(); $response->getBody();
Useful info: http://pear.php.net/manual/en/package.http.http-request2.request.php http://pear.php.net/manual/en/package.http.http-request2.response.php
Resolved: Thanks again for awesome support. I am including what worked for me in case it helps anyone else. PHP: <?phpclass Am_Plugin_ivpmake extends Am_Plugin{ function onSignupUserAdded(Am_Event $event) { $user = $event->getUser(); $username = $user->login; $r = new Am_HttpRequest('http://www.myurl.com/platform/userSignup.form?username=' . $username); $r->send(); }}?>