Adding a new column on 'customers' tab on Restrict Content Pro – Agree terms

I am using Restrict Content Pro and I am trying to introduce a new column to my customers table on the WordPress dashboard. I want the column to be named something like 'Agreed Terms' and for each customer it should output the result of whether that customer agreed to terms which I think is currently either 'none' or the date in which the user signed up. The agree to terms is in reference to whether the user accepts email communication and it isn't required to tick. Does anybody know how to do this? Thanks. I have managed to get to the point of actually adding the column, however, I have been unable to pull any of the content through. I have looked online at the documentation but wasn't able to find any kind of function or hook that allows me to get the result of the terms agreed. This is the code I have come up with so far function ag_rcp_customers_list_table_columns( $columns ) { $key = 'terms'; // All lowercase, no spaces. Your unique ID for your column. $name = __( 'Agree Terms', 'rcp' ); // Label to be displayed on the column header. Spaces are okay. $columns[ $key ] = $name; return $columns; } add_filter( 'rcp_customers_list_table_columns', 'ag_rcp_customers_list_table_columns' ); function ag_rcp_customers_list_table_column_company( $value, $customer ) { $terms = rcp_get_membership_meta( $customer->get_id(), 'agree-terms', true ); return $terms; } add_filter( 'rcp_customer_list_table_column_company', 'ag_rcp_customers_list_table_column_company', 10, 2 ); This code was taken from the documentation from restrict content pro but applied to memberships. I have tried to tailor it towards customers instead. documentation is here: documentation

Comment (1)

Jese Leos

12 hours ago

Verified user

Your code is almost correct but in this line $terms = rcp_get_user_meta( $customer->get_id(), 'agree-terms', true ); you have used wrong metakey correct should be only "terms" as you have mentioned in your code. Please check below corrected code. function ag_rcp_customers_list_table_columns( $columns ) { $key = 'terms'; // Unique ID for your column $name = __( 'Agree Terms', 'rcp' ); // Column header label $columns[ $key ] = $name; return $columns; } add_filter( 'rcp_customers_list_table_columns', 'ag_rcp_customers_list_table_columns' ); function ag_rcp_customers_list_table_column_terms( $value, $customer ) { $terms = rcp_get_user_meta( $customer->get_id(), 'terms', true ); if ( empty( $terms ) ) { return 'none'; } return $terms; } add_filter( 'rcp_customer_list_table_column_terms', 'ag_rcp_customers_list_table_column_terms', 10, 2 );

You’ll be in good company