Skip to Content Skip to Menu

How to show username when registrate with invite code

  • camdri
  • camdri
  • OFFLINE
  • Posts: 35
  • Thanks: 0
  • Karma: 0
9 years 5 months ago #264057 by camdri
Sorry to bring it up again, but was thinking to set a trigger on _comprofiler table BEFORE/AFTER inserting a new record. I guess it should be something like:

CREATE TRIGGER `invite`
BEFORE INSERT ON `rv6fj_comprofiler`
FOR EACH ROW set NEW.cb_sponsor = (SELECT NAME FROM INVITE_CODES WHERE code = NEW.invite_code)

Could something like this be done? BEFORE or AFTER INSERT?

Thanks for your incredible never ending support!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264070 by krileon
The only way this will work is if you create a fieldtype plugin that pulls the invite id from GET like CB Invites does then queries for the username based off the invite code (by joining the invites table and the users table).

The query provided on the first page of this topic will work after a user has registered so there's no need to hard code the users name into their _comprofiler row, but it's not going to work at registration like you're wanting because the user object is completely empty so there is no invite code.

The invite email already identifies who sent the invite so I'm not sure why you're going through so much trouble to have this. The easiest way to go about it would be to just modify CB Invites and its field to fit your needs.


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.

  • camdri
  • camdri
  • OFFLINE
  • Posts: 35
  • Thanks: 0
  • Karma: 0
9 years 5 months ago #264072 by camdri
Hi Kyle,

Thanks for your response! Reason for me is that my customers can invite other people to join our community. Since I want to be sure that they don't enter a wrong "member" name, I just thought it might be useful to populate it automatically (afterwards).

No problem for me that Field cb_sponsor will be filled after posting the registration form.
Question is which option is the safest / quickest one:
- do something on the server table (AFTER INSERT or TRANSACTION)
- use CB Auto Action (if possible, but I guess not), or
- Modify CB Invites (which is not my strong poitn, but trial and error will get me somewhere).

What do you think?

Thanks a lot for your support!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264075 by krileon
There's no reason to store the name. Use a CB Query Field with the query provided below.

www.joomlapolis.com/forum/153-professional-member-support/229438-how-to-show-username-when-registrate-with-invite-code?limitstart=0#262960

Replace u.`username` with u.`name` for name.


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.

  • camdri
  • camdri
  • OFFLINE
  • Posts: 35
  • Thanks: 0
  • Karma: 0
9 years 5 months ago #264078 by camdri
Eventually it should be stored in the database because the managers must see in the profile who the sponsor is...

Shall try if this works in the Profile View...

Thanks.

By the way is MySQL Field Plugin also available for the Professional?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264083 by krileon
It doesn't need to be stored for that. CB Query Field will take the users invite code, query it against the database, find out who sent the invite by matching the user id, and display their name (or username, etc..). This works everywhere except registration.

By the way is MySQL Field Plugin also available for the Professional?

Yes, it's available for download in the Professional downloads section as "CB Query Field".


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