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

  • SEARCH
  • Home
  • 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 7851893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:17:21+00:00 2026-06-02T19:17:21+00:00

I have a filter setup that runs a function which checks if the user

  • 0

I have a filter setup that runs a function which checks if the user session is present on certain actions, like so;

<cffunction name="init">

        <cfset filters(through="checkLogin", except="login,register,signin,create,home,profile") />

    </cffunction>

The problem is, these are the action names…which conflict from other controllers I have.

For example, I have 2 controllers ‘user’ and ‘link’. Each of these has an action called create, so that my URL’s are like so:

/user/create/
/link/create/

How can the filter know with which controller to associate it with? Is there a way to prefix certain ‘actions’ in the ‘except’ clause with the controller name too?

For example, maybe something like:

<cffunction name="init">

        <cfset filters(through="checkLogin", except="user/login,user/register,user/signin,link/create,main/home,user/profile") />

    </cffunction>

I remember trying this but it didn’t work and borked.

Hope you understand what I’m saying here. I don’t want to have to name every action in separate controllers totally unique names.

Thanks,
Michael.

  • 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-02T19:17:22+00:00Added an answer on June 2, 2026 at 7:17 pm

    You can use basic inheritance to accomplish this:

    <!--- controllers/Controller.cfc --->
    <cffunction name="init">
        <cfargument name="checkLoginExcept" type="string" required="false" default="">
    
        <cfset filters(through="checkLogin", except=arguments.checkLoginExcept)>
    </cffunction>
    

    Then in any child controller (user, for example), you can specify which actions to exclude. This works well because the parent controller should really know nothing about its children. It implements what it cares about and nothing else.

    <!--- controllers/User.cfc --->
    <cffunction name="init">
        <cfset super.init(checkLoginExcept="login,register,signIn,profile")>
    </cffunction>
    

    If another child always wants for checkLogin to run, then it shouldn’t pass a value for checkLoginExcept:

    <!--- controllers/Foo.cfc --->
    <cffunction name="init">
        <cfset super.init()>
    </cffunction>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following admin setup so that I can add/edit a user and
Here's the setup. Say I have some action filter that needs an instance of
I have a setup like so on a webpage: Clicking on Add Filter adds
I have some filter and one grid.And grid have some buttons like modify/edit.I am
I have a Filter Servlet that filters request from a Servlet. I do not
I have to filter out certain elements from an array in javascript and thought
I have an ISAPI filter that I am using to do URL rewriting for
Hey guys I have a ruby on rails app with a before filter setup
i have setup a profanity filter with bad words in a XML file and
I have a hardcoded li menu that is using filterable.js to filter a list

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.