Jump to content

Announcements for logged in clients only


Atomic

Recommended Posts

Greetings,

 

I would like Announcements to be viewable by logged in clients only. Is this possible with a ClientAreaPage hook? And would anyone have code they could share? It's just that we publish some of the Announcements on our blog and I don't want duplicated content penalties.

Link to comment
Share on other sites

I would like Announcements to be viewable by logged in clients only. Is this possible with a ClientAreaPage hook? And would anyone have code they could share? It's just that we publish some of the Announcements on our blog and I don't want duplicated content penalties.

the hook code required depends on how far you want to go with this...

 

so if you just want to remove Announcements from the homepage, you can empty the array with a hook...

 

https://forum.whmcs.com/showthread.php?127990-Remove-Announcements-from-home-page&p=512010#post512010

 

if you want to remove the Announcements navbar link for non-logged visitors (last hook in the post)...

 

https://forum.whmcs.com/showthread.php?113067-Change-menu-Navbar&p=458811#post458811

 

if you really want to make the announcements client only, you can redirect non-logged in visitors to the login page.... existing logged in clients will be shown the announcements page directly...

<?php

# Make Announcements Client Only Hook
# Written by brian!

function announcements_client_only_hook($vars)
{
   $client = Menu::context('client'); 

   if (!$client) {
       header("Location: login.php");
       exit;
   }
}
add_hook("ClientAreaPageAnnouncements", 1, "announcements_client_only_hook");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated