We have a generic "Notes" field (SQL field (BLOB)) that myself and another admin have been tossing notes into on accounts over the years. We are about to add a number of other admins and need to have some sort of method of accountability. It's great that the admin log logs when a user makes a change to an account, but we've always used this "Notes" field to note what exactly was changed. So my initial plan was to modify the "Notes" row in user_form.html. I was going to display {$smarty.session.amember_admin.login} with a small textarea below it for the logged in user to add a note. Below the textarea I wanted to simply output the current contents of the field in a div so it was read-only. I'd then intercept the UPDATE query and just append what the user had put in the textarea to the existing Notes and tada, have a way our admins can ADD to the user notes, but not edit past notes. My issue is I'm stuck on the loop that creates $additional_fields_html. My plan was to do some simple 'if the Notes field, append input to the top" logic. Problem is I can't find this loop in the other files Anyone ever pull anything like this off?
The best way is to create that field as hidden so it will not be added to $additional_fields_html Then create html code that will handle notes in user_form.html template. $additional_fields_html function modification is not recommended because aMember use it on signup and profile pages as well.
Thanks for the tip! However, I can't seem to find the "hidden" option... I would've guessed it would be under Display Type but I do not have that option.
You can do this from php only. Add this code to /amember/site.inc.php: Code: <? add_member_field( 'notes', 'Notes', 'hidden', '', '', array('hidden_anywhere' => 1)); ?> Field will be available as $member[data][notes]
Gotcha. My hesitation now is what would that do to my existing SQL Notes field that already has a lot of data in it?
use something like this to transfer field data: Code: <? include "config.inc.php"; foreach($db->users_find_by_string("%", "login") as $u){ if($u['oldfiledname']){ $u['data']['notes'] = $u['oldfieldname']; // Or do whatever you want with the field here. $db->update_user($u['member_id'], $u); } } ?>
Ok, I added this code to /amember/site.inc.php: Code: add_member_field( 'notes', 'Notes', 'hidden', '', '', array('hidden_anywhere' => 1)); I added this code to /amember/templates/admin/user_form.html Code: <tr> <th><b>Member Notes:</b></th> <td><textarea name="notes" cols="30" rows="10" >{$u.data.notes|escape}</textarea></td> </tr> I can save and edit text in this text area. I have one question: is this safe and the user cannot read nor write this field ever? Thanks, Erwin