Individual/custom News messages in specific cPanels

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
Does anyone know if there is a way to use a cPanel/News (like) feature that would put notices in different member's cPanels?

For example, suppose we wanted a custom message to be exhibited in the left news/message area, but just for xyz.com and for no other account.

Possible, somehow?

Thanks.
 

iakela

Member
Oct 18, 2009
17
0
51
cPanel Access Level
Root Administrator
We have wrote our own script which is reading /etc/cpbackup-userskip.conf and if username is here then he will see warning about that his backup is disabled.

This script is located at /usr/local/cpanel/Cpanel/
In the template file it should be right after:
Code:
<p><cpanel News="displaynews()"></p>
If you are changing a file from default theme, please do not forget to exclude, otherwise it would be replaced during cpanel updates.
 

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
Okay, thanks very much. I kind of get the concept.

So let's say the script placed after displaynews() would "look for" the presence of a file named .memberaccess in that account's sub-web area.

Okay, so IF found then the script would read the top most line of the .memberaccess (which would be a URL), into an href link variable. So that, when the link is clicked, it would go to that member's, member access, URL, which was listed in the .memberaccess file.

I know I am going beyond the scope of the original question, and I greatly appreciate your pointing me in the right direction.

The only thing I am a little hazy on, is how to reference the addy in the DOT file, which resides in the sub-web area of the same account. Not too sure what the path would be like from the news bar to their own sub-web. Perhaps something like:

If found
/home/$user/.memberaccess

Then...

Thanks again.
 

iakela

Member
Oct 18, 2009
17
0
51
cPanel Access Level
Root Administrator
Ok, so we have the following:

1. Create a script (e.g. /usr/local/cpanel/Cpanel/SomeModule.pm):
Code:
package Cpanel::SomeModule;
use Cpanel::AcctUtils::Owner            ();

my $user = $Cpanel::CPDATA{'USER'};
my $filename = "/home/$user/.memberaccess";

if (-e $filename) {
print <<ENDHTML;
sometext
ENDHTML
}
close DATA;
1;
2. Then connect the module to a theme ( /usr/local/cpanel/base/frontend/x3/branding/index.html ):
Code:
        <p><cpanel News="displaynews()"></p>
        </div>
        <div class="clearit">&nbsp;</div>
    </div><!-- end notices -->
to

Code:
        <p><cpanel News="displaynews()"></p>
        </div>
        <div class="clearit">&nbsp;</div>
[COLOR="#FF0000"]    <p><cpanel SomeModule></p>
[/COLOR]    </div><!-- end notices -->
Should work, I hope :)
 

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
Hey, wow, thanks iakela! If this works I am going to leave you something in my will. Would you like some cats? How about a chocolate factory, or two? :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Should work, I hope :)
Thank you for updating us with the solution that you have implemented. Feel free to keep us updated on the outcome.