May 2017
Beginner to intermediate
536 pages
14h 25m
English
Topic creation is available inside the single-forum.php custom template with basic permission check. Let's update the permission check to validate the members with a forum. Consider the updated code for permission check, as shown in the following:
<?php if(current_user_can('edit_wpwaf_topics') &&($wpwaf->forum->is_forum_member($post->ID,get_current_user_id() ) || current_user_can('manage_options') )) { ?>
We have added the is_forum_member check and the manage_options check along with the edit_wpwaf_topics check we used earlier. So, we check whether the user is a member of the given forum or an administrator. Administrators will always have access to topic creation. Now, only forum members will ...
Read now
Unlock full access