Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the Staff List Widget, [roster] shortcode, and related user meta forms #1763

Open
wants to merge 9 commits into
base: trunk
Choose a base branch
from
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Particular thanks go to outside contributor [@seanchayes](https://github.com/sea
### Potentially-breaking changes

- Replace `#header-social` in CSS files with `.header-social` to mach updated markup. [Pull request #1826](https://github.com/INN/largo/pull/1826) for [issue #1781](https://github.com/INN/largo/issues/1781).
- Removes the Largo Staff Roster Widget. [Pull request #1763](https://github.com/INN/largo/pull/1763/) for [issue #1505](https://github.com/INN/largo/issues/1505).
- Removes the `[roster]` shortcode that can be used to output a list of staff. [Pull request #1763](https://github.com/INN/largo/pull/1763/) for [issue #1505](https://github.com/INN/largo/issues/1505).
- Deprecates the functions `largo_render_user_list` and `largo_render_staff_list_shortcode`. [Pull request #1763](https://github.com/INN/largo/pull/1763/) for [issue #1505](https://github.com/INN/largo/issues/1505).

## [Largo 0.6.4](https://github.com/INN/largo/compare/v0.6.3...v0.6.4)

Expand Down
29 changes: 29 additions & 0 deletions inc/deprecated.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
/**
* Deprecated functions
*/

/**
* Wrapper for wp_nav_menu() that previously cached nav menus. Removed caching mechanism and
Expand Down Expand Up @@ -52,3 +55,29 @@ function largo_fb_user_is_followable( $username = '' ) {
return false;
}

/**
* Former shortcode version of `largo_render_user_list`
*
* @param $atts array The attributes of the shortcode.
* @since 0.4
* @deprecated 0.7
* @link https://github.com/INN/staff
* @link https://github.com/INN/largo/issues/1505
*/
function largo_render_staff_list_shortcode($atts=array()) {
error_log(var_export( 'function largo_render_staff_list_shortcode is deprecated. Use INN\'s Staff plugin instead', true));
}

/**
* Formerly, a list of user profiles based on the array of users passed
*
* @param $users array The WP_User objects to use in rendering the list.
* @param $show_users_with_empty_desc bool Whether we should skip users that have no bio/description.
* @since 0.4
* @deprecated 0.7
* @link https://github.com/INN/staff
* @link https://github.com/INN/largo/issues/1505
*/
function largo_render_user_list($users, $show_users_with_empty_desc=false) {
error_log(var_export( 'function largo_render_user_list is deprecated. Use INN\'s Staff plugin instead', true));
}
83 changes: 0 additions & 83 deletions inc/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,76 +183,6 @@ function largo_get_user_list($args=array()) {
return $users;
}

/**
* Render a list of user profiles based on the array of users passed
*
* @param $users array The WP_User objects to use in rendering the list.
* @param $show_users_with_empty_desc bool Whether we should skip users that have no bio/description.
* @since 0.4
*/
function largo_render_user_list($users, $show_users_with_empty_desc=false) {
echo '<div class="user-list">';
foreach ($users as $user) {
$desc = trim($user->description);
if (empty($desc) && ($show_users_with_empty_desc == false))
continue;

$hide = get_user_meta($user->ID, 'hide', true);
if ($hide == 'on')
continue;

$ctx = array('author_obj' => $user);
echo '<div class="author-box row-fluid">';
largo_render_template('partials/author-bio', 'description', $ctx);
echo '</div>';
}
echo '</div>';
}

/**
* Shortcode version of `largo_render_user_list`
*
* @param $atts array The attributes of the shortcode.
*
* Example of possible attributes:
*
* [roster roles="author,contributor" include="292,12312" exclude="5002,2320" show_users_with_empty_desc="true"]
*
* @since 0.4
*/
function largo_render_staff_list_shortcode($atts=array()) {
$options = array();

$show_users_with_empty_desc = false;
if (!empty($atts['show_users_with_empty_desc'])) {
$show_users_with_empty_desc = ($atts['show_users_with_empty_desc'] == 'false')? false : true;
unset($atts['show_users_with_empty_desc']);
}

if (!empty($atts['roles'])) {
$roles = explode(',', $atts['roles']);
$options['roles'] = array_map(function($arg) { return trim($arg); }, $roles);
}

if (!empty($atts['exclude'])) {
$exclude = explode(',', $atts['exclude']);
$options['exclude'] = array_map(function($arg) { return trim($arg); }, $exclude);
}

if (!empty($atts['include'])) {
$exclude = explode(',', $atts['include']);
$options['include'] = array_map(function($arg) { return trim($arg); }, $exclude);
}

$defaults = array(
'roles' => array(
'author'
)
);
$args = array_merge($defaults, $options);
largo_render_user_list(largo_get_user_list($args), $show_users_with_empty_desc);
}
add_shortcode('roster', 'largo_render_staff_list_shortcode');

/**
* Display extra profile fields related to staff member status
Expand All @@ -262,7 +192,6 @@ function largo_render_staff_list_shortcode($atts=array()) {
*/
function more_profile_info($user) {
$show_email = get_user_meta( $user->ID, "show_email", true );
$hide = get_user_meta( $user->ID, "hide", true );
?>
<h3><?php _e( 'More profile information', 'largo' ); ?></h3>
<table class="form-table">
Expand All @@ -283,16 +212,6 @@ function more_profile_info($user) {
</td>
</tr>

<?php if (current_user_can('edit_users')) { ?>
<tr>
<th><label for="staff_widget"><?php _e( 'Staff status', 'largo' ); ?></label></th>
<td>
<input type="checkbox" name="hide" id="hide"
<?php if (esc_attr($hide) == "on") { ?>checked<?php }?> />
<label for="hide"><?php _e( 'Hide in roster', 'largo' ); ?></label><br />
</td>
</tr>
<?php } ?>
<?php do_action('largo_more_profile_information', $user); ?>
</table>
<?php }
Expand All @@ -315,12 +234,10 @@ function save_more_profile_info($user_id) {

$values = wp_parse_args($_POST, array(
'show_email' => 'on',
'hide' => 'off'
));

update_user_meta($user_id, 'job_title', $values['job_title']);
update_user_meta($user_id, 'show_email', $values['show_email']);
update_user_meta($user_id, 'hide', $values['hide']);
}
add_action('personal_options_update', 'save_more_profile_info');
add_action('edit_user_profile_update', 'save_more_profile_info');
1 change: 0 additions & 1 deletion inc/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function largo_widgets() {
'largo_author_widget' => '/inc/widgets/largo-author-bio.php',
'largo_tag_list_widget' => '/inc/widgets/largo-tag-list.php',
'largo_prev_next_post_links_widget' => '/inc/widgets/largo-prev-next-post-links.php',
'largo_staff_widget' => '/inc/widgets/largo-staff.php'
);

// If series are enabled
Expand Down
136 changes: 0 additions & 136 deletions inc/widgets/largo-staff.php

This file was deleted.

Loading