Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:41:13+00:00 2026-06-09T19:41:13+00:00

In PyroCMS, I’m using the session:messages tag to display messages to the user. This

  • 0

In PyroCMS, I’m using the session:messages tag to display messages to the user. This is working well, but I’d like to add a close button to each message which requires placing a span within each message. For example:

<div class="alert success">
  You have logged in successfully. <span class="close">X</span>
</div>

Each message is wrapped in a div, which is given a class by setting an attribute of the session:messages tag. There is no built-in way to specify the output. How can I override the messages() function in session.php, adding a new attribute to append this close button?

So far I have tried:

  1. Copying system/cms/plugins/session.php to *addons/shared_addons/plugins/session.php* and modifying the messages() function. The core function is used, rather than the new plugin as I had hoped.

  2. Copying the plugin as described above, and then changing it’s class to My_Plugin_Session extends Plugin_Session in hopes that its functions would then override the core Plugin_Session class. No luck.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:41:14+00:00Added an answer on June 9, 2026 at 7:41 pm

    It’s not possible to extend certain things that are in the core (e.g. libraries and helpers) – I think this applies to plugins too.

    In this case, if I was you (and I may well have to do this for my next project as these closable alerts are typically in Twitter Bootstrap etc.) I’d just edit /system/cms/plugins/session.php directly and add the extra <span> for the close button to the success, notice and error conditionals (‘if’ statements).

    On a typical site I can’t think of a situation where you’d ever need some alerts displayed differently to others (other than different colours depending on the outcome of course, which you can do in the CSS using the class name).

    Providing you’re using Git (you’ve cloned or forked the official PyroCMS repository and made your own branch) you’ll be absolutely fine with future updates – if in a future version the session plugin changes, any changes will just be merged into your code automatically, or if Git can’t figure it out, it’ll show you the differences and prompt you to fix it by hand.

    Note – there are a couple of other solutions for this specific problem based on the admin interface (you may have noticed the flash messages there are closable).

    You could create a partial – which can contain PHP, not just Lex tags – e.g. see /system/cms/themes/pyrocms/views/admin/partials/notices.php with something like this (edit as needed and duplicate for notice and error):

    <?php if ($this->session->flashdata('success')): ?>
    <div class="alert success">
        <?php echo $this->session->flashdata('success'); ?>
    </div>
    <?php endif; ?>
    

    PyroCMS admin actually uses liveQuery to append the close button <span> in the browser
    Source: /system/cms/modules/wysiwyg/js/wysiwyg.js:

    // Add the close link to all alert boxes
    $('.alert').livequery(function(){
        $(this).prepend('<a href="#" class="close">x</a>');
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PyroStreams on my PyroCMS-based site, which is working great, but the front-end
I have developed a PyroCMS custom module, but now I want to add WYSIWYG
I need to implement facebook connect in Pyrocms based site.The user module is working
I'm using Codeigniter/PyroCMS which uses ion_auth. I have my session stuff set for two
I've been working on a case using Pyrocms, a CI-based CMS, on my local
I want to add some more library and helpers file into Pyrocms which is
I want to list all files in a directory Using PyroCMS. Using the Files
Pyrocms is using Dwoo template engine. In Dwoo, we can make inheritance template. {extends
I would like to use PyroCMS for a golf company website. PyroCMS have very
I'm working on a web application in Codeigniter. I'd like to integrate the functionality

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.