I'm using the Membership plug-in on a real estate website.
In the User Accounts section I've created a checkbox field called "internal_agent" to distinguish between internal users (checked/yes) vs members who are just website visitors (unchecked/no). The default state is unchecked.
I am currently building a backend lead management webpage where the users with internal agent status can login and see User Account data for visitors that have been assigned to them by the admin.
To assign visitors to agents, I've created a list field within the User Accounts Section called "assign_agent".
This populates from the following MySQL query:
SELECT fullname, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts` WHERE internal_agent = '<?php echo $ESCAPED_FILTER_VALUE ?>'
Then on the webpage I display the User Account member's data assigned to the agent this way.
list($accountsRecords, $accountsMetaData) = getRecords(array(
'tableName' => 'accounts',
'where' => 'assign_agent= "'. $CURRENT_USER['fullname'] .'"' ,
'limit' => '10',
));
This works except for one annoying problem...
When I create or go into an existing User Account record the "assign_agent" list field initially populates with the UNchecked member records (exact opposite of what I want to see). It does not correct the field and show the proper data until I've refreshed the list by changing the field designated in the Advanced Filter as the refresh field.
Once the refresh field has been changed, the MySQL data in that list field refreshes and shows up correctly until you open or create another record- then it reverts back to the opposite data again until manually refreshed (again).
Is there something I've done wrong in creating the assign_agent field or is the solution to simply switch the value of the internal_agent checked box so internal-users are unchecked instead of checked?
Thanks
Sid