Please or Register to create posts and topics.

Extra profile fields & banner image

Page 1 of 2Next

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!

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.

Jotner has reacted to this post.
Jotner
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

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>';
    }
  }
}

 

 

 

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') {
  //
}

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on August 15, 2019, 4:02 pm

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') {
  //
}

 

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';
  }
}

 

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';
  }
}

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on August 15, 2019, 4:20 pm

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';
  }
}

 

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.

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.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

@asgaros

The admin has the role Administrator and Forum Administrator but it wont show anyway. Only shows for the other admins on my site.

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';
  }
}

 

Jotner has reacted to this post.
Jotner
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Page 1 of 2Next