Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Request: Posts since last visit


davidbessler
Member

@davidbessler

Problem: With forum restriction, I use the following code to filter topics with the default views:

function forum_restriction_list_of_allowed_forums($user) {

global $forum_restriction_allowed_in_forum,$bb_current_user;

foreach ($forum_restriction_allowed_in_forum as $forum_number => $forum_memberlist){

if (ereg(get_user_name($user),$forum_memberlist) || $forum_memberlist ==''){

$list_of_allowed_forums .= "'".$forum_number."',";

}

}

$list_of_allowed_forums = rtrim($list_of_allowed_forums,",");

return $list_of_allowed_forums;

}

// FILTER TOPICS

function forum_restriction_get_latest_topics_where( $where ) {

if (bb_is_user_logged_in()) {

global $bb_current_user;

$list_of_allowed_forums = forum_restriction_list_of_allowed_forums($bb_current_user->ID);

$where .= " AND forum_id IN ($list_of_allowed_forums) ";

echo "where is set to: $where";

return $where;

} else {

return $where;

}

}

add_filter ( 'get_latest_topics_where', 'forum_restriction_get_latest_topics_where' );

The problem is this doesn’t work with bb_custom_views used by since-last-visit.php. It seems the plugin changes the $where AFTER forum-restriction has already tried to filter the $where.

How do I get forum_restriction_get_latest_topic_where to add ” AND forum_id IN ($list_of_allowed_forums) ” to $where AFTER since-last-post sets $where?

Kapish?

Skip to toolbar