Hi Minesh, thanks a lot for your patience and perseverance with me. 🙂 With your help I understand everytime more how flexible toolset can be finding solutions. But to be honest, I'm a little confused now..
For me on the frontent I see every time the number "1" even when inside the view are more messages..... see attached pics.
And when I wanted to replicate your shortcode method to the receiver "inbox" part like you mentioned above, I can't find the section where you give in the shortcode that it should count the messages from "outbox"?? Which parameter is connectec here to "outbox" view, "wp_kar_posts"?
--> Where can I edit the shortcode so that it counts the number for "inbox" view?
add_shortcode('get_msg_count', 'func_show_msg_count');
function func_show_msg_count($atts) {
global $wpdb;
global $current_user;
$query = "SELECT count(a.ID) FROM wp_kar_posts a, wp_kar_postmeta b WHERE (a.ID=b.post_id) AND (b.meta_key= 'wpcf-first-message-id' and b.meta_value=a.ID) and a.post_author=".$current_user->ID;
$res = $wpdb->query($query);
return $res;
}
I wish you a happy new year and thank you thousend times!! 🙂
For me on the frontent I see every time the number "1" even when inside the view are more messages..... see attached pics.
==>
As said, you will have to adjust your view to display only the message where post ID equal to the First message ID. There is no native solution available due to your custom requirement. You have to adjust the output of your view, you may use the wpv_filter_query hook to modify the view's query on fly:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
And when I wanted to replicate your shortcode method to the receiver "inbox" part like you mentioned above, I can't find the section where you give in the shortcode that it should count the messages from "outbox"?? Which parameter is connectec here to "outbox" view, "wp_kar_posts"?
--> Where can I edit the shortcode so that it counts the number for "inbox" view?
==>
You need to to build the shortcode for the inbox count on your own, if you do not know how to build, you may require to hire a pro Toolset expert as this is custom requirement and as per our support policy we do not entertain such custom code, however I try to help you by one example but we can not build customer sites, I can guide you but we can not write custom code to complete your task.
I hope this is totally understandable and you will be agree 🙂
You need to build your custom shortcode that should return the inbox count and replace on the following page with the section I marked in the following screenshot: hidden link
- hidden link