Skip to content

Commit

Permalink
feat(tags): better list generation (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 committed Feb 23, 2022
1 parent 579aa83 commit 7239064
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Go to `Mozilla Settings` in the left sidebar to add the following settings.

## Sample data

This is [MySQL dump](https://github.com/mozilla/community-portal/files/7418593/community.tar.gz) with credentials as `admin/password` with admin rights and plugins configured (as this readme) with some example events as host `community.test`.
This is [MySQL dump](https://github.com/mozilla/community-portal/files/8116830/community-2022-02-22-c19c553.tar.gz) with credentials as `admin/password` with admin rights and plugins configured (as this readme) with some example events as host `community.test`.

## Install Plugins
- Once the site is created, the following plugins need to be installed:
Expand Down
1 change: 1 addition & 0 deletions buddypress/members/single/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ class="form__error-container
<?php esc_html_e( 'Bio (optional)', 'community-portal' ); ?>
</label>
<?php
$bio = '';
if ( $form && isset( $form['bio'] ) ) {
$bio = $form['bio'];
} else {
Expand Down
52 changes: 19 additions & 33 deletions buddypress/members/single/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,47 +673,33 @@ class="st1"
</div>
</div>
<?php endif; ?>
<?php if ( $info['tags']->value && $info['tags']->display ) : ?>
<?php if ( $info['tags']->value && $info['tags']->display ) { ?>
<div class="profile__tags-card profile__card--right">
<?php esc_html_e( 'Tags', 'community-portal' ); ?>
<div class="profile__tags-container">
<?php $tags = array_filter( explode( ',', $info['tags']->value ) ); ?>
<?php $system_tags = get_tags( array( 'hidden_empty' => false ) ); ?>
<?php foreach ( $tags as $loop_tag ) : ?>
<?php
foreach ( $system_tags as $t ) {
$found = false;
if ( 'en' !== $current_translation ) {
$temp_slug = $t->slug;
if ( false !== stripos( $temp_slug, '_' ) ) {
$temp_slug = substr( $temp_slug, 0, stripos( $temp_slug, '_' ) );
}
$temp_name = $t->name;
if ( strtolower( $temp_slug ) === strtolower( $loop_tag ) ) {
$t->slug = $temp_slug;
$found = true;
break;
}
} else {
$temp_name = $t->name;
$temp_slug = $t->slug;
if ( strtolower( $t->slug ) === strtolower( $loop_tag ) ) {
$found = true;
break;
}
}
}
?>
<?php if ( $found ) : ?>
<a href="<?php echo esc_url_raw( add_query_arg( array( 'tag' => $temp_slug ), get_home_url( null, 'people' ) ) ); ?>" class="profile__static-tag">
<?php
$tags = array_filter( explode( ',', $info['tags']->value ) );
foreach ( $tags as $loop_tag ) {
$found = false;
$temp_name = '';
$exist = get_term_by( 'slug', $loop_tag, 'post_tag' );
if ( ! is_bool( $exist ) ) {
$found = true;
$temp_name = $exist->name;
}
?>
<?php if ( $found ) { ?>
<a href="<?php echo esc_url_raw( add_query_arg( array( 'tag' => $loop_tag ), get_home_url( null, 'people' ) ) ); ?>" class="profile__static-tag">
<span>
<?php echo esc_html( $temp_name ); ?>
</span>
</a>
<?php endif; ?>
<?php endforeach; ?>
<?php
}
}
?>
</div>
</div>
<?php endif; ?>
<?php } ?>
</section>
</div>

0 comments on commit 7239064

Please sign in to comment.