Skip to Content Skip to Menu

[SOLVED] Can't seem to get the registerFunction to work

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
12 years 9 months ago - 12 years 9 months ago #186685 by sfraise
I'm trying to build a simple cb plugin to auto connect a few members onafterregistration but I can't seem to get the function to fire.

The plugin installs fine and is published, I can add a simple echo before the main class and it will output on the profile.

Here's what I have:
Code:
<?php /** * Joomla Community Builder User Plugin: plug_autoconnect * @version $Id$ * @package plug_autoconnect * @subpackage autoconnect.php * @author Spencer Fraise * @copyright (C) Spencer Fraise, www.myrecovery.com * @license Limited http://www.gnu.org/copyleft/gpl.html GNU/GPL * @final 1.0 */ /** ensure this file is being included by a parent file */ --- REMOVED FOR POSTING IN FORUM --- global $_CB_framework, $_PLUGINS; $_PLUGINS->registerFunction( 'onAfterUserRegistration', 'addConnection', 'getAutoConnectTab' ); /** * Basic tab extender. Any plugin that needs to display a tab in the user profile * needs to have such a class. Also, currently, even plugins that do not display tabs (e.g., auto-welcome plugin) * need to have such a class if they are to access plugin parameters (see $this->params statement). */ class getAutoConnectTab extends cbTabHandler { /** * Construnctor */ function getAutoConnectTab() { $this->cbTabHandler(); } /** * Test Function */ function testAlert( $user ) { global $_CB_database,$_CB_framework; echo '<script type="text/javascript">alert("Alert!!"); </script>'; } /** * Makes the connection */ function addConnection( &$user ) { global $_CB_framework, $_CB_database; echo '<script type="text/javascript">alert("Alert!!"); </script>'; $userid = $user->id; $membersince = date("Y-m-d"); $sql="INSERT INTO #__comprofiler_members (referenceid, memberid, accepted, pending, membersince) VALUES ('340', '$userid', '1', '0', '$membersince')"; $_CB_database->SetQuery($sql); $sql="INSERT INTO #__comprofiler_members (referenceid, memberid, accepted, pending, membersince) VALUES ('$userid', '340', '1', '0', '$membersince')"; $_CB_database->SetQuery($sql); return true; } } // end of autoConnectTab class ?>

Does anything pop out at you that would prevent this from working?
I've looked through a few other plugins and by looking at them it seems like this should work. I can't even get a simple alert to pop here so I must be trying to call the onAfterUserRegistration wrong or maybe I just misunderstood how this function is supposed to work. I've also tried using the onAfterUserApproval trigger as well with no luck.

I really need to put this thing to bed as soon as possible so any help is greatly appreciated.
Last edit: 12 years 9 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48437
  • Thanks: 8275
  • Karma: 1443
12 years 9 months ago #186692 by krileon
CB Welcome available for download in Advanced downloads section will let you configure auto connections after registration assuming you want everyone to auto connect to the same users.

Otherwise just use CB Auto Actions and the query action (good idea to have a Connections model and will implement for next release) to insert the rows.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
12 years 9 months ago #186718 by sfraise
The auto welcome plugin is almost perfect for what I need.
Only one small tweak I need to make, I need to bypass the confirmation for the auto connection. I have it set as new user connects to key user so they don't get the confirmation message, but I need to be able to auto confirm or bypass the confirmation for the key users so the first time the new user visits their profile the key user's wall posts will show up to them.

I can tweak this in the wall code if I need to but thought I'd see if there was a simple way to do this through cb. These key users don't need to confirm any connection requests so it doesn't have to be specific just to the auto connection.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48437
  • Thanks: 8275
  • Karma: 1443
12 years 9 months ago #186752 by krileon
Ah, I see; yeah I believe CB Auto Welcome requires confirmation of the request, but can't recall exactly. However, I've added a feature ticket to allow managing connections with CB Auto Actions as a new action so hopefully can have that released soon.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • sfraise
  • sfraise
  • OFFLINE
  • Posts: 96
  • Thanks: 14
  • Karma: 4
12 years 9 months ago #186775 by sfraise
Thanks, will keep an eye out for it.
I'll just tweak the code a bit for now to get around it.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48437
  • Thanks: 8275
  • Karma: 1443
12 years 9 months ago #186783 by krileon
Just released CB Auto Actions 2.2.0, it now has a Connection action to establish connections between users. Perhaps it can accomplish what you're wanting?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum