Tweaking Registrant Group Add-on

Permalink Browser Info Environment
Hi,

I'm trying to tweak the controller so it only adds users to a group if they've entered a certain code (12345):

public function on_user_add($userInfo) {
      // Get attribute
      $ak = CollectionAttributeKey::getByHandle('membership_code');
      if ( $ak == "12345") {
         $co = new Config();
         $gID = $co->get('REGISTRANT_GROUP_ID');
         if (!empty($gID)) {
            Loader::model('groups');
            $group = Group::getByID($gID);
            if (!empty($group)) { //check that group wasn't deleted
               $userInfo->getUserObject()->enterGroup($group);
            }
         }
      }


This doesn't seem to work, any ideas?

Thanks

Dave

Type: Discussion
Status: New
madesimplemedia
View Replies:

concrete5 Environment Information

# concrete5 Version
5.6.2.1

# concrete5 Packages
Country State Manager (1.0.3), Designer Content (3.1.1), eCommerce (2.8.13), Login (1.1.1), Login Redirect (1.4), Registrant Group (1.1), Sage Pay eCommerce Payment Provider (0.9.4), Tiered discount type (0.9.3), Transparent Email Obfuscation (1.0.3).

# concrete5 Overrides
blocks/right_col_intense_orange_block, blocks/homepage_listed_product_block, blocks/product_list, blocks/right_column_images_block, blocks/product, blocks/rightcol_latest_news_block, blocks/link_button_orange, blocks/latest_news_inbrief_block, blocks/artwork_formats_block, blocks/product_details_block, blocks/spacer_block, blocks/team_member_details_block, blocks/home_page_products_listing, blocks/accreditation_details_block, blocks/team_member_block, elements/profile, helpers/lists, single_pages/login.php, single_pages/cart.php, single_pages/profile, single_pages/register.php, single_pages/checkout, single_pages/members.php, themes/CraigAndParsonsTheme

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.3.28

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, ereg, exif, filter, ftp, gd, gettext, hash, iconv, imap, ionCube Loader, json, libxml, mbstring, mcrypt, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, Reflection, session, SimpleXML, soap, sockets, SPL, SQLite, sqlite3, standard, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend Guard Loader, zip, zlib.

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 32M
post_max_size - 60M
safe_mode - On
safe_mode_exec_dir - /usr/local/php/bin
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 60M
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.