Extra profile fields & banner image
Quote from Jotner on August 15, 2019, 3:23 pmHi Asgaros!
Is there any possibility to show extra profile fields under the avatar? I have different gamertags and what not on my website which would suit well under the avatar image.
Would it be possible to also change the “banner image” on your profile page with your own banner, not just the blurry avatar?
Thanks!
Hi Asgaros!
Is there any possibility to show extra profile fields under the avatar? I have different gamertags and what not on my website which would suit well under the avatar image.
Would it be possible to also change the “banner image” on your profile page with your own banner, not just the blurry avatar?
Thanks!
Quote from Asgaros on August 15, 2019, 3:35 pmHello @jotner
You can add custom information under the avatar by using the asgarosforum_after_post_author hook. You can find a code-example in the following topic:
https://asgaros.com/support/topic/more-information-under-the-avatar/#postid-7336
The stars will become available with the upcoming v1.15 release.
Currently its not possible to change the banner-image inside of the profile. This banner-image is automatically created based on the profile-picture.
Hello @jotner
You can add custom information under the avatar by using the asgarosforum_after_post_author hook. You can find a code-example in the following topic:
https://asgaros.com/support/topic/more-information-under-the-avatar/#postid-7336
The stars will become available with the upcoming v1.15 release.
Currently its not possible to change the banner-image inside of the profile. This banner-image is automatically created based on the profile-picture.
Quote from Jotner on August 15, 2019, 3:49 pmThanks! I solved it the the hook!
Superb support, keep up the good work. 😀
Unrelated question; Im trying to add a “Administrator” and “Moderator” text under the profile, but the code below can ONLY show the administrator text, how come?
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function getUserRoles($id) { $user = new WP_User((int)$id); return implode(' and ', $user->roles); } function my_asgarosforum_after_post_administration($author_id, $author_posts) { $user_info = get_userdata($author_id); if (user_can( $user_info, 'administrator')) { echo '<div class="icon-status-admin">'.__('Admin','rcl-asgaros').' <i class="fa fa-info-circle"></i></div>'; } else { if (user_can( $user_info, 'moderator')) { echo '<div class="icon-status-moderator">'.__('Moderator','rcl-asgaros').' <i class="fa fa-info-circle"></i></div>'; } } }
Thanks! I solved it the the hook!
Superb support, keep up the good work. 😀
Unrelated question; Im trying to add a “Administrator” and “Moderator” text under the profile, but the code below can ONLY show the administrator text, how come?
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function getUserRoles($id) { $user = new WP_User((int)$id); return implode(' and ', $user->roles); } function my_asgarosforum_after_post_administration($author_id, $author_posts) { $user_info = get_userdata($author_id); if (user_can( $user_info, 'administrator')) { echo '<div class="icon-status-admin">'.__('Admin','rcl-asgaros').' <i class="fa fa-info-circle"></i></div>'; } else { if (user_can( $user_info, 'moderator')) { echo '<div class="icon-status-moderator">'.__('Moderator','rcl-asgaros').' <i class="fa fa-info-circle"></i></div>'; } } }
Quote from Asgaros on August 15, 2019, 4:02 pmI suggest you to use the get_forum_role() function:
global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { // } else if ($role === 'moderator') { // }
I suggest you to use the get_forum_role() function:
global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { // } else if ($role === 'moderator') { // }
Quote from Jotner on August 15, 2019, 4:16 pmQuote from Asgaros on August 15, 2019, 4:02 pmI suggest you to use the get_forum_role() function:
global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { // } else if ($role === 'moderator') { // }
Hmm, I dont know what part of the code I should switch for this.
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function getUserRoles($id) { $user = new WP_User((int)$id); return implode(' and ', $user->roles); } function my_asgarosforum_after_post_administration($author_id, $author_posts) { $user_info = get_userdata($author_id); global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Quote from Asgaros on August 15, 2019, 4:02 pmI suggest you to use the get_forum_role() function:
global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { // } else if ($role === 'moderator') { // }
Hmm, I dont know what part of the code I should switch for this.
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function getUserRoles($id) { $user = new WP_User((int)$id); return implode(' and ', $user->roles); } function my_asgarosforum_after_post_administration($author_id, $author_posts) { $user_info = get_userdata($author_id); global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($user_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Quote from Asgaros on August 15, 2019, 4:20 pmTry the following:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($author_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Try the following:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($author_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Quote from Jotner on August 15, 2019, 4:22 pmQuote from Asgaros on August 15, 2019, 4:20 pmTry the following:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($author_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Only works for moderators, not admins. :/
This apparently only works for other admins except for the site owner? Which role does the owner have? In the user control panel it says “Administrator” and “Keymaster” but neither works with the above code.
Quote from Asgaros on August 15, 2019, 4:20 pmTry the following:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; $role = $asgarosforum->permissions->get_forum_role($author_id); if ($role === 'administrator') { echo 'lol'; } else if ($role === 'moderator') { echo 'lolbo'; } }
Only works for moderators, not admins. :/
This apparently only works for other admins except for the site owner? Which role does the owner have? In the user control panel it says “Administrator” and “Keymaster” but neither works with the above code.
Quote from Asgaros on August 16, 2019, 11:05 amHello again @jotner
For the admin you have to ensure that the user has the WordPress role “Administrator” or is a “Forum Administrator”. Other roles like “Keymaster” are not supported because they are no default WordPress roles.
Hello again @jotner
For the admin you have to ensure that the user has the WordPress role “Administrator” or is a “Forum Administrator”. Other roles like “Keymaster” are not supported because they are no default WordPress roles.
Quote from Jotner on August 16, 2019, 11:07 am@asgaros
The admin has the role Administrator and Forum Administrator but it wont show anyway. Only shows for the other admins on my site.
The admin has the role Administrator and Forum Administrator but it wont show anyway. Only shows for the other admins on my site.
Quote from Asgaros on August 16, 2019, 11:14 amOkay, lets try the following implementation instead:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; if ($asgarosforum->permissions->isAdministrator($author_id)) { echo 'lol'; } else if ($asgarosforum->permissions->isModerator($author_id)) { echo 'lolbo'; } }
Okay, lets try the following implementation instead:
add_action('asgarosforum_after_post_author', 'my_asgarosforum_after_post_administration', 10, 2); function my_asgarosforum_after_post_administration($author_id, $author_posts) { global $asgarosforum; if ($asgarosforum->permissions->isAdministrator($author_id)) { echo 'lol'; } else if ($asgarosforum->permissions->isModerator($author_id)) { echo 'lolbo'; } }