Extracting Specific Value from meta key

Hi,

I’m playing with dynamic content and was trying to see if I can extract a specific value from usermeta but I haven’t been able. I found another topic where the person was trying to achieve the same thing but they did not confirm if it worked. In the sample data below, I wanted to extract the arm_subscription_plan_name name which is “essential care”. I tried {{dc:user:meta key=“arm_subscription_plan_name”}} but that did not work.

Any help is appreciated!

META KEY:
arm_user_plan_8

VALUE:
a:25:{s:23:“arm_current_plan_detail”;a:14:{s:24:“arm_subscription_plan_id”;s:1:“8”;s:26:“arm_subscription_plan_name”;s:14:“Essential Care”;}

Hello @kgpthemex,

Thanks for writing to us.

To help you with your concerns we need to check your setting, I would request please share the admin login details meanwhile I would suggest you troubleshoot a few of the common issues before we investigate your settings. Please share your details in a secure note. Please provide the following details

  • WordPress Login URL
  • Admin-level username and password
  • Please share the marking screenshot of the user meta field and URL

You can find the Secure Note button at the bottom of your posts

Thanks

Thanks @prakash_s.

Please find the info attached.

Hello @kgpthemex,

I tried to find the user meta as you have mentioned but I am not able to find such a meta box. Please share that exact page URL with marking screenshot about the meta box. Please share the exact page URL where you want to display the meta box value.

Hope it helps
Thanks

Hi @prakash_s,

The issue is that the usermeta I provided earlier is directly from the database for the user (id 94) but not all information I need is contained in a specific meta box in any URL in the backend from what I can see.

For example, I can see the plan information associated with the user in the members area:

/wp-admin/admin.php?page=arm_manage_members

However, the billing cycle information (yearly) appears in the post for the plans but not in the members screen:

/wp-admin/admin.php?page=arm_manage_plans

But the cycle, plan name, and additional information does get saved in the usermeta in the string I shared earlier. The value of the meta key arm_user_plan_8 contains both arm_subscription_plan_name and cycle_name.

Hello @kgpthemex,

You will need to run a Looper Provider Dynamic Content {{dc:user:meta key="arm_user_plan_8"}} to be able to get the contents of this user plan. Use the {{dc:looper:debug_consumer}} to get the names of the fields correctly once you have set up your looper.

Hope this makes sense.

Hi @ruenel,

Thanks for chiming in. Debug_consumer was very handy but it only provided the information I already new. Here’s some of the output from debugging. How do I tap into this data? If I use {{dc:user:meta key=“arm_user_plan_8”}}, it outputs part of the data: " 1704973091,0,manual_subscription,0,0,stripe,1768089600,2,"

Is there a function within the dynamic content that targets data within a field like {{dc:user:meta key=“arm_user_plan_8.arm_subscription_plan_name”}}?

PARTIAL DEBUG INFO:
Index: 0
Current Data:
array(25) {
  ["arm_current_plan_detail"]=>
  array(14) {
    ["arm_subscription_plan_id"]=>
    string(1) "8"
    ["arm_subscription_plan_name"]=>
    string(14) "Essential Care"
    ["arm_subscription_plan_description"]=>
    string(21) "Wordpress Maintenance"
    ["arm_subscription_plan_type"]=>
    string(9) "recurring"
    ["arm_subscription_plan_options"]=>
    string(978) "a:14:{s:11:"access_type";s:6:"finite";s:12:"payment_type";s:12:"subscription";s:14:"payment_cycles";a:1:{i:0;a:7:{s:9:"cycle_key";s:4:"arm0";s:11:"cycle_label";s:6:"Yearly";

So I decided to ask ChatGPT about this issue I was having and it was familiar with Themeco and Pro and dynamic content. It expressed the following:

“Pro theme’s dynamic content system is designed to handle simple key-value pairs and may not directly support extracting nested values from serialized arrays.”

It does make sense but is it true?

Hey @kgpthemex,

You may try using {{dc:user:meta key="arm_current_plan_detail.arm_subscription_plan_name”"}}. But it is best to run a Looper Provider Dynamic Content {{dc:user:meta key="arm_user_plan_8"}} and then display the desired field using {{dc:looper:field key= "arm_subscription_plan_name"}}.

If you can send us the page URL where you are trying to display the above field, we can check it for you and correct your setup if necessary.

Thanks.

Thanks for the suggestion @ruenel

I tried it but unfortunately no luck. Something tells me serialized data is not supported. Can you confirm this?

The key portion doesn’t support dot syntax in meta values. We’ll need to get you another argument like in this “Object” section so you can format and just grab a singular key in your post meta. Since they both use key we’ll need to have a backup like _key so you can use this formatting. Have a great weekend.

Thank you for your insight @charlie.

You are most welcome, @kgpthemex.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.