Auto Action to SQL Update Kunena Table Field

6 years 11 months ago - 6 years 11 months ago #293414 by highonryan
I have a question about Auto Action updating a field on a Kunena table.

I have a Check Box (Single) CB Field for agreeing to be listed on a registry. If on the registry, an icon displays on their Kinena side profile, beside the post.

I have created a Kunena template that will pull information from the #_kunena_users table, and the $personalText field in particular for the side profile. So if the $personalText field is NULL, nothing shows, but if there is a value then the template places an icon on their side profile that links to their CB Profile. I got that working, no problem.

Now in CB, I have the Check Box (Single) CB Field for the registry is set to 0 by default, and if they agree to be listed on the registry, they click the checkbox, when they update their CB profile, and database value becomes 1. They can only opt-into the registry after they have registered, by updating their profile.

I have tried to create an Auto Action to update the #_kunena_users $personalText field to update to their user_id, or joomla username, from CB once the profile is saved. But it's not working.

Here are my Auto Action settings:

Global
Triggers: OnAfterUserProfileSaved
Type: Query
User: Automatic
Access: Everybody

Conditions
cb_member_registry Equal To 1 [optional input substitution set to YES]

Action
Query: UPDATE `#_kunena_users` SET `personalText ` = '[user_id]' WHERE `userid` = '[user_id]'
Mode: Internal

Parameters
Reload User: Yes
Rest is Default settings

Can someone help me what I am doing wrong.

Thanks
HighOnRyan

Please Log in to join the conversation.

6 years 11 months ago #293417 by krileon
Replied by krileon on topic Auto Action to SQL Update Kunena Table Field
You can override the sidebar in Kunena with your own substitution supported sidebar within CB Forums. Basically you wouldn't have to use a auto actions at all. Within CB Forums click Parameters > Forums and ensure "Model" is set to "Kunena 3.x". Next click the Sidebar tab just below that parameter. From there you can supply your own customized substitution supported sidebar. Example as follows.

<ul class="unstyled center profilebox">
	<li><strong><a class="kwho-admin" href="[cb:url location="profile_view" /]" rel="nofollow">[cb:userfield field="formatname"/]</a></strong></li>
	<li><a class="kwho-admin" href="[cb:url location="profile_view" /]" rel="nofollow">[cb:userfield field="avatar"/]</a></li>
	<li>[cb:userfield field="onlinestatus"/]</li>
	<li>[rankimage]</li>
	<li>Posts: [posts]</li>
	<li>Thanks: [thankyou]</li>
	<li>Karma: [karma] [karmaminus] [karmaplus]</li>
</ul>

You could for example have the following and condition off your checkbox field to output extra information.

<ul class="unstyled center profilebox">
	<li><strong><a class="kwho-admin" href="[cb:url location="profile_view" /]" rel="nofollow">[cb:userfield field="formatname"/]</a></strong></li>
	<li><a class="kwho-admin" href="[cb:url location="profile_view" /]" rel="nofollow">[cb:userfield field="avatar"/]</a></li>
	<li>[cb:userfield field="onlinestatus"/]</li>
	<li>[rankimage]</li>
	<li>Posts: [posts]</li>
	<li>Thanks: [thankyou]</li>
	<li>Karma: [karma] [karmaminus] [karmaplus]</li>
	[cb:if cb_member_registry="1"]<li>REGISTRY_MEMBER</li>[/cb:if]
</ul>

If you still want to use the auto action then you'd need to be sure to use the after user update trigger and your usage should work fine.


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.

6 years 11 months ago #293522 by highonryan
Replied by highonryan on topic Auto Action to SQL Update Kunena Table Field
THANK YOU SO MUCH!!!

This worked for what I needed with the registry.

My second issue with this is, I need to show a similar link just below the registry to signify that the user has a gallery.

I have CB Gallery installed. A user can edit their profile, and see a tab for Gallery, and can edit it accordingly. But this is optional, they don't have to have a gallery.

How can I show, within the forum, that the user has a gallery?

Thanks,
HighOnRyan

Please Log in to join the conversation.

6 years 11 months ago #293538 by krileon
Replied by krileon on topic Auto Action to SQL Update Kunena Table Field
You would need a way for them to turn off their gallery. Maybe a checkbox field. Then condition off of that with an IF substitution just like with cb_member_registry.


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.

6 years 11 months ago #293558 by highonryan
Replied by highonryan on topic Auto Action to SQL Update Kunena Table Field
How do I put a checkbox on the Gallery tab?

I looked into creating a field and adding it to the Gallery tab, but that tab is not an option.

I have looked under Tab Manager to see if there is some setting on the Gallery tab to allow for custom fields, but didn't see any thing.

In regards to the Registry checkbox, I placed a checkbox on a custom tab I called Registry.

Please Log in to join the conversation.

6 years 11 months ago #293583 by krileon
Replied by krileon on topic Auto Action to SQL Update Kunena Table Field

How do I put a checkbox on the Gallery tab?

You can't. Plugin tabs do not allow fields to be placed on them. You'll need to add the checkbox on a different tab.


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.

Moderators: beatnantkrileon
Time to create page: 0.221 seconds

Facebook Twitter LinkedIn