Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Usergroups Field for Community Builder

  • bradwmson
  • bradwmson
  • OFFLINE
  • Posts: 10
  • Thanks: 4
  • Karma: 1
1 year 2 months ago #335305 by bradwmson
Usergroups Field for Community Builder was created by bradwmson
In the process moving from a CB based sited from Joomla 3.11 to 4.3.4 with Community Builder 2.8.2.

A necessary field is used for displaying and/or changing the assigned user group, and under 3.11 it used the Usergroups field plugin from Open Tools. 

Open Tools has ceased development of the Usergroups Field which does not work under PHP 8.0 and greater.

Looking for alternate solutions, or a hired developer that can upgrade the code in the existing plugin that R. Kainhofer has generously made available on the Open Tools site.

Open to all recommendations. 

Thanks,

Brad

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
1 year 2 months ago #335309 by krileon
Replied by krileon on topic Usergroups Field for Community Builder
You should be able to change usergroup from backend freely. That's not normally something I'd recommend to allow on frontend, but it's doable combining a select fieldtype with a usergroup auto action (would require 1 auto action per select option).


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.

  • bradwmson
  • bradwmson
  • OFFLINE
  • Posts: 10
  • Thanks: 4
  • Karma: 1
1 year 2 months ago #335356 by bradwmson
Replied by bradwmson on topic Usergroups Field for Community Builder
Thanks for the quick reply - I don't really need to change the usergroup from the front end, simply display it.
I suspect I can use the code field to get the related usergroup for each user in a list and display the field, or use a text field that is updated by auto action when the profile is created or modified.
I'll have to explore it.
Thanks!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
1 year 2 months ago #335357 by krileon
Replied by krileon on topic Usergroups Field for Community Builder
Ah, ok you've a couple of options then. You could use a CB Query Field and query for that information in the database. You could use a CB Code Field and use PHP with Joomla API to get their usergroups to display them. Or the easiest is to just use substitutions. Example as follows.

[cb:if usergroup includes "2"]I have Registered Usergroup[/cb:if]

You'd need to have 1 IF substitution per usergroup you want displayed. You can use this in a Custom HTML field so you can have it display however you like. Simply replace the 2 with whatever ID your usergroup has.


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.
The following user(s) said Thank You: PaceOnline

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

  • bradwmson
  • bradwmson
  • OFFLINE
  • Posts: 10
  • Thanks: 4
  • Karma: 1
1 year 2 months ago - 1 year 2 months ago #335604 by bradwmson
Replied by bradwmson on topic Usergroups Field for Community Builder
Success! Thanks for the help.

Solution using the CB Query field posted for others wrestling with displaying the usergroup in profiles and lists. Substitute your database prefix for cms.
Code:
SELECT cms_usergroups.title FROM (((cms_users INNER JOIN cms_user_usergroup_map ON cms_users.id = cms_user_usergroup_map.user_id) INNER JOIN cms_usergroups ON cms_user_usergroup_map.group_id = cms_usergroups.id) INNER JOIN cms_comprofiler ON cms_users.id = cms_comprofiler.user_id) WHERE cms_users.id = [cb:userdata field="user_id" user="#displayed" /];

Worked through many permutations before finding a query that worked as expected. Is there a reference for cb substitutions beyond the "Using Substitutions throughout CB". I clearly need to improve my working knowledge of CB.

Thanks again!
 
Last edit: 1 year 2 months ago by bradwmson.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum