Please or Register to create posts and topics.

Filter request: filter_profile_rows / hide_profile_rows

Hallo zusammen,

Ich arbeite derzeit an einer custom profile fields Erweiterung in meinem Frontend Utilities Plugin und bräuchte dafür irgendwie die Möglichkeit alle Profilfelder zu filtern bzw ersetzen.

Benötigt würde der filter in der forum-profile.php ab Zeile 233.

Hier 2 varianten als vorschlag:

$profileRows = array();

// Show first name.
if (!empty($userData->first_name)) {
  $profileRows[] = array(
    'title' => __('First Name:', 'asgaros-forum'),
    'value' => $userData->first_name
  );
}

// Show usergroups.
$userGroups = AsgarosForumUserGroups::getUserGroupsOfUser($userData->ID, 'all', true);

if (!empty($userGroups)) {
  $profileRows[] = array(
    'title' => __('Usergroups:', 'asgaros-forum'),
    'value' => $userGroups
  );
}

// Show website.
if (!empty($userData->user_url)) {
  $profileRows[] = array(
    'title' => __('Website:', 'asgaros-forum'),
    'value' => '<a href="'.$userData->user_url.'" rel="nofollow" target="_blank">'.$userData->user_url.'</a>'
  );
}

// Show last seen.
if ($this->asgarosforum->online->functionality_enabled && $this->asgarosforum->options['show_last_seen']) {
  $profileRows[] = array(
    'title' => __('Last seen:', 'asgaros-forum'),
    'value' => $this->asgarosforum->online->last_seen($userData->ID)
  );
}

// Show member since.
$profileRows[] = array(
  'title' => __('Member Since:', 'asgaros-forum'),
  'value' => $this->asgarosforum->format_date($userData->user_registered, false)
);

// Show biographical info.
if (!empty($userData->description)) {
  $profileRows[] = array(
    'title' => __('Biographical Info:', 'asgaros-forum'),
    'value' => trim(wpautop(esc_html($userData->description)))
  );
}

// Show signature.
$signature = $this->asgarosforum->get_signature($userData->ID);

if ($signature !== false) {
  $profileRows[] = array(
    'title' => __('Signature:', 'asgaros-forum'),
    'value' => $signature
  );
}

$profileRows = apply_filters('asgarosforum_filter_profile_rows', $profileRows);

// Render profile rows
foreach ($profileRows as $row) {
  $this->renderProfileRow($row['title'], $row['value']);
}

do_action('asgarosforum_profile_row', $userData);

oder etwas einfacher ..

if (apply_filters('asgarosforum_hide_profile_rows', true)) {
    // ROWS
}

Vielen dank schon mal!

qualmy91 has reacted to this post.
qualmy91

Hey @quenso,

ich habe den Filter jetzt erstellt:

https://github.com/Asgaros/asgaros-forum/pull/289/

Im Grunde ist es die Variante 1, allerdings mit ein Paar kleinen Anpassungen.

Der sollte dann mit dem nächsten Update eingespielt werden, wenn Thomas den Pull Request freigiebt.

If you ever wonder how to return the favour for helping you.

Auch hier vielen dank! Ich muss mir mal anschauen wie das mit den pull request funktioniert, dann könnte ich des einfach selber machen.

 

Ich denke da werden in nächster Zeit noch 2 oder 3 anfragen kommen.

Hi @qualmy91 @quenso

Sorry für die späte Rückmeldung. Ich werde den PR in Kürze prüfen und dann freigeben!

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