• Hi, love your plugin thanks so much for the hard work you’ve invested, it’s a great plugin.

    I would like to customize one aspect… how could I display the sitewide notification banner only when there is an unread Announcement for the logged-in user, not when there are unread messages for that user?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter billw16

    (@billw16)

    Also, how can I access the content of unread announcements for the current user (to load in a $var in order to be displayed in a custom banner, for example)?

    Plugin Author Shamim Hasan

    (@shamim51)

    You can use fep_header_notification filter hook to change header notification.
    You can use fep_get_user_announcement_count( 'unread' ) function to get unread announcement count.

    Thread Starter billw16

    (@billw16)

    Ok Great, thanks.

    I decided just to use simple html to add a notification in the header above the sidebar to show Message & Announcement counts only when there are any unread, and a scrolling banner across the top of the site when there is an unread announcement. In case anyone else wanted something like this, here’s the code I used…

    In header.php:

    <!-- Position this code to show the scrolling banner in the desired location of the header -->
    <?php 
      unset ($new_msg);
      unset ($new_ann);
      $new_msg = fep_get_new_message_number(); 
      $new_ann = fep_get_new_announcement_number();
    ?>				
    <?php if ($new_ann != 0): 
      if ($new_ann == 1){
        $s="There is an important new site announcement";
      } else {
        $s="There are " . $new_ann . " important new site announcements";
      }	
      $s = $s . " - please click here to read now...";
      ?>
      <a itemprop="url" href="<?php echo esc_url( home_url() . "/private-messages/?fepaction=announcements"); ?>" class="announce">
      <marquee behavior="scroll" direction="left"><b><?php echo $s; ?></b></marquee>
      </a>
    <?php endif; ?>	
    
    <!-- Position code to show # of unread messages/announcements in the desired location -->
    <div style="text-align:right">
      <?php if ($new_msg + $new_ann != 0): ?>
        <a itemprop="url" href="<?php echo esc_url( home_url() . "/private-messages/?fepaction=messagebox"); ?>" class="notice">
        <b>Unread Messages: </a><?php echo $new_msg; ?></b>
        <?php if ($new_ann != 0): ?>
          &nbsp;&nbsp;<a itemprop="url" href="<?php echo esc_url( home_url() . "/private-messages/?fepaction=announcements"); ?>"class="notice">
          <b>TEST_Site Announcements: </a><?php echo $new_ann; ?></b>
        <?php endif; ?>
      <?php endif; ?>
    </div>
    

    Added classes to Style.css:

    a.notice {
      color: red;
    }
    a.notice:hover {
      color: #ff6666;
      text-decoration: none;
    }
    a.announce {
      color: blue;
    }
    a.announce:hover {
      color: #8383af;
    }
    Plugin Author Shamim Hasan

    (@shamim51)

    you can change <?php echo esc_url( home_url() . "/private-messages/?fepaction=announcements"); ?> to <?php echo fep_query_url( "announcements" ); ?> so that you can use any page as PM page

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditionally display sitewide notification?’ is closed to new replies.