Author Topic: [MOD] ACP Notice Field in Users Profile  (Read 34285 times)

0 Members and 1 Guest are viewing this topic.

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
[MOD] ACP Notice Field in Users Profile
« on: January 18, 2006, 10:35:11 AM »
hi,
here is a little addon for the acp.

1.  :arrow: add a new field in your database in the table 4images_users called user_notice, VARCHAR 255, notnull

2.  :arrow: insert in the db_field_definitions.php:
Code: [Select]
// User's notice
$additional_user_fields['user_notice'] = array($lang['user_notice'], "textarea", 0);

3.  :arrow: insert in your lang/admin.php:
Code: [Select]
$lang['field_user_notice'] = "Notiz";
4. insert in your lang/main.php:
Code: [Select]
$lang['user_notice'] = "Notiz:";
5.  :arrow: in your page_header.php find this:
Code: [Select]
  "charset" => $lang['charset'],and add after it this:
Code: [Select]
  "lang_user_notice" => $lang['user_notice'],
6.1  :arrow: in the admin/user.php find this:
Code: [Select]
  show_form_header("users.php", "removeuser", "form");
  echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
  if ($countusers['users'] > 0) {
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction")."
and replace it with tis:
Code: [Select]
  show_form_header("users.php", "removeuser", "form");
  echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
  if ($countusers['users'] > 0) {
    $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction").", user_notice

6.2  :arrow: then in the same file find this:
Code: [Select]
    echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_email']."</td>\n<td class=\"tableseparator\">".$lang['field_joindate']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
and replace it with this:
Code: [Select]
    echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_email']."</td>\n<td class=\"tableseparator\">".$lang['field_joindate']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">".$lang['field_user_notice']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
6.3  :arrow: in the same file find this:
Code: [Select]
  echo "<td>".format_date($config['date_format']." ".$config['time_format'], $user_row[$user_table_fields['user_lastaction']])."</td>\n";
and add after it this:
Code: [Select]
echo "<td>".$user_row['user_notice']."</td>\n";     

ready!
then you can go to your acp and modify/edit any user. you can see a new field called "Notiz" . here you can write any thing in the field. for example: " userxy is my best friend or pay me 50dollars for my site etc."  :wink:
if you search in acp users you can see the new field with your notice.

sorry about my bad english..


a little modification:
if you want to show the notice to a user in his profile anywhere you want:
7.  :arrow: insert in templates/your_template/member_editprofil.html:
Code: [Select]
{if user_notice} {lang_user_notice} {user_notice} {endif user_notice}if you want to show it in the users profil insert the same code in the templates/your_template/member_profil.html ! but remember then all users can see the notiz. thanks to Stoleti for the idea.


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Notice field added in users profil
« Reply #1 on: January 18, 2006, 05:21:44 PM »
Hallo Loda,

nette Erweiterung des ACP ...  :D
da es sich aber um ein Notizfeld handelt, würde ich aus dem "Text-Feld" ein "Textarea-Feld" machen .
Code: [Select]
// User's notice
$additional_user_fields['user_notice'] = array($lang['user_notice'], "textarea", 0);

Werde das Thema nach Mods & Plugins (Publishing & Support) verschieben .
Bitte ändere noch die Überschrift in : [MOD] ACP Notice Field in Users Profile um das Thema eindeutig zu machen .

danke ... mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: Notice field added in users profil
« Reply #2 on: January 18, 2006, 05:54:56 PM »
but this isn't the same of "Edit User" ??? :roll:

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] APC Notice Field in Users Profile
« Reply #3 on: January 18, 2006, 07:02:40 PM »
hallo!
you are right! I've updated the codes! thank you!

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #4 on: January 18, 2006, 07:22:05 PM »
I'm a little bit confused ... you posted twice you made the changes but still see the field the same way as before ... is there something I'm missing ?

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #5 on: January 18, 2006, 11:57:58 PM »
so this is can be used to post " some warning msg" for some user/profile (i.e "you must delete XX image !!") , i'm correct !? using {user_notice} in member_profile ????  :?:

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #6 on: January 19, 2006, 12:26:57 AM »
... not yet ... now is it only in ACP for admin memory ... but it is possible to use "user_notice" in member profile ... just a few code lines more ...  :wink:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] APC Notice Field in Users Profile
« Reply #7 on: January 19, 2006, 12:38:31 AM »
Basicaly you dont need step 6.x unless you want to see the value of your new field in the memberlist after the search in ACP.

@Stoleti:
Good idea! yes, you can do that with this mod ;) If you are planning to use new field for messages that only admin can modify, then you also should add in member.php below
Code: [Select]
  $user_invisible = (isset($HTTP_POST_VARS['user_invisible'])) ? intval($HTTP_POST_VARS['user_invisible']) : 0;this line:
Code: [Select]
unset($HTTP_POST_VARS['user_notice']);this will ensure that member will not be able alter the value of that field ;)

@mawenzi:
Step 5 needed if you want to show the value of that field in any templates ;)


In the mean time, I might be wrong but
No, get_user_table_field() function can be used only for "default" fields. For custom fields it not only will not work, but it just not needed ;)
get_user_table_field() function needed only for compability with other software integration, which uses same database.


P.S.
"APC" in the name of this topic, shouldnt it be "ACP"?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #8 on: January 19, 2006, 12:51:52 AM »
Quote

No, get_user_table_field() function can be used only for "default" fields. For custom fields it not only will not work, but it just not needed Wink
get_user_table_field() function needed only for compability with other software integration, which uses same database.


Ah ! outstanding then. ;)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #9 on: January 19, 2006, 12:55:03 AM »
@mawenzi:
Step 5 needed if you want to show the value of that field in any templates ;)

of course ... but ...  :roll: ... I did not say anything to step 5 ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] APC Notice Field in Users Profile
« Reply #10 on: January 19, 2006, 01:56:59 AM »
I was referring to this:
... not yet ... now is it only in ACP for admin memory ... but it is possible to use "user_notice" in member profile ... just a few code lines more ...  :wink:
There are no more changes to the code needed, exept for adding new tags in the templates ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] APC Notice Field in Users Profile
« Reply #11 on: January 19, 2006, 02:03:14 AM »
@V@no ... so, ok ...  :wink:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] ACP Notice Field in Users Profile
« Reply #12 on: January 19, 2006, 02:08:27 AM »
Hi,
@the oracle: doppelposting, uuups..
it doesn't work with your changes. and so i was a little bit confused.. sorry!

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] ACP Notice Field in Users Profile
« Reply #13 on: January 19, 2006, 05:19:03 AM »
Quote

it doesn't work with your changes. and so i was a little bit confused.. sorry!


Since specifications of this VERY KNOWN unexplicit bolded term was already explained above, I guess I won't have to ask once more. ;)

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] ACP Notice Field in Users Profile
« Reply #14 on: January 21, 2006, 04:46:55 PM »
hallo!
i've insert the idea of Stoleti ...