Skip Navigation

[Resolved] Sending email to members that fit a user field when a post is created via CRED

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 6 years, 8 months ago.

Assigned support staff: Minesh.

Author
Posts
#400905

Hi, I want to make a lead generation site and I would like to know if those features are possible with Toolset :

- Is it possible to make a post type visible only to a specefic user type ? I think it is with Acess.

- Is it possible that when a visitor create a new post, all the users of a specefic user type are notified via email with a link to the post ?

- Is it possible on this post to hide some custom field, and make the user pay to show the fields ?

For example, visitor will create a custom post type named "project" and they will fill a custom field name "phone-number" and the user type "contractor" will have to pay to see the phone number if he finds the project interesting by clicking on a "buy now" button that will redirect to a woocommerce checkout and than to the project with all visible fields.

Thank you.

#401059

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

- Is it possible to make a post type visible only to a specefic user type ? I think it is with Acess.
=> I think yes. you should create custom role and assign role. After you set up your Users with WordPress, you can set up each user to be a certain WordPress dealt role.
=> https://toolset.com/documentation/user-guides/managing-wordpress-admin-capabilities-access/

Access lets you control what different users can do in the WordPress admin and what they can read in the front-end. You can set access rules for user types and for specific users.
https://toolset.com/documentation/user-guides/setting-access-control/

- Is it possible that when a visitor create a new post, all the users of a specefic user type are notified via email with a link to the post ?
=> To send notification to specific user types, I think you should use CRED filter "cred_notification_recipients". You should just write code that fetch the email ids of all users and then add it to recipients list.

See this reference tickets:
=> https://toolset.com/forums/topic/how-to-send-notifications-when-cred-form-submitted-to-a-group-of-subscribers/#post-198038
=> https://toolset.com/forums/topic/notification-of-author-of-a-parent-post-when-a-child-post-is-created/#post-364785

- Is it possible on this post to hide some custom field, and make the user pay to show the fields ?
=> You can display conditional html output. The complete documentation on that you can find with the following URL:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

However, to fulfill all requirements of your project, this may need custom programming with your project. Please feel free to contact our certified partners:
https://toolset.com/consultant/

#402009

Is it possible to display a list of items bought by the current user. If so, I think 'ill be able to make my project.

I would need to create a single view for a woocommerce product that do not display the secret fields.

Than, on a separate page, I would need to querry all the woocommerce products bought by the current logged in user in a list with a content template that display the secret fields.

All I need is a way to query only the products that have been purchased by the user.

#402030

Ok, i've managed to querry only the products bought via a custom shortcode (with the help of Google):

function messoumissions_shortcode() {
        $user_id = get_current_user_id();
        $current_user= wp_get_current_user();
        $customer_email = $current_user->email;
        $args = array(
            'post_type' => 'product',
            'posts_per_page' => 12
            );
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {
            while ( $loop->have_posts() ) : $loop->the_post(); $_product = get_product( $loop->post->ID );
            if (wc_customer_bought_product($customer_email, $user_id,$_product->id)){
                woocommerce_get_template_part( 'content', 'product' );
            }
            endwhile;
        } else {
            echo __( 'No products found' );
        }
        wp_reset_postdata();
}
add_shortcode('messoumissions', 'messoumissions_shortcode'); 

Now, I only need to modify this shortcode to display a view template instead of WooCommerce default template.

I know that I'll have to change this line : woocommerce_get_template_part( 'content', 'product' );
to display instead a custom view that I'll create with Views, but I'm not sure how.

#402246

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sorry - but this is a custom code and as per our support policy we do not support custom programming as it's beyond the scope of our support policy.
=> https://toolset.com/toolset-support-policy/

But - if you need custom programming for your site, please feel free to contact our certified partners.
=> https://toolset.com/consultant/

Thank you for understanding.