Hi Kyle,
I suppose you could use a query field to query for their raw rank id then condition against that
I'm not sure what you mean by that. I didn't see a 'Query' option in the Field type there. Setting a query field in CB Fields?
I tested in the CB Auto Actions with this Query in the Action tab and setting with
Plan Active Gold
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var2] Equal To A
Action:
Code:
INSERT INTO #_user_usergroup_map (user_id, group_id)
SELECT userid, 10
FROM #_kunena_users
WHERE userid = [user_id] AND rank = 5;
Understanding that my
gold rank id = 5
gold usergroup id = 10
My id's have changed since my lasts post because I'm testing on a clean install, just to make sure there's nothing else interfering.
This didn't work, even when I removed the substitution field [user_id] for the actual id of the user I was testing. The query worked fine if I ran it in the phpmyadmin interface.
The other option I tried is to add another CB Action (with lower order) to run a Query before conditioning against the cb_heritage field.
Like this:
Plan Active Gold (query)
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var2] Equal To A
Action:
Code:
UPDATE #_comprofiler
INNER JOIN#_kunena_users ON #_kunena_users.userid = #_comprofiler.user_id
SET cb_heritage = '1'
WHERE #_comprofiler.user_id = [user_id] AND #_kunena_users.rank = '5';
Plan Active Gold (usergroup)
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var2] Equal To A
2: [cb_heritage] Equal To 1 (the corresponding cb_heritage field for Gold)
Action:
Enable usergroup Gold
This didn't work either. It seems that the "Query" on CB Actions is not executing for me, I don't know what I'm missing?
I can't think of anything else other than running an external cron to push the kunena rank value to the cb_heritage value.
Thank you,
Tomás
Code:
System Information of testing environment
Setting Value
PHP Built On Linux gator0.hostgator.com 3.12.65-188.ELK6.x86_64 #1 SMP Thu Oct 20 23:27:48 CDT 2016 x86_64
Database Version 5.5.51-38.2
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.29
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.6.5 Stable [ Noether ] 1-December-2016 22:46 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36