[SOLVED] MYSQL Inserting New Users

14 years 5 months ago #116584 by PMGB2BSub
Replied by PMGB2BSub on topic Re:MYSQL Inserting New Users
Ok, no problem.

One question though, are there any additional tables I may need to look into aside from jos_cbsubs_subscriptions?

EX:
Joomla's architecture makes it so that new user data needs to be INSERTED into 3 seperate tables; jos_users, jos_core_acl_aro, and jos_core_acl_groups_aro_map.

Is CBSubs similar in that respect or is it pretty straight forward?

Please Log in to join the conversation.

14 years 5 months ago #116588 by PMGB2BSub
Replied by PMGB2BSub on topic Re:MYSQL Inserting New Users
[code:1]
$query = "INSERT INTO jos_cbsubs_subscriptions
(status, user_id, plan_id, subscription_date, last_renewed_date, expiry_date, ip_addresses)
VALUES
('A', '".$row->user_id."', '".$plan_id."', '".$date."', '".$date."', '".$date."', '".$ip_addr."')";
[/code:1]

Error Msg when viewing this specific user through CB User Manager:

Fatal error: Call to undefined method cbpaidProductmerchandise::remainingPriceValue()

unfortunately it's in an encyrypted file. I feel like I'm so close right now :pinch:

Please Log in to join the conversation.

14 years 5 months ago #116590 by PMGB2BSub
Replied by PMGB2BSub on topic Re:MYSQL Inserting New Users
Nevermind, i figured it out. The Plan_ID was set incorrectly. Thanks for all your help dude.

I should be able to clean up the rest.

Please Log in to join the conversation.

14 years 5 months ago #116591 by krileon
Replied by krileon on topic Re:MYSQL Inserting New Users
Sorry, I can't advise you further. We do not currently have a CBSubs API available for public release. Best I can suggest is add a users subscription as you normally would through User Management backend or CBSubs Import then observer the before/after of all the CBSubs tables.


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 to join the conversation.

14 years 5 months ago #116600 by PMGB2BSub
Replied by PMGB2BSub on topic Re:MYSQL Inserting New Users
Don't worry man, I got it working.

krileon wrote:

Sorry, I can't advise you further. We do not currently have a CBSubs API available for public release. Best I can suggest is add a users subscription as you normally would through User Management backend or CBSubs Import then observer the before/after of all the CBSubs tables.

Please Log in to join the conversation.

14 years 5 months ago #117153 by ferozsrb
Replied by ferozsrb on topic Re:MYSQL Inserting New Users
Hi Kyle,
I'm using your recommended approach for adding users.
When I try to modfify the script to add a custom field, nothing seems to happening.
Code below:
cb_addressline1 is a custom field.

function remoteUserRegister( $name, $email, $username, $addressline1 ) {
global $_CB_framework, $_CB_database;

$row = new moscomprofilerUser( $_CB_database );
$row->usertype = $_CB_framework->getCfg( 'new_usertype' );
$row->gid = $_CB_framework->acl->get_group_id( $row->usertype, 'ARO' );
$row->confirmed = 1;
$row->approved = 1;
$row->block = 0;
$row->sendEmail = 0;
$row->registerDate = date( 'Y-m-d H:i:s', $_CB_framework->now() );
$row->name = $name;
$row->username = $username;
$row->email = $email;
$row->cb_addressline1 = $addressline1;
$row->password = cbHashPassword( "money" );

if ( ! $row->store() ) {
trigger_error( 'Add User SQL error: ' . $row->getError(), E_USER_ERROR );
}
else {
echo 'success';
}

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.288 seconds

Facebook Twitter LinkedIn