Example #1
0
 /**
  * @covers ::bbp_get_user_subscriptions
  * @expectedDeprecated bbp_get_user_subscriptions
  */
 public function test_bbp_get_user_subscriptions()
 {
     $u = $this->factory->user->create();
     $t = $this->factory->topic->create_many(3);
     // Add topic subscriptions.
     bbp_add_user_topic_subscription($u, $t[0]);
     bbp_add_user_topic_subscription($u, $t[1]);
     bbp_add_user_topic_subscription($u, $t[2]);
     $expected = bbp_has_topics(array('post__in' => array($t[0], $t[1], $t[2])));
     $subscriptions = bbp_get_user_subscriptions($u);
     $this->assertEquals($expected, $subscriptions);
     // Remove topic subscription.
     bbp_remove_user_topic_subscription($u, $t[1]);
     $expected = bbp_has_topics(array('post__in' => array($t[0], $t[2])));
     $subscriptions = bbp_get_user_subscriptions($u);
     $this->assertEquals($expected, $subscriptions);
 }
if (bbp_is_subscriptions_active()) {
    ?>

		<?php 
    if (bbp_is_user_home() || current_user_can('edit_users')) {
        ?>

			<div id="bbp-user-subscriptions" class="bbp-user-subscriptions">
				<h2 class="entry-title"><?php 
        _e('Subscribed Forum Topics', 'bbpress');
        ?>
</h2>
				<div class="bbp-user-section">

					<?php 
        if (bbp_get_user_subscriptions()) {
            ?>

						<?php 
            bbp_get_template_part('loop', 'topics');
            ?>

						<?php 
            bbp_get_template_part('pagination', 'topics');
            ?>

					<?php 
        } else {
            ?>

						<p><?php