Skip to content

Commit

Permalink
Merge pull request #1778 from WPBuddy/1777-fix-largo-mailchimp-link
Browse files Browse the repository at this point in the history
1777 Project Largo Help dashboard widget updates
  • Loading branch information
joshdarby authored Mar 23, 2021
2 parents 4f40936 + 042d46b commit fb65806
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 80 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Particular thanks go to outside contributor [@seanchayes](https:/sea
- Updates the `edit_link()` function to only display the "Edit Post" link if it's not returned empty. [Pull request #1879](https:/WPBuddy/largo/pull/1879) by [@michaels23](https:/michaels23).
- Adds `Mx.` to list of known honorifics for the `largo_trim_sentences` function. [Pull request #1876](https:/WPBuddy/largo/pull/1876) for [issue #1869](https:/WPBuddy/largo/issues/1869) by [@pedroxido](https:/pedroxido).
- Adds relevant labels to all taxonomies created by Largo when they are initially registered. [Pull request #1821](https:/WPBuddy/largo/pull/1821) for [issue #1346](https:/WPBuddy/largo/issues/1346) by [@charmoney](https:/charmoney).
- Revised the Largo help widget in the admin dashboard to remove duplicate and dead links and also swap INN references to WP Buddy. [Pull request #1778](https:/INN/largo/pull/1778) for issues [#1777](https:/INN/largo/issues/1777), [#1644](https:/INN/largo/issues/1644), and [#1495](https:/INN/largo/issues/1495).

### Potentially-breaking changes

Expand Down
116 changes: 36 additions & 80 deletions inc/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,8 @@
* @since 0.1
*/

// cleanup the wordpress dashboard and add a few of our own widgets
function largo_dashboard_widgets_member() {
global $wp_meta_boxes;

unset(
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'],
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'],
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']
);

wp_add_dashboard_widget( 'dashboard_quick_links', __( 'Project Largo Help', 'largo' ), 'largo_dashboard_quick_links' );

wp_add_dashboard_widget( 'dashboard_network_news', __( 'INN Network News', 'largo' ), 'largo_dashboard_network_news' );
$my_widget = $wp_meta_boxes['dashboard']['normal']['core']['dashboard_network_news'];
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_network_news']);
$wp_meta_boxes['dashboard']['side']['core']['dashboard_network_news'] = $my_widget;
}

// we'll still clean things up a bit for non INN members
function largo_dashboard_widgets_nonmember() {
// dashboad widgets for everyone!
function largo_dashboard_widgets() {
global $wp_meta_boxes;

unset(
Expand All @@ -42,43 +20,37 @@ function largo_dashboard_widgets_nonmember() {

wp_add_dashboard_widget( 'dashboard_quick_links', __( 'Project Largo Help', 'largo' ), 'largo_dashboard_quick_links' );

wp_add_dashboard_widget( 'dashboard_network_news', __( 'INN Network News', 'largo' ), 'largo_dashboard_network_news' );
$my_widget = $wp_meta_boxes['dashboard']['normal']['core']['dashboard_network_news'];
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_network_news']);
$wp_meta_boxes['dashboard']['side']['core']['dashboard_network_news'] = $my_widget;
}

// custom dashboard widgets for INN members
function largo_dashboard_network_news() {
echo '<div class="rss-widget">';
wp_widget_rss_output( array(
'url' => 'https://feeds.feedburner.com/INNArticles',
'title' => __( 'INN Network News', 'largo' ),
'items' => 1,
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1
));
echo '</div>';
}

/**
* Largo dashboard quick links
*/
function largo_dashboard_quick_links() {
echo '
<div class="list-widget">
<p>If you\'re having trouble with your site, want to request a new feature or are just interested in learning more about Project Largo, here are a few helpful links:</p>
<ul>
<li><a href="https://largo.inn.org/">Largo Project Website</a></li>
<li><a href="https://largo.readthedocs.io/">Largo Documentation</a></li>
<li><a href="mailto:[email protected]">Contact Us</a></li>
<li><a href="https://support.inn.org/">Help Desk</a></li>
<li><a href="https://support.inn.org/">Knowledge Base</a></li>
</ul>
<p>Developers can also log issues on <a href="https:/INN/Largo">our public github repository</a> and if you would like to be included in our Largo users\' group, <a href="http://inn.us1.list-manage1.com/subscribe?u=81670c9d1b5fbeba1c29f2865&id=913028b23c">sign up here</a>.</p>
</div>
';
echo '<div class="list-widget">';
printf(
'<p>%1$s</p>',
__( 'If you\'re having trouble with your site, want to request a new feature or are just interested in learning more about Project Largo, here are a few helpful links:', 'largo' )
);
echo '<ul>';
$links = array(
// these are translated with their HTML in case we have different-language versions of these
__( '<a href="https://largo.wpbuddy.co/">Largo Project Website</a>', 'largo' ),
__( '<a href="https://largo.readthedocs.io/">Largo Documentation</a>', 'largo' ),
__( '<a href="https://largo.wpbuddy.co/support">Help Desk and Knowledge Base</a>', 'largo' ),
__( '<a href="mailto:[email protected]">Contact Us</a>', 'largo' ),
);
foreach ( $links as $link ) {
printf(
'<li>%1$s</li>',
$link
);
}
echo '</ul>';
printf(
'<p>%1$s</p>',
__( 'Developers can also log issues on <a href="https:/WPBuddy/Largo">the theme\'s GitHub repository</a>. We welcome contributions.', 'largo' ), // translate the HTML in case the link needs localization.
);
echo '</div>';
}

// add the largo logo to the login page
Expand All @@ -95,13 +67,9 @@ function largo_custom_login_logo() {
';
}

// only load the dashboard customizations if this is an INN member site
if ( INN_MEMBER === TRUE ) {
add_action('login_head', 'largo_custom_login_logo');
add_action('wp_dashboard_setup', 'largo_dashboard_widgets_member');
} else {
add_action('wp_dashboard_setup', 'largo_dashboard_widgets_nonmember');
}
// load the dashboard customizations
add_action('login_head', 'largo_custom_login_logo');
add_action('wp_dashboard_setup', 'largo_dashboard_widgets');

/**
* Largo Dashboard / Admin Bar Menu
Expand All @@ -117,50 +85,38 @@ function largo_dash_admin_menu( $wp_admin_bar ) {
$wp_admin_bar->add_node( $args );

// Main Website
$args = array( 'id' => 'website', 'title' => 'Main Website', 'href' => 'https://largo.inn.org//', 'parent' => 'largo_admin_mega' );
$args = array( 'id' => 'website', 'title' => 'Main Website', 'href' => 'https://largo.wpbuddy.co/', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Documentation
$args = array( 'id' => 'largo_docs', 'title' => 'Documentation', 'href' => 'https://largo.readthedocs.io/', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Knowledge Base
$args = array( 'id' => 'knowledge_base', 'title' => 'Knowledge Base', 'href' => 'https://support.inn.org/', 'parent' => 'largo_admin_mega' );
$args = array( 'id' => 'knowledge_base', 'title' => 'Knowledge Base', 'href' => 'https://largo.wpbuddy.co/support', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Member Help Desk
$args = array( 'id' => 'support', 'title' => 'Help Desk', 'href' => 'https://support.inn.org/', 'parent' => 'largo_admin_mega' );
$args = array( 'id' => 'support', 'title' => 'Help Desk', 'href' => 'https://largo.wpbuddy.co/support', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Member Forums
$args = array( 'id' => 'user_forums', 'title' => 'Community Forums', 'href' => 'https://support.inn.org/', 'parent' => 'largo_admin_mega' );
$args = array( 'id' => 'user_forums', 'title' => 'Community Forums', 'href' => 'https://largo.wpbuddy.co/support', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Largo on GitHub
$args = array( 'id' => 'github', 'title' => 'Largo on GitHub', 'href' => 'https:/inn/largo', 'parent' => 'largo_admin_mega' );
$args = array( 'id' => 'github', 'title' => 'Largo on GitHub', 'href' => 'https:/WPBuddy/largo', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Largo on Twitter
$args = array( 'id' => 'twitter', 'title' => '@LargoProject on Twitter', 'href' => 'https://twitter.com/largoproject', 'parent' => 'largo_admin_mega');
$wp_admin_bar->add_node( $args );

// INN Nerds
$args = array( 'id' => 'inn_nerds', 'title' => 'INN Nerds', 'href' => 'https://labs.inn.org/', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// About INN
$args = array( 'id' => 'about_inn', 'title' => 'About INN', 'href' => 'https://inn.org', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

// Donate
$args = array( 'id' => 'donate_inn', 'title' => 'Donate', 'href' => 'https://inn.org/donate/', 'parent' => 'largo_admin_mega' );
$wp_admin_bar->add_node( $args );

}

// add a credit line to the admin footer
function largo_admin_footer_text( $default_text ) {
return '<span id="footer-thankyou">This website powered by <a href="https://largo.inn.org/">Project Largo</a> from <a href="https://inn.org/">INN</a> and <a href="https://wordpress.org">WordPress</a>.</span>';
return '<span id="footer-thankyou">This website powered by <a href="https://largo.wpbuddy.co/">Project Largo</a> from <a href="https://wpbuddy.co/">WP Buddy</a> and <a href="https://wordpress.org">WordPress</a>.</span>';
}
add_filter( 'admin_footer_text', 'largo_admin_footer_text' );

Expand Down

0 comments on commit fb65806

Please sign in to comment.