Show forum user role
Quote from slime0k on January 28, 2018, 1:36 pmShowing forum user role below username.
Example.
Profile Picture
Username
Forum User Role <- This is what i want to add
XX Posts.Sorry if my English bad.
Showing forum user role below username.
Example.
Profile Picture
Username
Forum User Role <- This is what i want to add
XX Posts.
Sorry if my English bad.
Quote from Asgaros on January 28, 2018, 9:11 pmHello slime0k,
please add the following code to your themes functions.php-file to show the user-role below the username:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
Hello slime0k,
please add the following code to your themes functions.php-file to show the user-role below the username:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
Quote from v490 on January 29, 2018, 6:53 pmHallo slime0k,
ich habe es nach langem probieren hinbekommen.
Wenn´s Dir gefällt schicke ich Dir gerne den Code für die funktions.php
http://www.myhakotrac.de/forum/
Gruß Robert
Hallo slime0k,
ich habe es nach langem probieren hinbekommen.
Wenn´s Dir gefällt schicke ich Dir gerne den Code für die funktions.php
http://www.myhakotrac.de/forum/
Gruß Robert
Quote from Asgaros on January 30, 2018, 12:31 pmWith usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
With usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
Quote from slime0k on January 30, 2018, 2:52 pmQuote from Asgaros on January 30, 2018, 12:31 pmWith usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
- function show_forum_role($user_id, $post_counter) {
- echo ‘<br>’.AsgarosForumPermissions::getForumRole($user_id);
- // Show user groups.
- $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, ‘names’);
- if (!empty($userGroups)) {
- foreach ($userGroups as $value) {
- echo ‘<br>’.$value;
- }
- }
- }
- add_action(‘asgarosforum_after_post_author’, ‘show_forum_role’, 10, 2);
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
Okay.
Thank you.
Quote from Asgaros on January 30, 2018, 12:31 pmWith usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
- function show_forum_role($user_id, $post_counter) {
- echo ‘<br>’.AsgarosForumPermissions::getForumRole($user_id);
- // Show user groups.
- $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, ‘names’);
- if (!empty($userGroups)) {
- foreach ($userGroups as $value) {
- echo ‘<br>’.$value;
- }
- }
- }
- add_action(‘asgarosforum_after_post_author’, ‘show_forum_role’, 10, 2);
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
Okay.
Thank you.
Quote from digitalant on January 31, 2018, 2:18 pmQuote from Asgaros on January 30, 2018, 12:31 pmWith usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
- function show_forum_role($user_id, $post_counter) {
- echo ‘<br>’.AsgarosForumPermissions::getForumRole($user_id);
- // Show user groups.
- $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, ‘names’);
- if (!empty($userGroups)) {
- foreach ($userGroups as $value) {
- echo ‘<br>’.$value;
- }
- }
- }
- add_action(‘asgarosforum_after_post_author’, ‘show_forum_role’, 10, 2);
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
ok so if it crashes we can just simple remove the code from functions right ?
Quote from Asgaros on January 30, 2018, 12:31 pmWith usergroups included the code could look like this:
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);
- function show_forum_role($user_id, $post_counter) {
- echo ‘<br>’.AsgarosForumPermissions::getForumRole($user_id);
- // Show user groups.
- $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, ‘names’);
- if (!empty($userGroups)) {
- foreach ($userGroups as $value) {
- echo ‘<br>’.$value;
- }
- }
- }
- add_action(‘asgarosforum_after_post_author’, ‘show_forum_role’, 10, 2);
function show_forum_role($user_id, $post_counter) { echo '<br>'.AsgarosForumPermissions::getForumRole($user_id); // Show user groups. $userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($user_id, 'names'); if (!empty($userGroups)) { foreach ($userGroups as $value) { echo '<br>'.$value; } } } add_action('asgarosforum_after_post_author', 'show_forum_role', 10, 2);But keep in mind that those functions are not official API-functions yet and some of them will change in future releases because I am still working on refactoring and optimizing the code-base. So when something crashes after an update please let me know so I can provide you some updated code-snippet.
ok so if it crashes we can just simple remove the code from functions right ?
Quote from Asgaros on January 31, 2018, 7:15 pmCan you tell us the error-message? Maybe we can find a fix for it.
Can you tell us the error-message? Maybe we can find a fix for it.
Quote from childledj on March 12, 2018, 11:20 amHello
Is it possible to show user role (or nickname) in the color which assigned to user role in settings?
Hello
Is it possible to show user role (or nickname) in the color which assigned to user role in settings?
Quote from Asgaros on April 3, 2018, 9:41 amHello @childledj
This is on my todo-list:
https://github.com/Asgaros/asgaros-forum/issues/144
Hello @childledj
This is on my todo-list: