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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:34:45+00:00 2026-06-07T04:34:45+00:00

<?php class User extends AppModel { var $name = ‘User’; var $displayField = ‘fname’;

  • 0
<?php
   class User extends AppModel {
var $name = 'User';
var $displayField = 'fname';

}

How can I only return users from this model that have a “standing” of “1”? I am not looking to do this from the controller but, from the model.

[Solution] In model

function beforeFind($queryData){
    $queryData['conditions']['standing'] = 1;
    return $queryData;
}
  • 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-07T04:34:46+00:00Added an answer on June 7, 2026 at 4:34 am

    The easiest way to do this would be to put in some filtering conditions in your beforeFind callback. Modifying the $queryData variable and adding your restriction to the conditions key should do it.

    From the manual entry – http://book.cakephp.org/1.3/en/view/1049/beforeFind

    Called before any find-related operation. The $queryData passed to
    this callback contains information about the current query:
    conditions, fields, etc.

    If you do not wish the find operation to begin (possibly based on a
    decision relating to the $queryData options), return false. Otherwise,
    return the possibly modified $queryData, or anything you want to get
    passed to find and its counterparts.

    You might use this callback to restrict find operations based on a
    user’s role, or make caching decisions based on the current load.

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

Sidebar

Related Questions

My HotelAddress Model: <?php class HotelAddress extends AppModel { var $name = 'HotelAddress'; var
Here is the content of file User.php <?php class My_Controller_Plugin_User extends Zend_Controller_Plugin_Abstract { public
Please see the following controller in CodeIgniter 2 <?php class user extends CI_Controller {
i created a model object in PHP class User { public $title; public function
I have a files structure like this: Class (folder): - User.php - Rule.php Scripts
PHP PDO Singleton Class: <?php require_once('app/config.php'); // Require constants HOST, DATABASE, USER, PASSWORD /*
http://adldap.sourceforge.net/wiki/doku.php?id=api_user_functions#user_ingroup_username_group_recursive_null I am using the adLDAP class above to authenticate users against our ldap
I have a php class, RegistrationController, <?php class RegistrationController extends ParentController { function __construct()
I am having PHP class class SurveyQuestion extends CActiveRecord { public function relations() {
I've got a zend framework model: class User extends Zend_Db_Table_Abstract { protected $_name =

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.