What would be the best way to start? All I want to do is write a small pease of code that I can put in a template file that will check to see if the forum user has 5 or more posts if so it will just load the page, if not it will redirect to another page. Anyone, nowhere I might start. I know I will need to do a database query and evaluate the post count then run a condition. Can you tell me the database table that holds the post count for a user? And maybe a small example?
Thank You
Hi Lonnie Ray,
We'll try to find some solution for you. I'll update this topic once I got some news for you.
Thank you very much. It has been years since I coded and forgot most everything. I can hold my own if I have a starting point. This is all I have come up with and is totally wrong. I have to do a check for the user ID and count there posts then evaluate.
<?php
$post_count = $wpdb->get_var( "
SELECT `x5_wpforo_profiles`.`posts`
FROM `x5_wpforo_profiles`
WHERE (`x5_wpforo_profiles`.`posts` >=5)
" );
if ($post_count > 5) {echo "is 5 or more";}
elseif ($post_count < 5) {echo "is not 5 or more";}
echo "<p>Post Count {$post_count} </p>";
?>
This code may helpful:
if(function_exists('wpforo_member')){
$current_member = wpforo_member( get_current_user_id() );
if( wpfval($current_member, 'posts') && $current_member['posts'] >= 5 ){
echo "is 5 or more";
}
else{
echo "is less 5";
}
}