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 7549509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:57:43+00:00 2026-05-30T09:57:43+00:00

I’m trying to make my custom filter work… I have the following code in

  • 0

I’m trying to make my custom filter work…

I have the following code in my AuthController:

<?php
public function loginAction()
{
    // Get db var
    $db = $this->_getParam('db');

    // Load loginform
    $loginForm = new Application_Form_Auth_Login();

    // Form posted?
    if ($loginForm->isValid($_POST))
    {
        // Setup adapter
        $adapter = new Zend_Auth_Adapter_DbTable(
          $db,
          'users',
          'username',
          'password'
          );

        // Set identity and credential
        $adapter->setIdentity($loginForm->getValue('username'));
        $adapter->setCredential($loginForm->getValue('password'));

        // Setup Zend_Auth and try to authenticate the user
        $auth = Zend_Auth::getInstance();
        $result = $auth->authenticate($adapter);

        // If authentication succeed
        if ($result->isValid())
        {
            $this->_helper->FlashMessenger('Inloggen geslaagd');
            $this->_redirect('/');
            return;
        }
        else
        {
            $this->_helper->FlashMessenger('Inloggen geslaagd');
        }
    }

    $this->view->loginForm = $loginForm;
}
?>

The code of the form is:

<?php
class Application_Form_Auth_Login extends Zend_Form
{
  /**
   * Default_Form_Auth_Login::init()
   * 
   * Form which authenticates guests
   * 
   * @return void
   */
  public function init()
  {    
    $this->setMethod('post');    

    $this->addElement('text', 'username', array(
        'label' => 'Gebruikersnaam:',
        'required' => true,
        'filters' => array('StringTrim'),
      ));

    $this->addElement('password', 'password', array(
      'label' => 'Wachtwoord:',
      'required' => true,
      'filters' => array('Pcw_Filter_Hash')
      ));

    $this->addElement('hash', 'formToken', array(
      'salt' => 'unique'
      ));

    $this->addElement('submit', 'submit', array(
      'ignore' => true,
      'label' => 'Inloggen',
      )); 

  }  
}

The code of my custom filter is:

<?php

class Pcw_Filter_Hash implements Zend_Filter_interface
{
  /**
   * HashFilter::filter()
   * 
   * @param string $value
   * @return
   */
  public function filter($value)
  {
    return hash('sha512', $value);
  }  
}

When using it this way I keep getting this message:
Message: Plugin by name ‘Pcw_Filter_Hash’ was not found in the registry; used paths: Zend_Filter_: Zend/Filter/

I have found documentation about setting namespaces and adding paths but I can’t get anything to work…

Does anyone has a working solution for my problem? This will be highly apprectiated!

Thanks in advance!

  • 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-05-30T09:57:44+00:00Added an answer on May 30, 2026 at 9:57 am

    I would rather rewrite you form elements like this one :

    $password = new Zend_Form_Element_Password("password");
    $password->setLabel("Wachtwoord")
             ->setRequired(true); 
    
    $password->addFilter(new  Pcw_Filter_Hash() );
    

    but I am not sure this might work :

    $this->addElement('password', 'password', array(
          'label' => 'Wachtwoord:',
          'required' => true,
          'filters' => array(new Pcw_Filter_Hash())
          ));
    

    and you should double check that Pcw is defined in application.ini

    I hope your problem get solved soon 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.