Feature Requests

Got an idea for a new feature or integration? We’d love to hear it! You can find our roadmap here.

2 votes

Integrate Tags with GravityWiz Populate Anything

Business Use Case: I need to load fields, values, radio buttons, checklists, based on users that have TAG X, and I need to load a unique list of tags, and I need to load a single users' tags (based on current user id). GravityWiz has a perk called Populate Anything that can read data from: database (table or view), GravityForm entry, and GravityFlow step, and User. I will be building a complex form based on values brought back by the user tag – (enable and disable fields, hide and show sections of the form).

Unfortunately Populate Anything has no method for calling a PHP function to get the users tags.

Note: a "view" like this can be used in Ninja Tables, wpDataTables, Charts and Graphs (there are a ton of other plugins that can consume view & database output – but cannot call php functions).

There is a simple solution: wpFusion (on install or update) issues: CREATE OR REPLACE VIEW to the database (just like table structures).

Purpose of the view: Split a PHP serialized array in to rows (each tag on one row) with a user_id. The view code is below:

create view vw_wpFusion_getUserTags as
replace(j.name,'\"','') as wpFusion_Tag
FROM wp_usermeta as wp
left outer join JSON_TABLE(
REGEXP_REPLACE(meta_value,'[a-z]:[0-9]+;*', '') — remove array notations
, ';:', ',') — replace array separators with Comma (csv list)
, '(:{:|;})', '') — replace array start and array end with empty string
) — turn into a JSON ARRAY object
,',', '", "') — replace single quotes with double quote and comma (for JSON_TABLE)
, '$[*]' columns (name text path '$') — turn JSON_ARRAY > JSON_TABLE (rows)
) as j
on 1=1 — always true, always join on JSON_TABLE row by row
where meta_key ='_tags';

EXAMPLE INPUT: meta_value = 'a:26:{i:0;s:6:"import";i:1;s:17:"Newsletter:Signup";i:2;s:30:"AweberListName: hdp1-buyer";i:3;s:15:"Imported:Aweber";}';

Example OUTPUT (from view):
user_id wpFusion_tag
1 import
1 Newsletter:Signup
1 AweberListName: hdp1-buyer
1 Imported:Aweber

Hope this helps,

Under Review Category: Plugin Integration Enhancements Dan Linstedt shared this idea Updated: July 19, 2023

Leave a Comment

Your email address will not be published. Required fields are marked *

Powered by Simple feature Requests