The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Individual/custom News messages in specific cPanels

Discussion in 'User Experience' started by jols, Feb 12, 2014.

  1. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    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.
     
  2. iakela

    iakela Member

    Joined:
    Oct 18, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  3. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    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.
     
  4. iakela

    iakela Member

    Joined:
    Oct 18, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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 :)
     
  5. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    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? :)
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Thank you for updating us with the solution that you have implemented. Feel free to keep us updated on the outcome.
     
  7. iakela

    iakela Member

    Joined:
    Oct 18, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    You are welcome! The code is pretty raw, but I guess you can start from that.
     
Loading...

Share This Page