Benutzerdefinierte Spalte zum Benutzer-Admin-Bereich hinzufügen
-
-
Haben Sieeine Telefonnummereingerichtet?Ichmeine,kann Ihr Benutzer Telefonnummernin sein Profileinfügen?Do you have phone number setup? I mean can your user add phone numbers in their profile?
- 0
- 2014-09-06
- Robert hue
-
nein ..ichmöchtenur wissen,wieman hinzufügt ..esistnichtnur diese Kontaktnummer zu reparieren ..es kann auchnureine leere Spalte seinno .. I just want to know how to add .. its not fix that contact number only .. its can b just a blank column also
- 0
- 2014-09-06
- Rohil_PHPBeginner
-
Wenn Ihre Site vielebenutzerdefinierte Spaltenenthält,könnte Sieein Pluginnamens Admin Columnsinteressieren.If your site had a lot of custom columns, you might be interested in a plugin called Admin Columns.
- 1
- 2016-06-01
- somebodysomewhere
-
Sie können diesen Blogmit detaillierten Erklärungen sehen http://tekina.info/add-extra-column-user-listing-page-wordpress-admin-panel/you can see this blog with detailed explanation http://tekina.info/add-extra-column-user-listing-page-wordpress-admin-panel/
- 0
- 2017-09-12
- Aniket Singh
-
Für Nicht-Codierergibt esein Plugin [Erweitertebenutzerdefinierte Felder] (https://www.advancedcustomfields.com/).(Googleführt auch zu dieser Seite. Neulinge kennenmöglicherweisenicht alle Plugins von WordPress.)For the non-coders, there is a plugin [Advanced Custom Fields](https://www.advancedcustomfields.com/). (Google leads to this page, too. Newbies might not know all plugins of WordPress)
- 0
- 2020-07-12
- koppor
-
1 Antworten
- Stimmen
-
- 2014-09-06
Ok,hierist der Code,mit dem Ihre Benutzer Telefonnummern hinzufügen können. Fügen Sie diesen vollständigen Codein die Dateifunctions.phpein. Dadurch wirdein neues Feldim Benutzerprofilfür "Telefonnummer" hinzugefügt undeine Spaltenbenutzertabellein WordPress adminfür das Telefon hinzugefügt.
function new_contact_methods( $contactmethods ) { $contactmethods['phone'] = 'Phone Number'; return $contactmethods; } add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 ); function new_modify_user_table( $column ) { $column['phone'] = 'Phone'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table' ); function new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case 'phone' : return get_the_author_meta( 'phone', $user_id ); default: } return $val; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
EDIT
Um zwei Spalten hinzuzufügen,müssen Sieeinige Änderungen vornehmen. Vergleichen Siebeide Codes,um sie zu verstehen.
function new_modify_user_table( $column ) { $column['phone'] = 'Phone'; $column['xyz'] = 'XYZ'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table' ); function new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case 'phone' : return get_the_author_meta( 'phone', $user_id ); case 'xyz' : return ''; default: } return $val; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
Ok, Here is the code to allow your users to add phone numbers. Paste this full code in functions.php file. This will add new field on user profile for "Phone Number" and add a column user table on WordPress admin for phone.
function new_contact_methods( $contactmethods ) { $contactmethods['phone'] = 'Phone Number'; return $contactmethods; } add_filter( 'user_contactmethods', 'new_contact_methods', 10, 1 ); function new_modify_user_table( $column ) { $column['phone'] = 'Phone'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table' ); function new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case 'phone' : return get_the_author_meta( 'phone', $user_id ); default: } return $val; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
EDIT
To add two columns you need to make some changes. Compare both codes to understand.
function new_modify_user_table( $column ) { $column['phone'] = 'Phone'; $column['xyz'] = 'XYZ'; return $column; } add_filter( 'manage_users_columns', 'new_modify_user_table' ); function new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case 'phone' : return get_the_author_meta( 'phone', $user_id ); case 'xyz' : return ''; default: } return $val; } add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
-
Verwenden Sie den Codeerneut.Ich habeesgeändert,damit Sie das Telefonfeld auchin der Benutzerliste sehen können.Use code again. I changed it so you can see phone field on user list too.
- 0
- 2014-09-06
- Robert hue
-
Großartig!hatfunktioniert .. Aber zum Zeitpunkt des Hinzufügenseines Benutzers,warumfragen sienichtnach der Telefonnummer?Great! worked .. But at the time of adding user why are they not asking for Phone Number ?
- 0
- 2014-09-06
- Rohil_PHPBeginner
-
Können Sie diesen Codebitte erklären?Ichmöchteein weiteres Feld hinzufügen,aberes zeigtmireinen Fehler an.Can you please explain this code ? I want to add one more field but it is showing me an error.
- 0
- 2014-09-06
- Rohil_PHPBeginner
-
Überprüfen Sie die Änderungenim obigen Code.Sie könnenbeliebig viele Spalten hinzufügen.Check edits in above code. You can add as many columns as you want.
- 0
- 2014-09-06
- Robert hue
-
Ich würde vorschlagen,dass dieseinem [Site-spezifischen Plugin] hinzugefügt wird (http://ottopress.com/2011/creating-a-site-specific-snippets-plugin/),daesnichtsmit dem Erscheinungsbild des Themas zutun hat.I would suggest this be added to a [site-specific plugin](http://ottopress.com/2011/creating-a-site-specific-snippets-plugin/) since it has nothing to do with the theme's appearance.
- 2
- 2014-09-06
- helgatheviking
-
danke Robert .. du hastmir sehrgeholfen !! Kannst dumirnur das Letzte sagen? Wasist 10 & 3in der letzten Zeile des Codes?thanks Robert .. you helped me a lot !! can you just tell me last thing .. what is 10 & 3 in the last line of the code ..
- 0
- 2014-09-06
- Rohil_PHPBeginner
-
Dasist Priorität und akzeptierte Argumente.Überprüfen Sie die Dokumente zu add_filter hier,http://codex.wordpress.org/Function_Reference/add_filterThat is priority and accepted args. Check docs on add_filter here, http://codex.wordpress.org/Function_Reference/add_filter
- 0
- 2014-09-06
- Robert hue
-
Wennes sich umein kommerzielles (kostenloses oder kostenpflichtiges) Thema handelt,fügen Sie diesen Codebitte nichtin die Dateifunctions.php des Themasein.Sie können diese Änderungen verlieren,wenn das Thema aktualisiert wird.Machen Sie dazuein kleines Plugin.If it is a commercial (free or paid) theme then please don't put this code in theme's functions.php. Because, you can lose these changes if theme is updated. Make a small plugin for this.
- 1
- 2015-04-27
- Omar Tariq
-
Wasist die $ Rendite?what's the $return?
- 0
- 2016-02-04
- Mateusz Bartkowski
-
Ja,warumgibt es am Endebitte eine "Rückgabe $ Rückgabe"?Könntest dueserklären?Yes why there is a `return $return` at the end, please? could you explain it?
- 0
- 2016-03-30
- LoicTheAztec
-
Schließlich sind "$ user=get_userdata ($ user_id)" und "return $ return" absolut **nicht **notwendig.Die Variable "$ user" wird von der Funktionnicht verwendet und "$ return"istnicht definiert,sodassnichts zurückgegeben wird.Finally `$user = get_userdata( $user_id );` and `return $return` are absolutely **not** necessary. Variable `$user` is not used by the function and `$return` is not defined so it is returning nothing.
- 1
- 2016-03-30
- LoicTheAztec
-
hey @ Robert hue dankefür den Arbeitscode.Ich habeeine Frage.Ich sehe diese Spaltenichtin meiner DB-Tabelle wp_users.Warum?hey @Robert hue thanks for the working code. I have one question. I don't see this column in my DB wp_users table. Why?
- 1
- 2016-05-03
- Anahit DEV
-
Ichbekommenichts von dieser Funktionnew_modify_user_table_row ($ val,$ Spaltenname,$ user_id). Können Siemirbitte mitteilen,warum?I am getting nothing from in this fucntion new_modify_user_table_row( $val, $column_name, $user_id ) , Can you please let me know why?
- 0
- 2016-05-27
- Deepak saini
-
@Roberthuegibt eseine Möglichkeit,die Spalteneu zu ordnen?@Roberthue is there a way to re-order the column?
- 0
- 2016-06-08
- JohnnyQ
-
ahfandes [hier] (http://codepixelz.com/web-design/how-to-add-new-column-on-user-listing-of-wordpress-dashboard/).ah found it [here](http://codepixelz.com/web-design/how-to-add-new-column-on-user-listing-of-wordpress-dashboard/).
- 0
- 2016-06-08
- JohnnyQ
-
Wirklichpingelig,aber wirbrauchen wahrscheinlich keine Pause;wie wirin den obigen Zeilen zurückkehren.Vielen Dankfür die Veröffentlichung - wirklichgeholfen.Really nitpicky but we probably don't need the break; as we are doing a return on the lines above. Thanks for posting though - really helped.
- 0
- 2017-10-11
- Daniel Casserly
In USERSgibt es standardmäßig 5 Spaltenmit dem Namen Benutzername Name E-Mail-Rollenbeiträge. Jetztmöchteichnocheine Spaltemit seiner Kontaktnummer hinzufügen.
Wie kannich daserreichen?