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

Add a Button to the Welcome page #373

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change the button to be in a form
akirk committed Oct 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit d154b9462c3ff74f6890c7e09d5bb9e9d4b06f72
2 changes: 1 addition & 1 deletion friends.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion friends.css.map

Large diffs are not rendered by default.

26 changes: 12 additions & 14 deletions friends.scss
Original file line number Diff line number Diff line change
@@ -142,22 +142,20 @@ h2#page-title a.dashicons {

min-height: 100vh;

a:not(.btn) {
&:visited {
color: $link-color-dark;
}
a:visited {
color: $link-color-dark;
}

&.off-canvas-toggle:visited {
color: $link-color;
}
a.off-canvas-toggle:visited {
color: $link-color;
}

&,
&:visited,
&:hover,
&:focus,
&:active {
color: $link-color;
}
a,
a:visited,
a:hover,
a:focus,
a:active {
color: $link-color;
}

summary.accordion-header {
15 changes: 9 additions & 6 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
@@ -1848,10 +1848,12 @@ public function process_admin_add_friend( $vars ) {
return $this->process_admin_add_friend_response( $friend_user, $vars );
}

if ( isset( $vars['friendship'] ) ) {
$rest_url = $vars['friendship'];
} else {
$rest_url = $this->friends->rest->get_friends_rest_url( $feeds );
if ( get_option( 'friends_enable_wp_friendships' ) ) {
if ( isset( $vars['friendship'] ) ) {
$rest_url = $vars['friendship'];
} else {
$rest_url = $this->friends->rest->get_friends_rest_url( $feeds );
}
}
} else {
if ( str_starts_with( $friend_url, home_url() ) ) {
@@ -1892,8 +1894,9 @@ public function process_admin_add_friend( $vars ) {
$friend_user_login = strtolower( str_replace( ' ', '-', sanitize_user( $better_display_name ) ) );
}
}

$rest_url = $this->friends->rest->get_friends_rest_url( $feeds );
if ( get_option( 'friends_enable_wp_friendships' ) ) {
$rest_url = $this->friends->rest->get_friends_rest_url( $feeds );
}
}

if ( $rest_url ) {
13 changes: 7 additions & 6 deletions templates/admin/welcome.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
);

?>

<h1><?php esc_html_e( 'Welcome to the Friends Plugin!', 'friends' ); ?></h1>
<p>
<?php esc_html_e( 'With this plugin you can make your WordPress the center of your online activity.', 'friends' ); ?>
@@ -33,11 +32,13 @@
// translators: %s is the URL of the user's friends page.
echo wp_kses( sprintf( __( 'You can extend your network by <a href=%1$s>subscribing to web sites</a>, <a href=%1$s>sending friend requests</a> or <a href=%2$s>responding to received friend requests</a>.', 'friends' ), '"' . admin_url( 'admin.php?page=add-friend' ) . '"', '"' . admin_url( 'users.php?role=friend_request' ) . '"' ), array( 'a' => array( 'href' => array() ) ) );
?>
<ul>
<li>
<a href="<?php echo \esc_url( \add_query_arg( 'add-friend', $first_friend['url'], \home_url() ) ); ?>" class="btn btn-primary"><?php echo esc_html( $first_friend['display_name'] ); ?></a>
</li>
</ul>
<form action="<?php echo esc_url( self_admin_url( 'admin.php?page=add-friend' ) ); ?>" method="post" class="form-horizontal">
<?php wp_nonce_field( 'add-friend' ); ?>
<input type="hidden" name="friend_url" value="<?php echo esc_attr( $first_friend['url'] ); ?>" />
<div class="form-group">
<button class="btn btn-primary btn-sm"><?php echo esc_html( $first_friend['display_name'] ); ?></button>
</div>
</form>
</li>
<li>
<span><?php esc_html_e( 'A lot of the functionality you might know from other networks is provided by this plugin, just without outside dependencies.', 'friends' ); ?></span>